@@ -38,7 +38,7 @@ class ItemController extends Controller
3838 /**
3939 * @inheritdoc
4040 */
41- public function behaviors ()
41+ public function behaviors (): array
4242 {
4343 return [
4444 'verbs ' => [
@@ -83,11 +83,11 @@ public function actionIndex()
8383 /**
8484 * Displays a single AuthItem model.
8585 *
86- * @param string $id
86+ * @param int $id
8787 *
8888 * @return mixed
8989 */
90- public function actionView ($ id )
90+ public function actionView (int $ id )
9191 {
9292 $ model = $ this ->findModel ($ id );
9393
@@ -120,11 +120,11 @@ public function actionCreate()
120120 *
121121 * If update is successful, the browser will be redirected to the 'view' page.
122122 *
123- * @param string $id
123+ * @param int $id
124124 *
125125 * @return mixed
126126 */
127- public function actionUpdate ($ id )
127+ public function actionUpdate (int $ id )
128128 {
129129 $ model = $ this ->findModel ($ id );
130130
@@ -142,11 +142,11 @@ public function actionUpdate($id)
142142 *
143143 * If deletion is successful, the browser will be redirected to the 'index' page.
144144 *
145- * @param string $id
145+ * @param int $id
146146 *
147147 * @return mixed
148148 */
149- public function actionDelete ($ id )
149+ public function actionDelete (int $ id )
150150 {
151151 $ model = $ this ->findModel ($ id );
152152 Yii::$ app ->getAuthManager ()->remove ($ model ->item );
@@ -158,11 +158,11 @@ public function actionDelete($id)
158158 /**
159159 * Assign items
160160 *
161- * @param string $id
161+ * @param int $id
162162 *
163163 * @return array
164164 */
165- public function actionAssign ($ id )
165+ public function actionAssign (int $ id )
166166 {
167167 $ items = Yii::$ app ->getRequest ()->post ('items ' , []);
168168 $ model = $ this ->findModel ($ id );
@@ -174,11 +174,11 @@ public function actionAssign($id)
174174 /**
175175 * Remove items
176176 *
177- * @param string $id
177+ * @param int $id
178178 *
179179 * @return array
180180 */
181- public function actionRemove ($ id )
181+ public function actionRemove (int $ id ): array
182182 {
183183 $ items = Yii::$ app ->getRequest ()->post ('items ' , []);
184184 $ model = $ this ->findModel ($ id );
@@ -190,23 +190,23 @@ public function actionRemove($id)
190190 /**
191191 * @inheritdoc
192192 */
193- public function getViewPath ()
193+ public function getViewPath (): string
194194 {
195195 return $ this ->module ->getViewPath () . DIRECTORY_SEPARATOR . 'item ' ;
196196 }
197197
198198 /**
199199 * @return int
200200 */
201- public function getType ()
201+ public function getType (): int
202202 {
203203 return $ this ->type ;
204204 }
205205
206206 /**
207207 * @return array
208208 */
209- public function getLabels ()
209+ public function getLabels (): array
210210 {
211211 return $ this ->labels ;
212212 }
@@ -216,13 +216,13 @@ public function getLabels()
216216 *
217217 * If the model is not found, a 404 HTTP exception will be thrown.
218218 *
219- * @param string $id
219+ * @param int $id
220220 *
221221 * @return AuthItemModel the loaded model
222222 *
223223 * @throws NotFoundHttpException if the model cannot be found
224224 */
225- protected function findModel ($ id )
225+ protected function findModel (int $ id ): AuthItemModel
226226 {
227227 $ auth = Yii::$ app ->getAuthManager ();
228228 $ item = $ this ->type === Item::TYPE_ROLE ? $ auth ->getRole ($ id ) : $ auth ->getPermission ($ id );
0 commit comments