diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 8451b1875c..5f342d71ef 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -8,6 +8,7 @@ Yii Framework 2 Change Log - Bug #20437: Fix PHPStan/Psalm annotations for `BaseArrayHelper::merge` (max-s-lab) - Enh #20434: Added PHPStan/Psalm annotations for `hasMany` and `hasOne` methods (max-s-lab) - Enh #20433: Added PHPStan/Psalm annotations for some controllers methods: `beforeAction`, `afterAction` and `bindActionParams` (max-s-lab) +- Enh #20442: Add PHPStan/Psalm annotations for `yii\base\Controller` methods: `runAction`, `run`, `render`, `renderPartial` and `renderFile` (max-s-lab) 2.0.53 June 27, 2025 diff --git a/framework/base/Controller.php b/framework/base/Controller.php index d571772260..ccc20e2eb4 100644 --- a/framework/base/Controller.php +++ b/framework/base/Controller.php @@ -147,6 +147,9 @@ class Controller extends Component implements ViewContextInterface * @return mixed the result of the action. * @throws InvalidRouteException if the requested action ID cannot be resolved into an action successfully. * @see createAction() + * + * @phpstan-param array $params + * @psalm-param array $params */ public function runAction($id, $params = []) { @@ -208,6 +211,9 @@ class Controller extends Component implements ViewContextInterface * @param array $params the parameters to be passed to the action. * @return mixed the result of the action. * @see runAction() + * + * @phpstan-param array $params + * @psalm-param array $params */ public function run($route, $params = []) { @@ -422,6 +428,9 @@ class Controller extends Component implements ViewContextInterface * These parameters will not be available in the layout. * @return string the rendering result. * @throws InvalidArgumentException if the view file or the layout file does not exist. + * + * @phpstan-param array $params + * @psalm-param array $params */ public function render($view, $params = []) { @@ -453,6 +462,9 @@ class Controller extends Component implements ViewContextInterface * @param array $params the parameters (name-value pairs) that should be made available in the view. * @return string the rendering result. * @throws InvalidArgumentException if the view file does not exist. + * + * @phpstan-param array $params + * @psalm-param array $params */ public function renderPartial($view, $params = []) { @@ -465,6 +477,9 @@ class Controller extends Component implements ViewContextInterface * @param array $params the parameters (name-value pairs) that should be made available in the view. * @return string the rendering result. * @throws InvalidArgumentException if the view file does not exist. + * + * @phpstan-param array $params + * @psalm-param array $params */ public function renderFile($file, $params = []) {