Close #109 provide better error classes + phpdoc fixes

This commit is contained in:
Antonio Ramirez
2017-11-12 23:13:42 +01:00
parent c418ad967c
commit 83458a13e4
26 changed files with 109 additions and 20 deletions

View File

@ -35,6 +35,8 @@ class PermissionController extends AbstractAuthItemController
/**
* {@inheritdoc}
*
* @throws NotFoundHttpException
*/
protected function getItem($name)
{

View File

@ -24,6 +24,8 @@ use Da\User\Service\ResetPasswordService;
use Da\User\Traits\ContainerAwareTrait;
use Da\User\Validator\AjaxRequestModelValidator;
use Yii;
use yii\base\InvalidConfigException;
use yii\base\InvalidParamException;
use yii\filters\AccessControl;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
@ -74,6 +76,8 @@ class RecoveryController extends Controller
* Displays / handles user password recovery request.
*
* @throws NotFoundHttpException
* @throws InvalidConfigException
* @throws InvalidParamException
* @return string
*
*/
@ -118,6 +122,8 @@ class RecoveryController extends Controller
* @param $code
*
* @throws NotFoundHttpException
* @throws InvalidConfigException
* @throws InvalidParamException
* @return string
*
*/

View File

@ -35,6 +35,8 @@ class RoleController extends AbstractAuthItemController
/**
* {@inheritdoc}
*
* @throws NotFoundHttpException
*/
protected function getItem($name)
{

View File

@ -21,6 +21,8 @@ use Da\User\Service\SocialNetworkAuthenticateService;
use Da\User\Traits\ContainerAwareTrait;
use Yii;
use yii\authclient\AuthAction;
use yii\base\InvalidConfigException;
use yii\base\InvalidParamException;
use yii\base\Module;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
@ -102,6 +104,8 @@ class SecurityController extends Controller
/**
* Controller action responsible for handling login page and actions.
*
* @throws InvalidConfigException
* @throws InvalidParamException
* @return array|string|Response
*/
public function actionLogin()

View File

@ -179,7 +179,7 @@ class SettingsController extends Controller
{
$user = $this->userQuery->whereId($id)->one();
if ($user === null || $this->module->emailChangeStrategy == MailChangeStrategyInterface::TYPE_INSECURE) {
if ($user === null || MailChangeStrategyInterface::TYPE_INSECURE === $this->module->emailChangeStrategy) {
throw new NotFoundHttpException();
}
$event = $this->make(UserEvent::class, [$user]);
@ -210,7 +210,7 @@ class SettingsController extends Controller
if ($account === null) {
throw new NotFoundHttpException();
}
if ($account->user_id != Yii::$app->user->id) {
if ($account->user_id !== Yii::$app->user->id) {
throw new ForbiddenHttpException();
}
$event = $this->make(SocialNetworkConnectEvent::class, [Yii::$app->user->identity, $account]);