From fa1792291473098338e0ed8b26762693c0a75d23 Mon Sep 17 00:00:00 2001 From: tonis ormisson Date: Wed, 10 Aug 2022 16:58:13 +0300 Subject: [PATCH] phpstan: missing declared return --- src/User/Service/UserCreateService.php | 4 ++-- src/User/Validator/AjaxRequestModelValidator.php | 5 ++++- src/User/resources/views/permission/update.php | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/User/Service/UserCreateService.php b/src/User/Service/UserCreateService.php index a631d5e..1d66720 100644 --- a/src/User/Service/UserCreateService.php +++ b/src/User/Service/UserCreateService.php @@ -76,14 +76,14 @@ class UserCreateService implements ServiceInterface ['email' => $model->email] ); // from web display a flash message (if enabled) - if ($this->getModule()->enableFlashMessages === true && is_a(Yii::$app, yii\web\Application::class)) { + if ($this->getModule()->enableFlashMessages === true && is_a(Yii::$app, "yii\web\Application")) { Yii::$app->session->setFlash( 'warning', $error_msg ); } // if we're from console add an error to the model in order to return an error message - if (is_a(Yii::$app, yii\console\Application::class)) { + if (is_a(Yii::$app, "yii\console\Application")) { $model->addError('username', $error_msg); } $transaction->rollBack(); diff --git a/src/User/Validator/AjaxRequestModelValidator.php b/src/User/Validator/AjaxRequestModelValidator.php index 6f3775e..a4ea712 100644 --- a/src/User/Validator/AjaxRequestModelValidator.php +++ b/src/User/Validator/AjaxRequestModelValidator.php @@ -32,9 +32,12 @@ class AjaxRequestModelValidator implements ValidatorInterface if ($request->getIsAjax() && $this->model->load($request->post())) { Yii::$app->response->format = Response::FORMAT_JSON; - Yii::$app->response->data = ActiveForm::validate($this->model); + $result = ActiveForm::validate($this->model); + Yii::$app->response->data = $result; Yii::$app->response->send(); Yii::$app->end(); + return $result; } + return false; } } diff --git a/src/User/resources/views/permission/update.php b/src/User/resources/views/permission/update.php index a553acb..26a84e5 100644 --- a/src/User/resources/views/permission/update.php +++ b/src/User/resources/views/permission/update.php @@ -31,4 +31,3 @@ $this->params['breadcrumbs'][] = $this->title; ) ?> endContent() ?> -