Phpstan fix (#465)

phpstan level 2: services and i18n
This commit is contained in:
Tõnis Ormisson
2022-08-11 11:27:04 +03:00
committed by GitHub
parent 339b9f1bbc
commit 368563dcc0
11 changed files with 13 additions and 48 deletions

View File

@ -226,7 +226,7 @@ class SessionHistoryDecorator extends Session
return $this->session->writeSession($id, $data) && return $this->session->writeSession($id, $data) &&
( (
false === $this->getModule()->enableSessionHistory || false === $this->getModule()->enableSessionHistory ||
$this->getDb()->transaction(function () use ($id, $data) { $this->getDb()->transaction(function () {
if (Yii::$app->user->getIsGuest()) { if (Yii::$app->user->getIsGuest()) {
return true; return true;
} }
@ -278,7 +278,7 @@ class SessionHistoryDecorator extends Session
return $this->session->gcSession($maxLifetime) && return $this->session->gcSession($maxLifetime) &&
( (
false === $this->getModule()->enableSessionHistory || false === $this->getModule()->enableSessionHistory ||
$this->getDb()->transaction(function () use ($maxLifetime) { $this->getDb()->transaction(function () {
$this->getDb()->createCommand()->update( $this->getDb()->createCommand()->update(
$this->sessionHistoryTable, $this->sessionHistoryTable,
$this->condition->inactiveData(), $this->condition->inactiveData(),

View File

@ -20,6 +20,7 @@ use Da\User\Traits\ModuleAwareTrait;
use Exception; use Exception;
use Yii; use Yii;
use yii\base\InvalidCallException; use yii\base\InvalidCallException;
use yii\web\Application;
class UserCreateService implements ServiceInterface class UserCreateService implements ServiceInterface
{ {
@ -76,7 +77,7 @@ class UserCreateService implements ServiceInterface
['email' => $model->email] ['email' => $model->email]
); );
// from web display a flash message (if enabled) // from web display a flash message (if enabled)
if ($this->getModule()->enableFlashMessages === true && is_a(Yii::$app, yii\web\Application::class)) { if ($this->getModule()->enableFlashMessages === true && is_a(Yii::$app, Application::class)) {
Yii::$app->session->setFlash( Yii::$app->session->setFlash(
'warning', 'warning',
$error_msg $error_msg

View File

@ -12,6 +12,7 @@
namespace Da\User\Widget; namespace Da\User\Widget;
use Da\User\Model\SessionHistory; use Da\User\Model\SessionHistory;
use Da\User\Traits\AuthManagerAwareTrait;
use Da\User\Traits\ContainerAwareTrait; use Da\User\Traits\ContainerAwareTrait;
use Yii; use Yii;
use yii\base\InvalidConfigException; use yii\base\InvalidConfigException;
@ -22,6 +23,7 @@ use yii\helpers\ArrayHelper;
class SessionStatusWidget extends Widget class SessionStatusWidget extends Widget
{ {
use ContainerAwareTrait; use ContainerAwareTrait;
use AuthManagerAwareTrait;
/** /**
* @var SessionHistory * @var SessionHistory

View File

@ -273,13 +273,8 @@ return [
'{0, date, MMM dd, YYYY HH:mm}' => '{0, date, dd. MMM YYYY, HH:mm}', '{0, date, MMM dd, YYYY HH:mm}' => '{0, date, dd. MMM YYYY, HH:mm}',
'{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd. MMMM YYYY, HH:mm}', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd. MMMM YYYY, HH:mm}',
'{0} cannot be blank.' => '{0} darf nicht leer sein.', '{0} cannot be blank.' => '{0} darf nicht leer sein.',
'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '',
'Data privacy' => '',
'If you haven\'t received a password, you can reset it at' => '', 'If you haven\'t received a password, you can reset it at' => '',
'Submit' => '',
'Unfortunately, you can not work with this site without giving us consent to process your data.' => '',
'You received this email because someone, possibly you or someone on your behalf, have created an account at {app_name}' => '', 'You received this email because someone, possibly you or someone on your behalf, have created an account at {app_name}' => '',
'Your consent is required to work with this site' => '',
'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '',
'A message has been sent to your email address. ' => '@@Eine Nachricht wurde an Deine E-Mail Adresse gesendet@@', 'A message has been sent to your email address. ' => '@@Eine Nachricht wurde an Deine E-Mail Adresse gesendet@@',
'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@', 'Every user having your role has two factor authentication mandatory, you must enable it' => '@@@@',
@ -300,5 +295,4 @@ return [
'User ID' => '', 'User ID' => '',
'User agent' => '', 'User agent' => '',
'Your consent is required to work with this site' => '', 'Your consent is required to work with this site' => '',
'A message has been sent to your email address. ' => '@@Eine Nachricht wurde an Deine E-Mail Adresse gesendet@@',
]; ];

View File

@ -277,25 +277,18 @@ return [
'{0, date, MMM dd, YYYY HH:mm}' => '{0, date, dd. MMM YYYY, HH:mm}', '{0, date, MMM dd, YYYY HH:mm}' => '{0, date, dd. MMM YYYY, HH:mm}',
'{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd. MMMM YYYY, HH:mm}', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd. MMMM YYYY, HH:mm}',
'{0} cannot be blank.' => '{0} darf nicht leer sein.', '{0} cannot be blank.' => '{0} darf nicht leer sein.',
'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '',
'Active' => '', 'Active' => '',
'Current' => '', 'Current' => '',
'Data privacy' => '',
'IP' => '', 'IP' => '',
'Inactive' => '', 'Inactive' => '',
'Last activity' => '', 'Last activity' => '',
'Session ID' => '', 'Session ID' => '',
'Session history' => '', 'Session history' => '',
'Status' => '', 'Status' => '',
'Submit' => '',
'Terminate all sessions' => '', 'Terminate all sessions' => '',
'Unfortunately, you can not work with this site without giving us consent to process your data.' => '',
'User ID' => '', 'User ID' => '',
'User agent' => '', 'User agent' => '',
'Your consent is required to work with this site' => '',
'Information' => '',
'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '',
'If you haven\'t received a password, you can reset it at' => '', 'If you haven\'t received a password, you can reset it at' => '',
'Information' => '',
'You received this email because someone, possibly you or someone on your behalf, have created an account at {app_name}' => '', 'You received this email because someone, possibly you or someone on your behalf, have created an account at {app_name}' => '',
]; ];

View File

@ -151,13 +151,7 @@ return [
'Your profile has been updated' => 'پروفایل شما بروز شد', 'Your profile has been updated' => 'پروفایل شما بروز شد',
'{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM, YYYY HH:mm}', '{0, date, MMMM dd, YYYY HH:mm}' => '{0, date, dd MMMM, YYYY HH:mm}',
'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '',
'Account' => '',
'Account confirmation' => '',
'Account details' => '',
'Account details have been updated' => '',
'Account settings' => '',
'Active' => '', 'Active' => '',
'Already registered? Sign in!' => '',
'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '', 'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '',
'Are you sure you want to switch to this user for the rest of this Session?' => '', 'Are you sure you want to switch to this user for the rest of this Session?' => '',
'Are you sure you wish the user to change their password at next login?' => '', 'Are you sure you wish the user to change their password at next login?' => '',
@ -202,21 +196,14 @@ return [
'Here you can download your personal data in a comma separated values format.' => '', 'Here you can download your personal data in a comma separated values format.' => '',
'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '', 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '',
'IP' => '', 'IP' => '',
'If you already registered, sign in and connect this account on settings page' => '',
'If you cannot click the link, please try pasting the text into your browser' => '',
'If you did not make this request you can ignore this email' => '',
'Impersonate this user' => '', 'Impersonate this user' => '',
'In order to finish your registration, we need you to enter following fields' => '', 'In order to finish your registration, we need you to enter following fields' => '',
'Inactive' => '', 'Inactive' => '',
'Information' => '',
'Invalid login or password' => '',
'Invalid or expired link' => '',
'Invalid password' => '', 'Invalid password' => '',
'Invalid two factor authentication code' => '', 'Invalid two factor authentication code' => '',
'Invalid value' => '', 'Invalid value' => '',
'It will be deleted forever' => '', 'It will be deleted forever' => '',
'Items' => '', 'Items' => '',
'Joined on {0, date}' => '',
'Last activity' => '', 'Last activity' => '',
'Last login IP' => '', 'Last login IP' => '',
'Last login time' => '', 'Last login time' => '',
@ -245,9 +232,6 @@ return [
'Scan the QrCode with Google Authenticator App, then insert its temporary code on the box and submit.' => '', 'Scan the QrCode with Google Authenticator App, then insert its temporary code on the box and submit.' => '',
'Select rule...' => '', 'Select rule...' => '',
'Send password recovery email' => '', 'Send password recovery email' => '',
'Sign in' => '',
'Sign up' => '',
'Something went wrong' => '',
'Submit' => '', 'Submit' => '',
'Switch identities is disabled.' => '', 'Switch identities is disabled.' => '',
'The "recaptcha" component must be configured.' => '', 'The "recaptcha" component must be configured.' => '',

View File

@ -281,22 +281,15 @@ return [
'{0} cannot be blank.' => '{0} non può essere vuoto.', '{0} cannot be blank.' => '{0} non può essere vuoto.',
'If you haven\'t received a password, you can reset it at' => '', 'If you haven\'t received a password, you can reset it at' => '',
'You received this email because someone, possibly you or someone on your behalf, have created an account at {app_name}' => '', 'You received this email because someone, possibly you or someone on your behalf, have created an account at {app_name}' => '',
'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '',
'Active' => '', 'Active' => '',
'An email with instructions to create a new password has been sent to {email} if it is associated with an {appName} account. Your existing password has not been changed.' => '',
'Current' => '', 'Current' => '',
'Data privacy' => '',
'IP' => '', 'IP' => '',
'Inactive' => '', 'Inactive' => '',
'Last activity' => '', 'Last activity' => '',
'Session ID' => '', 'Session ID' => '',
'Session history' => '', 'Session history' => '',
'Status' => '', 'Status' => '',
'Submit' => '',
'Terminate all sessions' => '', 'Terminate all sessions' => '',
'Unfortunately, you can not work with this site without giving us consent to process your data.' => '',
'User ID' => '', 'User ID' => '',
'User agent' => '', 'User agent' => '',
'Your consent is required to work with this site' => '',
'{0, date, MMM dd, YYYY HH:mm}' => '',
]; ];

View File

@ -116,7 +116,6 @@ return [
'Here you can download your personal data in a comma separated values format.' => '', 'Here you can download your personal data in a comma separated values format.' => '',
'IP' => '', 'IP' => '',
'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '', 'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '',
'I agree processing of my personal data and the use of cookies to facilitate the operation of this site. For more information read our {privacyPolicy}' => '',
'If you already registered, sign in and connect this account on settings page' => '', 'If you already registered, sign in and connect this account on settings page' => '',
'If you cannot click the link, please try pasting the text into your browser' => '', 'If you cannot click the link, please try pasting the text into your browser' => '',
'If you did not make this request you can ignore this email' => '', 'If you did not make this request you can ignore this email' => '',

View File

@ -289,10 +289,8 @@ return [
'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '', 'According to the European General Data Protection Regulation (GDPR) we need your consent to work with your personal data.' => '',
'Data privacy' => '', 'Data privacy' => '',
'If you haven\'t received a password, you can reset it at' => '', 'If you haven\'t received a password, you can reset it at' => '',
'Submit' => '',
'Unfortunately, you can not work with this site without giving us consent to process your data.' => '', 'Unfortunately, you can not work with this site without giving us consent to process your data.' => '',
'You received this email because someone, possibly you or someone on your behalf, have created an account at {app_name}' => '', 'You received this email because someone, possibly you or someone on your behalf, have created an account at {app_name}' => '',
'Your consent is required to work with this site' => '',
'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '', 'Your role requires 2FA, you won\'t be able to use the application until you enable it' => '',
'A message has been sent to your email address. ' => '@@Сообщение было отправлено на вашу электронную почту@@', 'A message has been sent to your email address. ' => '@@Сообщение было отправлено на вашу электронную почту@@',
'An email has been sent with instructions for resetting your password' => '@@Вам отправлено письмо с инструкциями по смене пароля@@', 'An email has been sent with instructions for resetting your password' => '@@Вам отправлено письмо с инструкциями по смене пароля@@',

View File

@ -19,9 +19,10 @@ use yii\web\View;
use yii\data\ActiveDataProvider; use yii\data\ActiveDataProvider;
/** /**
* @var $this View * @var View $this
* @var $searchModel SessionHistorySearch * @var SessionHistorySearch $searchModel
* @var $dataProvider ActiveDataProvider * @var ActiveDataProvider $dataProvider
* @var \Da\User\Model\User $user
*/ */
?> ?>

View File

@ -19,9 +19,9 @@ use yii\data\ActiveDataProvider;
use Da\User\Widget\SessionStatusWidget; use Da\User\Widget\SessionStatusWidget;
/** /**
* @var $this View * @var View $this
* @var $searchModel SessionHistorySearch * @var SessionHistorySearch $searchModel
* @var $dataProvider ActiveDataProvider * @var ActiveDataProvider $dataProvider
*/ */
$this->title = Yii::t('usuario', 'Session history'); $this->title = Yii::t('usuario', 'Session history');