1 | <?php |
||
15 | class UsersController extends \yii\web\Controller |
||
16 | { |
||
17 | use ModelTrait; |
||
18 | |||
19 | 6 | public function behaviors() |
|
20 | { |
||
21 | return [ |
||
22 | 6 | 'verbs' => [ |
|
23 | 'class' => VerbFilter::class, |
||
24 | 'actions' => [ |
||
25 | 'set-active' => ['post'], |
||
26 | 'set-block' => ['post'], |
||
27 | 'delete' => ['post'], |
||
28 | 'operations' => ['post'], |
||
29 | 'photo-upload' => ['post'], |
||
30 | ], |
||
31 | ], |
||
32 | ]; |
||
33 | } |
||
34 | |||
35 | 6 | public function actions() |
|
36 | { |
||
37 | return [ |
||
38 | 6 | 'operations' => [ |
|
39 | 6 | 'class' => 'app\modules\admin\controllers\common\OperationsAction', |
|
40 | 'modelClass' => User::class, |
||
41 | 'operations' => [ |
||
42 | 'delete' => [], |
||
43 | 6 | 'set-active' => ['status' => User::STATUS_ACTIVE], |
|
44 | 6 | 'set-block' => ['status' => User::STATUS_BLOCKED] |
|
45 | ] |
||
46 | ], |
||
47 | 'set-active' => [ |
||
48 | 6 | 'class' => 'app\modules\admin\controllers\common\UpdateAttributesAction', |
|
49 | 'modelClass' => User::class, |
||
50 | 6 | 'attributes' => ['status' => User::STATUS_ACTIVE], |
|
51 | ], |
||
52 | 'set-block' => [ |
||
53 | 6 | 'class' => 'app\modules\admin\controllers\common\UpdateAttributesAction', |
|
54 | 'modelClass' => User::class, |
||
55 | 6 | 'attributes' => ['status' => User::STATUS_BLOCKED], |
|
56 | ], |
||
57 | 'delete' => [ |
||
58 | 'class' => 'app\modules\admin\controllers\common\DeleteAction', |
||
59 | 'modelClass' => User::class, |
||
60 | ], |
||
61 | 'photo-upload' => [ |
||
62 | 'class' => 'rkit\filemanager\actions\UploadAction', |
||
63 | 'modelClass' => UserProfile::class, |
||
64 | 'attribute' => 'photo', |
||
65 | 'inputName' => 'file', |
||
66 | ], |
||
67 | ]; |
||
68 | } |
||
69 | |||
70 | 6 | public function actionIndex() |
|
83 | |||
84 | 3 | public function actionEdit($id = null) |
|
85 | { |
||
111 | |||
112 | 2 | public function actionProfile($id) |
|
139 | } |
||
140 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.