Fix PHPStan errors (#20609)

This commit is contained in:
Maksim Spirkov
2025-10-14 19:30:00 +03:00
committed by GitHub
parent f5f610dd7a
commit 33bcf7fffa
4 changed files with 6 additions and 5 deletions

View File

@ -90,7 +90,7 @@ class Widget extends Component implements ViewContextInterface
public static function begin($config = []) public static function begin($config = [])
{ {
$config['class'] = get_called_class(); $config['class'] = get_called_class();
/** @var self $widget */ /** @var static $widget */
$widget = Yii::createObject($config); $widget = Yii::createObject($config);
self::$stack[] = $widget; self::$stack[] = $widget;
self::$_resolvedClasses[get_called_class()] = get_class($widget); self::$_resolvedClasses[get_called_class()] = get_class($widget);
@ -113,7 +113,7 @@ class Widget extends Component implements ViewContextInterface
$calledClass = self::$_resolvedClasses[get_called_class()] ?? get_called_class(); $calledClass = self::$_resolvedClasses[get_called_class()] ?? get_called_class();
if (get_class($widget) === $calledClass) { if (get_class($widget) === $calledClass) {
/** @var self $widget */ /** @var static $widget */
if ($widget->beforeRun()) { if ($widget->beforeRun()) {
$result = $widget->run(); $result = $widget->run();
$result = $widget->afterRun($result); $result = $widget->afterRun($result);

View File

@ -65,7 +65,7 @@ class CaptchaValidator extends Validator
/** /**
* Creates the CAPTCHA action object from the route specified by [[captchaAction]]. * Creates the CAPTCHA action object from the route specified by [[captchaAction]].
* @return \yii\captcha\CaptchaAction the action object * @return CaptchaAction the action object
* @throws InvalidConfigException * @throws InvalidConfigException
*/ */
public function createCaptchaAction() public function createCaptchaAction()
@ -74,6 +74,7 @@ class CaptchaValidator extends Validator
if ($ca !== false) { if ($ca !== false) {
/** @var \yii\base\Controller $controller */ /** @var \yii\base\Controller $controller */
list($controller, $actionID) = $ca; list($controller, $actionID) = $ca;
/** @var CaptchaAction|null */
$action = $controller->createAction($actionID); $action = $controller->createAction($actionID);
if ($action !== null) { if ($action !== null) {
return $action; return $action;

View File

@ -139,7 +139,7 @@ class Pagination extends BaseObject implements Linkable
public $pageSizeLimit = [1, 50]; public $pageSizeLimit = [1, 50];
/** /**
* @var int number of items on each page. * @var int|null number of items on each page.
* If it is less than 1, it means the page size is infinite, and thus a single page contains all items. * If it is less than 1, it means the page size is infinite, and thus a single page contains all items.
*/ */
private $_pageSize; private $_pageSize;

View File

@ -100,7 +100,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
public $fileTransportCallback; public $fileTransportCallback;
/** /**
* @var \yii\base\View|array view instance or its array configuration. * @var View|array view instance or its array configuration.
*/ */
private $_view = []; private $_view = [];
/** /**