Add generics for all controllers (#20675)

This commit is contained in:
Maksim Spirkov
2025-11-03 12:59:23 +03:00
committed by GitHub
parent 0998ac6cb1
commit 7dd3dede14
36 changed files with 216 additions and 63 deletions

View File

@@ -9,6 +9,7 @@ namespace yii\captcha;
use Yii;
use yii\base\InvalidConfigException;
use yii\base\Module;
use yii\helpers\Json;
use yii\validators\ValidationAsset;
use yii\validators\Validator;
@@ -69,18 +70,21 @@ class CaptchaValidator extends Validator
* @return CaptchaAction the action object
* @throws InvalidConfigException
*
* @phpstan-return CaptchaAction<Controller>
* @psalm-return CaptchaAction<Controller>
* @phpstan-return CaptchaAction<Controller<Module>>
* @psalm-return CaptchaAction<Controller<Module>>
*/
public function createCaptchaAction()
{
$ca = Yii::$app->createController($this->captchaAction);
if ($ca !== false) {
/** @var Controller $controller */
/**
* @var Controller $controller
* @phpstan-var Controller<Module> $controller
*/
list($controller, $actionID) = $ca;
/**
* @var CaptchaAction|null
* @phpstan-var CaptchaAction<Controller>|null
* @phpstan-var CaptchaAction<Controller<Module>>|null
*/
$action = $controller->createAction($actionID);
if ($action !== null) {