diff --git a/build/controllers/PhpDocController.php b/build/controllers/PhpDocController.php index aa8cdfee98..f19fcd16f2 100644 --- a/build/controllers/PhpDocController.php +++ b/build/controllers/PhpDocController.php @@ -964,6 +964,8 @@ class PhpDocController extends ConsoleController * @param string $className * @param \ReflectionClass $ref * @return bool + * + * @phpstan-param \ReflectionClass $ref */ protected function isBaseObject($className, \ReflectionClass $ref) { diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index b4b56408b3..7639b6f8c6 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -80,6 +80,7 @@ Yii Framework 2 Change Log - Bug #20659: Fix PHP `8.5` `null` array offset deprecation warnings in `MariaDB` driver (terabytesoftw) - Bug #20665: Fix PHP `8.5` `null` array offset deprecation warnings in `yii\build\controllers\ReleaseController` class (terabytesoftw) - Bug #20658: Add missing generics in `yii\console`, `yii\captcha`, `yii\caching` and `yii\behaviors` namespaces (mspirkov) +- Bug #20666: Add missing generics in `yii\base`, `yii\console`, `yii\filters` and `yii\web` namespaces (mspirkov) 2.0.53 June 27, 2025 diff --git a/framework/base/Action.php b/framework/base/Action.php index 291f84d6a4..ea3e25544b 100644 --- a/framework/base/Action.php +++ b/framework/base/Action.php @@ -36,9 +36,6 @@ use Yii; * @since 2.0 * * @template T of Controller - * - * @phpstan-property T $controller - * @psalm-property T $controller */ class Action extends Component { diff --git a/framework/base/ActionEvent.php b/framework/base/ActionEvent.php index 4893664faa..9c5b97e587 100644 --- a/framework/base/ActionEvent.php +++ b/framework/base/ActionEvent.php @@ -14,11 +14,16 @@ namespace yii\base; * * @author Qiang Xue * @since 2.0 + * + * @template T of Action */ class ActionEvent extends Event { /** * @var Action the action currently being executed + * + * @phpstan-var T + * @psalm-var T */ public $action; /** @@ -38,6 +43,9 @@ class ActionEvent extends Event * @param Action $action the action associated with this action event. * @param array $config name-value pairs that will be used to initialize the object properties * + * @phpstan-param T $action + * @psalm-param T $action + * * @phpstan-param array $config * @psalm-param array $config */ diff --git a/framework/base/ActionFilter.php b/framework/base/ActionFilter.php index b95a3f56b7..13b9ccae67 100644 --- a/framework/base/ActionFilter.php +++ b/framework/base/ActionFilter.php @@ -21,6 +21,9 @@ use yii\helpers\StringHelper; * * @author Qiang Xue * @since 2.0 + * + * @template T of Component + * @extends Behavior */ class ActionFilter extends Behavior { @@ -67,6 +70,9 @@ class ActionFilter extends Behavior /** * @param ActionEvent $event + * + * @phpstan-param ActionEvent> $event + * @psalm-param ActionEvent> $event */ public function beforeFilter($event) { @@ -86,6 +92,9 @@ class ActionFilter extends Behavior /** * @param ActionEvent $event + * + * @phpstan-param ActionEvent> $event + * @psalm-param ActionEvent> $event */ public function afterFilter($event) { @@ -113,6 +122,9 @@ class ActionFilter extends Behavior * @param Action $action the action just executed. * @param mixed $result the action execution result * @return mixed the processed action result. + * + * @phpstan-param Action $action + * @psalm-param Action $action */ public function afterAction($action, $result) { @@ -124,6 +136,9 @@ class ActionFilter extends Behavior * @param Action $action * @return string * @since 2.0.7 + * + * @phpstan-param Action $action + * @psalm-param Action $action */ protected function getActionId($action) { @@ -144,6 +159,9 @@ class ActionFilter extends Behavior * Returns a value indicating whether the filter is active for the given action. * @param Action $action the action being filtered * @return bool whether the filter is active for the given action. + * + * @phpstan-param Action $action + * @psalm-param Action $action */ protected function isActive($action) { diff --git a/framework/base/Application.php b/framework/base/Application.php index 7d659b735c..a1ecc3a76d 100644 --- a/framework/base/Application.php +++ b/framework/base/Application.php @@ -127,6 +127,9 @@ abstract class Application extends Module public $requestedRoute; /** * @var Action|null the requested Action. If null, it means the request cannot be resolved into an action. + * + * @phpstan-var Action|null + * @psalm-var Action|null */ public $requestedAction; /** diff --git a/framework/base/ArrayAccessTrait.php b/framework/base/ArrayAccessTrait.php index 6d16bf613a..f5aa38d258 100644 --- a/framework/base/ArrayAccessTrait.php +++ b/framework/base/ArrayAccessTrait.php @@ -28,6 +28,9 @@ trait ArrayAccessTrait * This method is required by the SPL interface [[\IteratorAggregate]]. * It will be implicitly called when you use `foreach` to traverse the collection. * @return \ArrayIterator an iterator for traversing the cookies in the collection. + * + * @phpstan-return \ArrayIterator + * @psalm-return \ArrayIterator */ #[\ReturnTypeWillChange] public function getIterator() diff --git a/framework/base/Behavior.php b/framework/base/Behavior.php index cb663517e1..6eae28a456 100644 --- a/framework/base/Behavior.php +++ b/framework/base/Behavior.php @@ -77,6 +77,9 @@ class Behavior extends BaseObject * and attach event handlers as declared in [[events]]. * Make sure you call the parent implementation if you override this method. * @param Component $owner the component that this behavior is to be attached to. + * + * @phpstan-param T $owner + * @psalm-param T $owner */ public function attach($owner) { diff --git a/framework/base/Component.php b/framework/base/Component.php index 44c8664540..68b69b1955 100644 --- a/framework/base/Component.php +++ b/framework/base/Component.php @@ -97,6 +97,9 @@ use yii\helpers\StringHelper; * * @author Qiang Xue * @since 2.0 + * + * @phpstan-property-read Behavior<$this>[] $behaviors + * @psalm-property-read Behavior<$this>[] $behaviors */ class Component extends BaseObject { @@ -111,6 +114,8 @@ class Component extends BaseObject private $_eventWildcards = []; /** * @var Behavior[]|null the attached behaviors (behavior name => behavior). This is `null` when not initialized. + * + * @phpstan-var Behavior<$this>[]|null */ private $_behaviors; @@ -661,6 +666,9 @@ class Component extends BaseObject * Returns the named behavior object. * @param string $name the behavior name * @return Behavior|null the behavior object, or null if the behavior does not exist + * + * @phpstan-return Behavior<$this>|null + * @psalm-return Behavior<$this>|null */ public function getBehavior($name) { @@ -671,6 +679,9 @@ class Component extends BaseObject /** * Returns all behaviors attached to this component. * @return Behavior[] list of behaviors attached to this component + * + * @phpstan-return Behavior<$this>[] + * @psalm-return Behavior<$this>[] */ public function getBehaviors() { @@ -692,6 +703,12 @@ class Component extends BaseObject * * @return Behavior the behavior object * @see detachBehavior() + * + * @phpstan-param string|array|Behavior<$this> $behavior + * @psalm-param string|array|Behavior<$this> $behavior + * + * @phpstan-return Behavior<$this> + * @psalm-return Behavior<$this> */ public function attachBehavior($name, $behavior) { @@ -719,6 +736,9 @@ class Component extends BaseObject * The behavior's [[Behavior::detach()]] method will be invoked. * @param string $name the behavior's name. * @return Behavior|null the detached behavior. Null if the behavior does not exist. + * + * @phpstan-return Behavior<$this>|null + * @psalm-return Behavior<$this>|null */ public function detachBehavior($name) { @@ -764,6 +784,10 @@ class Component extends BaseObject * will be detached first. * @param string|array|Behavior $behavior the behavior to be attached * @return Behavior the attached behavior. + * + * @phpstan-param string|array|Behavior<$this> $behavior + * + * @phpstan-return Behavior<$this> */ private function attachBehaviorInternal($name, $behavior) { diff --git a/framework/base/Controller.php b/framework/base/Controller.php index e9eb5fcdf2..dddb5d3b68 100644 --- a/framework/base/Controller.php +++ b/framework/base/Controller.php @@ -60,6 +60,9 @@ class Controller extends Component implements ViewContextInterface /** * @var Action|null the action that is currently being executed. This property will be set * by [[run()]] when it is called by [[Application]] to run an action. + * + * @phpstan-var Action<$this>|null + * @psalm-var Action<$this>|null */ public $action; /** @@ -234,8 +237,8 @@ class Controller extends Component implements ViewContextInterface * @param array $params the parameters to be bound to the action. * @return array the valid parameters that the action can run with. * - * @phpstan-param Action $action - * @psalm-param Action $action + * @phpstan-param Action<$this> $action + * @psalm-param Action<$this> $action * * @phpstan-param array $params * @psalm-param array $params @@ -257,6 +260,9 @@ class Controller extends Component implements ViewContextInterface * method will be created and returned. * @param string $id the action ID. * @return Action|null the newly created action instance. Null if the ID doesn't resolve into any action. + * + * @phpstan-return Action<$this>|null + * @psalm-return Action<$this>|null */ public function createAction($id) { @@ -312,8 +318,8 @@ class Controller extends Component implements ViewContextInterface * @param Action $action the action to be executed. * @return bool whether the action should continue to run. * - * @phpstan-param Action $action - * @psalm-param Action $action + * @phpstan-param Action<$this> $action + * @psalm-param Action<$this> $action */ public function beforeAction($action) { @@ -343,8 +349,8 @@ class Controller extends Component implements ViewContextInterface * @param mixed $result the action return result. * @return mixed the processed action result. * - * @phpstan-param Action $action - * @psalm-param Action $action + * @phpstan-param Action<$this> $action + * @psalm-param Action<$this> $action */ public function afterAction($action, $result) { diff --git a/framework/base/InlineAction.php b/framework/base/InlineAction.php index 13f57ad724..b4ad6c0d91 100644 --- a/framework/base/InlineAction.php +++ b/framework/base/InlineAction.php @@ -37,6 +37,9 @@ class InlineAction extends Action * @param string $actionMethod the controller method that this inline action is associated with * @param array $config name-value pairs that will be used to initialize the object properties * + * @phpstan-param T $controller + * @psalm-param T $controller + * * @phpstan-param array $config * @psalm-param array $config */ diff --git a/framework/base/Model.php b/framework/base/Model.php index 778421b909..d55fd5c223 100644 --- a/framework/base/Model.php +++ b/framework/base/Model.php @@ -53,14 +53,14 @@ use yii\validators\Validator; * ``` * * Empty array if no errors. - * @property-read \yii\validators\Validator[] $activeValidators The validators applicable to the current + * @property-read Validator[] $activeValidators The validators applicable to the current * [[scenario]]. * @property array $attributes Attribute values (name => value). * @property-read array $firstErrors The first errors. The array keys are the attribute names, and the array * values are the corresponding error messages. An empty array will be returned if there is no error. * @property-read ArrayIterator $iterator An iterator for traversing the items in the list. * @property string $scenario The scenario that this model is in. Defaults to [[SCENARIO_DEFAULT]]. - * @property-read ArrayObject|\yii\validators\Validator[] $validators All the validators declared in the + * @property-read ArrayObject|Validator[] $validators All the validators declared in the * model. * * @author Qiang Xue @@ -74,6 +74,15 @@ use yii\validators\Validator; * * @phpstan-property-read array $firstErrors * @psalm-property-read array $firstErrors + * + * @phpstan-property-read ArrayIterator $iterator + * @psalm-property-read ArrayIterator $iterator + * + * @phpstan-property-read ArrayObject|Validator[] $validators + * @psalm-property-read ArrayObject|Validator[] $validators + * + * @implements IteratorAggregate + * @implements ArrayAccess */ class Model extends Component implements StaticInstanceInterface, IteratorAggregate, ArrayAccess, Arrayable { @@ -100,6 +109,8 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg private $_errors; /** * @var ArrayObject|null list of validators + * + * @phpstan-var ArrayObject|null */ private $_validators; /** @@ -447,7 +458,10 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg * $model->validators[] = $newValidator; * ``` * - * @return ArrayObject|\yii\validators\Validator[] all the validators declared in the model. + * @return ArrayObject|Validator[] all the validators declared in the model. + * + * @phpstan-return ArrayObject|Validator[] + * @psalm-return ArrayObject|Validator[] */ public function getValidators() { @@ -462,7 +476,7 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg * Returns the validators applicable to the current [[scenario]]. * @param string|null $attribute the name of the attribute whose applicable validators should be returned. * If this is null, the validators for ALL attributes in the model will be returned. - * @return \yii\validators\Validator[] the validators applicable to the current [[scenario]]. + * @return Validator[] the validators applicable to the current [[scenario]]. */ public function getActiveValidators($attribute = null) { @@ -492,6 +506,9 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg * Unlike [[getValidators()]], each time this method is called, a new list of validators will be returned. * @return ArrayObject validators * @throws InvalidConfigException if any validation rule configuration is invalid + * + * @phpstan-return ArrayObject + * @psalm-return ArrayObject */ public function createValidators() { @@ -1045,6 +1062,9 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg * Returns an iterator for traversing the attributes in the model. * This method is required by the interface [[\IteratorAggregate]]. * @return ArrayIterator an iterator for traversing the items in the list. + * + * @phpstan-return ArrayIterator + * @psalm-return ArrayIterator */ #[\ReturnTypeWillChange] public function getIterator() diff --git a/framework/base/Module.php b/framework/base/Module.php index 41939f95cb..e38d822343 100644 --- a/framework/base/Module.php +++ b/framework/base/Module.php @@ -717,6 +717,9 @@ class Module extends ServiceLocator * * @param Action $action the action to be executed. * @return bool whether the action should continue to be executed. + * + * @phpstan-param Action $action + * @psalm-param Action $action */ public function beforeAction($action) { @@ -745,6 +748,9 @@ class Module extends ServiceLocator * @param Action $action the action just executed. * @param mixed $result the action return result. * @return mixed the processed action result. + * + * @phpstan-param Action $action + * @psalm-param Action $action */ public function afterAction($action, $result) { diff --git a/framework/console/Controller.php b/framework/console/Controller.php index 19a27da626..f205e72e17 100644 --- a/framework/console/Controller.php +++ b/framework/console/Controller.php @@ -192,8 +192,8 @@ class Controller extends \yii\base\Controller * @return array the valid parameters that the action can run with. * @throws Exception if there are unknown options or missing arguments * - * @phpstan-param Action $action - * @psalm-param Action $action + * @phpstan-param Action<$this> $action + * @psalm-param Action<$this> $action * * @phpstan-param array $params * @psalm-param array $params @@ -546,8 +546,8 @@ class Controller extends \yii\base\Controller * @param Action $action action to get summary for * @return string a one-line short summary describing the specified action. * - * @phpstan-param Action $action - * @psalm-param Action $action + * @phpstan-param Action<$this> $action + * @psalm-param Action<$this> $action */ public function getActionHelpSummary($action) { @@ -563,8 +563,8 @@ class Controller extends \yii\base\Controller * @param Action $action action to get help for * @return string the detailed help information for the specified action. * - * @phpstan-param Action $action - * @psalm-param Action $action + * @phpstan-param Action<$this> $action + * @psalm-param Action<$this> $action */ public function getActionHelp($action) { @@ -588,8 +588,8 @@ class Controller extends \yii\base\Controller * @param Action $action the action instance * @return array the help information of the action arguments * - * @phpstan-param Action $action - * @psalm-param Action $action + * @phpstan-param Action<$this> $action + * @psalm-param Action<$this> $action */ public function getActionArgsHelp($action) { @@ -664,8 +664,8 @@ class Controller extends \yii\base\Controller * @param Action $action * @return array the help information of the action options * - * @phpstan-param Action $action - * @psalm-param Action $action + * @phpstan-param Action<$this> $action + * @psalm-param Action<$this> $action */ public function getActionOptionsHelp($action) { @@ -722,8 +722,8 @@ class Controller extends \yii\base\Controller * @param Action $action * @return \ReflectionFunctionAbstract * - * @phpstan-param Action $action - * @psalm-param Action $action + * @phpstan-param Action<$this> $action + * @psalm-param Action<$this> $action */ protected function getActionMethodReflection($action) { diff --git a/framework/console/controllers/BaseMigrateController.php b/framework/console/controllers/BaseMigrateController.php index 1304a45a8e..7eebad42fe 100644 --- a/framework/console/controllers/BaseMigrateController.php +++ b/framework/console/controllers/BaseMigrateController.php @@ -127,8 +127,8 @@ abstract class BaseMigrateController extends Controller * @throws InvalidConfigException if directory specified in migrationPath doesn't exist and action isn't "create". * @return bool whether the action should continue to be executed. * - * @phpstan-param Action $action - * @psalm-param Action $action + * @phpstan-param Action<$this> $action + * @psalm-param Action<$this> $action */ public function beforeAction($action) { diff --git a/framework/console/controllers/MigrateController.php b/framework/console/controllers/MigrateController.php index 56c09330db..e665d915b8 100644 --- a/framework/console/controllers/MigrateController.php +++ b/framework/console/controllers/MigrateController.php @@ -178,8 +178,8 @@ class MigrateController extends BaseMigrateController * @param Action $action the action to be executed. * @return bool whether the action should continue to be executed. * - * @phpstan-param Action $action - * @psalm-param Action $action + * @phpstan-param Action<$this> $action + * @psalm-param Action<$this> $action */ public function beforeAction($action) { diff --git a/framework/filters/AccessControl.php b/framework/filters/AccessControl.php index 87ab6fd76b..1dbf5ac1ce 100644 --- a/framework/filters/AccessControl.php +++ b/framework/filters/AccessControl.php @@ -9,6 +9,7 @@ namespace yii\filters; use Yii; use yii\base\ActionFilter; +use yii\base\Component; use yii\di\Instance; use yii\web\ForbiddenHttpException; use yii\web\IdentityInterface; @@ -53,6 +54,9 @@ use yii\web\User; * * @author Qiang Xue * @since 2.0 + * + * @template T of Component + * @extends ActionFilter */ class AccessControl extends ActionFilter { diff --git a/framework/filters/AjaxFilter.php b/framework/filters/AjaxFilter.php index 871d474f6f..34c4bec39b 100644 --- a/framework/filters/AjaxFilter.php +++ b/framework/filters/AjaxFilter.php @@ -9,6 +9,7 @@ namespace yii\filters; use Yii; use yii\base\ActionFilter; +use yii\base\Component; use yii\web\BadRequestHttpException; use yii\web\Request; @@ -29,6 +30,9 @@ use yii\web\Request; * * @author Dmitry Dorogin * @since 2.0.13 + * + * @template T of Component + * @extends ActionFilter */ class AjaxFilter extends ActionFilter { diff --git a/framework/filters/ContentNegotiator.php b/framework/filters/ContentNegotiator.php index d3ed14d62a..010c6e8b40 100644 --- a/framework/filters/ContentNegotiator.php +++ b/framework/filters/ContentNegotiator.php @@ -10,6 +10,7 @@ namespace yii\filters; use Yii; use yii\base\ActionFilter; use yii\base\BootstrapInterface; +use yii\base\Component; use yii\web\BadRequestHttpException; use yii\web\NotAcceptableHttpException; use yii\web\Request; @@ -82,6 +83,9 @@ use yii\web\Response; * * @author Qiang Xue * @since 2.0 + * + * @template T of Component + * @extends ActionFilter */ class ContentNegotiator extends ActionFilter implements BootstrapInterface { diff --git a/framework/filters/Cors.php b/framework/filters/Cors.php index be04142454..6ddf98b7f0 100644 --- a/framework/filters/Cors.php +++ b/framework/filters/Cors.php @@ -10,6 +10,7 @@ namespace yii\filters; use Yii; use yii\base\Action; use yii\base\ActionFilter; +use yii\base\Component; use yii\base\Controller; use yii\base\InvalidConfigException; use yii\web\Request; @@ -68,6 +69,9 @@ use yii\web\Response; * * @author Philippe Gaultier * @since 2.0 + * + * @template T of Component + * @extends ActionFilter */ class Cors extends ActionFilter { diff --git a/framework/filters/HostControl.php b/framework/filters/HostControl.php index 2a2e860b90..0f320b9f5d 100644 --- a/framework/filters/HostControl.php +++ b/framework/filters/HostControl.php @@ -10,6 +10,7 @@ namespace yii\filters; use Yii; use yii\base\Action; use yii\base\ActionFilter; +use yii\base\Component; use yii\base\Controller; use yii\helpers\StringHelper; use yii\web\NotFoundHttpException; @@ -65,6 +66,9 @@ use yii\web\NotFoundHttpException; * * @author Paul Klimov * @since 2.0.11 + * + * @template T of Component + * @extends ActionFilter */ class HostControl extends ActionFilter { diff --git a/framework/filters/HttpCache.php b/framework/filters/HttpCache.php index 82c9c4a810..bb2bcc2f7e 100644 --- a/framework/filters/HttpCache.php +++ b/framework/filters/HttpCache.php @@ -9,6 +9,7 @@ namespace yii\filters; use Yii; use yii\base\ActionFilter; +use yii\base\Component; /** * HttpCache implements client-side caching by utilizing the `Last-Modified` and `ETag` HTTP headers. @@ -41,6 +42,9 @@ use yii\base\ActionFilter; * @author Da:Sourcerer * @author Qiang Xue * @since 2.0 + * + * @template T of Component + * @extends ActionFilter */ class HttpCache extends ActionFilter { diff --git a/framework/filters/PageCache.php b/framework/filters/PageCache.php index 4d8188770d..e1d2b177ed 100644 --- a/framework/filters/PageCache.php +++ b/framework/filters/PageCache.php @@ -10,6 +10,7 @@ namespace yii\filters; use Closure; use Yii; use yii\base\ActionFilter; +use yii\base\Component; use yii\base\DynamicContentAwareInterface; use yii\base\DynamicContentAwareTrait; use yii\caching\CacheInterface; @@ -50,6 +51,9 @@ use yii\web\Response; * @author Qiang Xue * @author Sergey Makinen * @since 2.0 + * + * @template T of Component + * @extends ActionFilter */ class PageCache extends ActionFilter implements DynamicContentAwareInterface { diff --git a/framework/filters/RateLimiter.php b/framework/filters/RateLimiter.php index 491387f419..89774f0a3f 100644 --- a/framework/filters/RateLimiter.php +++ b/framework/filters/RateLimiter.php @@ -11,6 +11,7 @@ use Closure; use Yii; use yii\base\Action; use yii\base\ActionFilter; +use yii\base\Component; use yii\base\Controller; use yii\web\IdentityInterface; use yii\web\Request; @@ -40,6 +41,9 @@ use yii\web\TooManyRequestsHttpException; * * @author Qiang Xue * @since 2.0 + * + * @template T of Component + * @extends ActionFilter */ class RateLimiter extends ActionFilter { diff --git a/framework/filters/VerbFilter.php b/framework/filters/VerbFilter.php index 3fc61e5a5e..f97f3ec83d 100644 --- a/framework/filters/VerbFilter.php +++ b/framework/filters/VerbFilter.php @@ -8,6 +8,7 @@ namespace yii\filters; use Yii; +use yii\base\Action; use yii\base\ActionEvent; use yii\base\Behavior; use yii\web\Controller; @@ -89,6 +90,9 @@ class VerbFilter extends Behavior * @param ActionEvent $event * @return bool * @throws MethodNotAllowedHttpException when the request method is not allowed. + * + * @phpstan-param ActionEvent> $event + * @psalm-param ActionEvent> $event */ public function beforeAction($event) { diff --git a/framework/filters/auth/AuthMethod.php b/framework/filters/auth/AuthMethod.php index 25a01b67fa..e42756d6fc 100644 --- a/framework/filters/auth/AuthMethod.php +++ b/framework/filters/auth/AuthMethod.php @@ -10,6 +10,7 @@ namespace yii\filters\auth; use Yii; use yii\base\Action; use yii\base\ActionFilter; +use yii\base\Component; use yii\base\Controller; use yii\helpers\StringHelper; use yii\web\IdentityInterface; @@ -23,6 +24,9 @@ use yii\web\User; * * @author Qiang Xue * @since 2.0 + * + * @template T of Component + * @extends ActionFilter */ abstract class AuthMethod extends ActionFilter implements AuthInterface { diff --git a/framework/filters/auth/CompositeAuth.php b/framework/filters/auth/CompositeAuth.php index 76a4dfc517..376ecaaaf4 100644 --- a/framework/filters/auth/CompositeAuth.php +++ b/framework/filters/auth/CompositeAuth.php @@ -9,6 +9,7 @@ namespace yii\filters\auth; use Yii; use yii\base\ActionFilter; +use yii\base\Component; use yii\base\Controller; use yii\base\InvalidConfigException; @@ -37,6 +38,9 @@ use yii\base\InvalidConfigException; * * @author Qiang Xue * @since 2.0 + * + * @template T of Component + * @extends AuthMethod */ class CompositeAuth extends AuthMethod { diff --git a/framework/filters/auth/HttpBasicAuth.php b/framework/filters/auth/HttpBasicAuth.php index 0ddfa71dad..c53e1690fc 100644 --- a/framework/filters/auth/HttpBasicAuth.php +++ b/framework/filters/auth/HttpBasicAuth.php @@ -7,6 +7,8 @@ namespace yii\filters\auth; +use yii\base\Component; + /** * HttpBasicAuth is an action filter that supports the HTTP Basic authentication method. * @@ -56,6 +58,9 @@ namespace yii\filters\auth; * * @author Qiang Xue * @since 2.0 + * + * @template T of Component + * @extends AuthMethod */ class HttpBasicAuth extends AuthMethod { diff --git a/framework/filters/auth/HttpBearerAuth.php b/framework/filters/auth/HttpBearerAuth.php index f2de82597b..2db211b862 100644 --- a/framework/filters/auth/HttpBearerAuth.php +++ b/framework/filters/auth/HttpBearerAuth.php @@ -7,6 +7,8 @@ namespace yii\filters\auth; +use yii\base\Component; + /** * HttpBearerAuth is an action filter that supports the authentication method based on HTTP Bearer token. * @@ -25,6 +27,9 @@ namespace yii\filters\auth; * * @author Qiang Xue * @since 2.0 + * + * @template T of Component + * @extends HttpHeaderAuth */ class HttpBearerAuth extends HttpHeaderAuth { diff --git a/framework/filters/auth/HttpHeaderAuth.php b/framework/filters/auth/HttpHeaderAuth.php index 01b1c272bb..b859d32ebb 100644 --- a/framework/filters/auth/HttpHeaderAuth.php +++ b/framework/filters/auth/HttpHeaderAuth.php @@ -7,6 +7,8 @@ namespace yii\filters\auth; +use yii\base\Component; + /** * HttpHeaderAuth is an action filter that supports HTTP authentication through HTTP Headers. * @@ -30,6 +32,9 @@ namespace yii\filters\auth; * @author Qiang Xue * @author BenoƮt Boure * @since 2.0.14 + * + * @template T of Component + * @extends AuthMethod */ class HttpHeaderAuth extends AuthMethod { diff --git a/framework/filters/auth/QueryParamAuth.php b/framework/filters/auth/QueryParamAuth.php index e193893339..a0bffbc159 100644 --- a/framework/filters/auth/QueryParamAuth.php +++ b/framework/filters/auth/QueryParamAuth.php @@ -7,11 +7,16 @@ namespace yii\filters\auth; +use yii\base\Component; + /** * QueryParamAuth is an action filter that supports the authentication based on the access token passed through a query parameter. * * @author Qiang Xue * @since 2.0 + * + * @template T of Component + * @extends AuthMethod */ class QueryParamAuth extends AuthMethod { diff --git a/framework/web/Controller.php b/framework/web/Controller.php index f17e5c59b9..6b2983ef45 100644 --- a/framework/web/Controller.php +++ b/framework/web/Controller.php @@ -121,8 +121,8 @@ class Controller extends \yii\base\Controller * @return array the valid parameters that the action can run with. * @throws BadRequestHttpException if there are missing or invalid parameters. * - * @phpstan-param Action $action - * @psalm-param Action $action + * @phpstan-param Action<$this> $action + * @psalm-param Action<$this> $action * * @phpstan-param array $params * @psalm-param array $params