phpstan: missing service returns

This commit is contained in:
tonis ormisson
2022-08-10 16:48:03 +03:00
parent 197a6b7636
commit 3e33813fd5
3 changed files with 7 additions and 0 deletions

View File

@ -52,6 +52,8 @@
"2amigos/qrcode-library": "Needed if you want to enable 2FA with QR Code generation. Require version ^1.1" "2amigos/qrcode-library": "Needed if you want to enable 2FA with QR Code generation. Require version ^1.1"
}, },
"require-dev": { "require-dev": {
"2amigos/2fa-library": "^2.0",
"2amigos/qrcode-library": "^2.0",
"friendsofphp/php-cs-fixer": "^2.3", "friendsofphp/php-cs-fixer": "^2.3",
"squizlabs/php_codesniffer": "*", "squizlabs/php_codesniffer": "*",
"phpmd/phpmd": "@stable", "phpmd/phpmd": "@stable",

View File

@ -67,6 +67,7 @@ class SocialNetworkAuthenticateService implements ServiceInterface
$event = Yii::createObject(SocialNetworkAuthEvent::class, [$account, $this->client]); $event = Yii::createObject(SocialNetworkAuthEvent::class, [$account, $this->client]);
$this->controller->trigger(SocialNetworkAuthEvent::EVENT_BEFORE_AUTHENTICATE, $event); $this->controller->trigger(SocialNetworkAuthEvent::EVENT_BEFORE_AUTHENTICATE, $event);
$result = false;
if ($account->user instanceof User) { if ($account->user instanceof User) {
if ($account->user->getIsBlocked()) { if ($account->user->getIsBlocked()) {
@ -75,12 +76,15 @@ class SocialNetworkAuthenticateService implements ServiceInterface
} else { } else {
Yii::$app->user->login($account->user, $this->controller->module->rememberLoginLifespan); Yii::$app->user->login($account->user, $this->controller->module->rememberLoginLifespan);
$this->authAction->setSuccessUrl(Yii::$app->getUser()->getReturnUrl()); $this->authAction->setSuccessUrl(Yii::$app->getUser()->getReturnUrl());
$result = true;
} }
} else { } else {
$this->authAction->setSuccessUrl($account->getConnectionUrl()); $this->authAction->setSuccessUrl($account->getConnectionUrl());
$result = true;
} }
$this->controller->trigger(SocialNetworkAuthEvent::EVENT_AFTER_AUTHENTICATE, $event); $this->controller->trigger(SocialNetworkAuthEvent::EVENT_AFTER_AUTHENTICATE, $event);
return $result;
} }
protected function createAccount() protected function createAccount()

View File

@ -65,5 +65,6 @@ class SwitchIdentityService implements ServiceInterface
/** @var IdentityInterface $user */ /** @var IdentityInterface $user */
Yii::$app->user->switchIdentity($user, $session->timeout); Yii::$app->user->switchIdentity($user, $session->timeout);
$this->controller->trigger(UserEvent::EVENT_AFTER_SWITCH_IDENTITY, $event); $this->controller->trigger(UserEvent::EVENT_AFTER_SWITCH_IDENTITY, $event);
return true;
} }
} }