mirror of
https://github.com/yiisoft/yii2.git
synced 2025-12-15 02:40:52 +08:00
Add generics for all controllers (#20675)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user