Skip to content

Commit 490bf7a

Browse files
author
igor-chepurnoi
committed
fix type hinting
1 parent b38a197 commit 490bf7a

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

base/ItemController.php

+12-12
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ public function actionIndex()
8383
/**
8484
* Displays a single AuthItem model.
8585
*
86-
* @param int $id
86+
* @param string $id
8787
*
8888
* @return mixed
8989
*/
90-
public function actionView(int $id)
90+
public function actionView(string $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 int $id
123+
* @param string $id
124124
*
125125
* @return mixed
126126
*/
127-
public function actionUpdate(int $id)
127+
public function actionUpdate(string $id)
128128
{
129129
$model = $this->findModel($id);
130130

@@ -142,11 +142,11 @@ public function actionUpdate(int $id)
142142
*
143143
* If deletion is successful, the browser will be redirected to the 'index' page.
144144
*
145-
* @param int $id
145+
* @param string $id
146146
*
147147
* @return mixed
148148
*/
149-
public function actionDelete(int $id)
149+
public function actionDelete(string $id)
150150
{
151151
$model = $this->findModel($id);
152152
Yii::$app->getAuthManager()->remove($model->item);
@@ -158,11 +158,11 @@ public function actionDelete(int $id)
158158
/**
159159
* Assign items
160160
*
161-
* @param int $id
161+
* @param string $id
162162
*
163163
* @return array
164164
*/
165-
public function actionAssign(int $id)
165+
public function actionAssign(string $id)
166166
{
167167
$items = Yii::$app->getRequest()->post('items', []);
168168
$model = $this->findModel($id);
@@ -174,11 +174,11 @@ public function actionAssign(int $id)
174174
/**
175175
* Remove items
176176
*
177-
* @param int $id
177+
* @param string $id
178178
*
179179
* @return array
180180
*/
181-
public function actionRemove(int $id): array
181+
public function actionRemove(string $id): array
182182
{
183183
$items = Yii::$app->getRequest()->post('items', []);
184184
$model = $this->findModel($id);
@@ -216,13 +216,13 @@ public function getLabels(): array
216216
*
217217
* If the model is not found, a 404 HTTP exception will be thrown.
218218
*
219-
* @param int $id
219+
* @param string $id
220220
*
221221
* @return AuthItemModel the loaded model
222222
*
223223
* @throws NotFoundHttpException if the model cannot be found
224224
*/
225-
protected function findModel(int $id): AuthItemModel
225+
protected function findModel(string $id): AuthItemModel
226226
{
227227
$auth = Yii::$app->getAuthManager();
228228
$item = $this->type === Item::TYPE_ROLE ? $auth->getRole($id) : $auth->getPermission($id);

controllers/RuleController.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ public function actionIndex()
6363
/**
6464
* Displays a single Rule item.
6565
*
66-
* @param int $id
66+
* @param string $id
6767
*
6868
* @return mixed
6969
*/
70-
public function actionView(int $id)
70+
public function actionView(string $id)
7171
{
7272
$model = $this->findModel($id);
7373

@@ -99,11 +99,11 @@ public function actionCreate()
9999
*
100100
* If update is successful, the browser will be redirected to the 'view' page.
101101
*
102-
* @param int $id
102+
* @param string $id
103103
*
104104
* @return mixed
105105
*/
106-
public function actionUpdate(int $id)
106+
public function actionUpdate(string $id)
107107
{
108108
$model = $this->findModel($id);
109109

@@ -121,11 +121,11 @@ public function actionUpdate(int $id)
121121
*
122122
* If deletion is successful, the browser will be redirected to the 'index' page.
123123
*
124-
* @param int $id
124+
* @param string $id
125125
*
126126
* @return mixed
127127
*/
128-
public function actionDelete(int $id)
128+
public function actionDelete(string $id)
129129
{
130130
$model = $this->findModel($id);
131131
Yii::$app->authManager->remove($model->item);
@@ -139,13 +139,13 @@ public function actionDelete(int $id)
139139
*
140140
* If the model is not found, a 404 HTTP exception will be thrown.
141141
*
142-
* @param int $id
142+
* @param string $id
143143
*
144144
* @return BizRuleModel the loaded model
145145
*
146146
* @throws \yii\web\NotFoundHttpException
147147
*/
148-
protected function findModel(int $id)
148+
protected function findModel(string $id)
149149
{
150150
$item = Yii::$app->authManager->getRule($id);
151151

0 commit comments

Comments
 (0)