Skip to content

Commit

Permalink
fix type hinting
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-chepurnoi committed Aug 23, 2017
1 parent b38a197 commit 490bf7a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
24 changes: 12 additions & 12 deletions base/ItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ public function actionIndex()
/**
* Displays a single AuthItem model.
*
* @param int $id
* @param string $id
*
* @return mixed
*/
public function actionView(int $id)
public function actionView(string $id)
{
$model = $this->findModel($id);

Expand Down Expand Up @@ -120,11 +120,11 @@ public function actionCreate()
*
* If update is successful, the browser will be redirected to the 'view' page.
*
* @param int $id
* @param string $id
*
* @return mixed
*/
public function actionUpdate(int $id)
public function actionUpdate(string $id)
{
$model = $this->findModel($id);

Expand All @@ -142,11 +142,11 @@ public function actionUpdate(int $id)
*
* If deletion is successful, the browser will be redirected to the 'index' page.
*
* @param int $id
* @param string $id
*
* @return mixed
*/
public function actionDelete(int $id)
public function actionDelete(string $id)
{
$model = $this->findModel($id);
Yii::$app->getAuthManager()->remove($model->item);
Expand All @@ -158,11 +158,11 @@ public function actionDelete(int $id)
/**
* Assign items
*
* @param int $id
* @param string $id
*
* @return array
*/
public function actionAssign(int $id)
public function actionAssign(string $id)
{
$items = Yii::$app->getRequest()->post('items', []);
$model = $this->findModel($id);
Expand All @@ -174,11 +174,11 @@ public function actionAssign(int $id)
/**
* Remove items
*
* @param int $id
* @param string $id
*
* @return array
*/
public function actionRemove(int $id): array
public function actionRemove(string $id): array
{
$items = Yii::$app->getRequest()->post('items', []);
$model = $this->findModel($id);
Expand Down Expand Up @@ -216,13 +216,13 @@ public function getLabels(): array
*
* If the model is not found, a 404 HTTP exception will be thrown.
*
* @param int $id
* @param string $id
*
* @return AuthItemModel the loaded model
*
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel(int $id): AuthItemModel
protected function findModel(string $id): AuthItemModel
{
$auth = Yii::$app->getAuthManager();
$item = $this->type === Item::TYPE_ROLE ? $auth->getRole($id) : $auth->getPermission($id);
Expand Down
16 changes: 8 additions & 8 deletions controllers/RuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ public function actionIndex()
/**
* Displays a single Rule item.
*
* @param int $id
* @param string $id
*
* @return mixed
*/
public function actionView(int $id)
public function actionView(string $id)
{
$model = $this->findModel($id);

Expand Down Expand Up @@ -99,11 +99,11 @@ public function actionCreate()
*
* If update is successful, the browser will be redirected to the 'view' page.
*
* @param int $id
* @param string $id
*
* @return mixed
*/
public function actionUpdate(int $id)
public function actionUpdate(string $id)
{
$model = $this->findModel($id);

Expand All @@ -121,11 +121,11 @@ public function actionUpdate(int $id)
*
* If deletion is successful, the browser will be redirected to the 'index' page.
*
* @param int $id
* @param string $id
*
* @return mixed
*/
public function actionDelete(int $id)
public function actionDelete(string $id)
{
$model = $this->findModel($id);
Yii::$app->authManager->remove($model->item);
Expand All @@ -139,13 +139,13 @@ public function actionDelete(int $id)
*
* If the model is not found, a 404 HTTP exception will be thrown.
*
* @param int $id
* @param string $id
*
* @return BizRuleModel the loaded model
*
* @throws \yii\web\NotFoundHttpException
*/
protected function findModel(int $id)
protected function findModel(string $id)
{
$item = Yii::$app->authManager->getRule($id);

Expand Down

0 comments on commit 490bf7a

Please sign in to comment.