Skip to content

Commit ffa0dda

Browse files
authored
Fix #20658: Add missing generics in yii\console, yii\captcha, yii\caching and yii\behaviors namespaces
1 parent 2ee2da1 commit ffa0dda

16 files changed

+78
-25
lines changed

framework/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Yii Framework 2 Change Log
7777
- Enh #20650: Add PHPStan/Psalm annotations for `yii\di\Container` (mspirkov)
7878
- Bug #20654: Add missing generics in `yii\db` namespace. Fix PHPDoc annotations in `yii\db\ArrayExpression` (mspirkov)
7979
- Bug #20651: Add missing generics in `yii\filters` namespace (mspirkov)
80+
- Bug #20658: Add missing generics in `yii\console`, `yii\captcha`, `yii\caching` and `yii\behaviors` namespaces (mspirkov)
8081
- Bug #20659: Fix `PHP` `8.5` `null` array offset deprecation warnings in `MariaDB` driver (terabytesoftw)
8182

8283

framework/base/Behavior.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
* @since 2.0
2222
*
2323
* @template T of Component
24-
*
25-
* @phpstan-property T|null $owner
26-
* @psalm-property T|null $owner
2724
*/
2825
class Behavior extends BaseObject
2926
{

framework/behaviors/AttributeBehavior.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use yii\base\Behavior;
1212
use yii\base\Event;
1313
use yii\db\ActiveRecord;
14+
use yii\db\BaseActiveRecord;
1415

1516
/**
1617
* AttributeBehavior automatically assigns a specified value to one or multiple attributes of an ActiveRecord
@@ -47,6 +48,9 @@
4748
* @author Luciano Baraglia <luciano.baraglia@gmail.com>
4849
* @author Qiang Xue <qiang.xue@gmail.com>
4950
* @since 2.0
51+
*
52+
* @template T of BaseActiveRecord
53+
* @extends Behavior<T>
5054
*/
5155
class AttributeBehavior extends Behavior
5256
{

framework/behaviors/AttributeTypecastBehavior.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@
108108
*
109109
* @author Paul Klimov <klimov.paul@gmail.com>
110110
* @since 2.0.10
111+
*
112+
* @template T of Model|BaseActiveRecord
113+
* @extends Behavior<T>
111114
*/
112115
class AttributeTypecastBehavior extends Behavior
113116
{
@@ -117,7 +120,10 @@ class AttributeTypecastBehavior extends Behavior
117120
public const TYPE_STRING = 'string';
118121

119122
/**
120-
* @var Model|BaseActiveRecord the owner of this behavior.
123+
* @var Model|BaseActiveRecord|null the owner of this behavior.
124+
*
125+
* @phpstan-var T|null
126+
* @psalm-var T|null
121127
*/
122128
public $owner;
123129
/**

framework/behaviors/AttributesBehavior.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use yii\base\Behavior;
1212
use yii\base\Event;
1313
use yii\db\ActiveRecord;
14+
use yii\db\BaseActiveRecord;
1415

1516
/**
1617
* AttributesBehavior automatically assigns values specified to one or multiple attributes of an ActiveRecord
@@ -60,6 +61,9 @@
6061
* @author Qiang Xue <qiang.xue@gmail.com>
6162
* @author Bogdan Stepanenko <bscheshirwork@gmail.com>
6263
* @since 2.0.13
64+
*
65+
* @template T of BaseActiveRecord
66+
* @extends Behavior<T>
6367
*/
6468
class AttributesBehavior extends Behavior
6569
{

framework/behaviors/BlameableBehavior.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
* @author Qiang Xue <qiang.xue@gmail.com>
5454
* @author Alexander Kochetov <creocoder@gmail.com>
5555
* @since 2.0
56+
*
57+
* @template T of BaseActiveRecord
58+
* @extends AttributeBehavior<T>
5659
*/
5760
class BlameableBehavior extends AttributeBehavior
5861
{

framework/behaviors/CacheableWidgetBehavior.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
*
4444
* @author Nikolay Oleynikov <oleynikovny@mail.ru>
4545
* @since 2.0.14
46+
*
47+
* @template T of Widget
48+
* @extends Behavior<Widget>
4649
*/
4750
class CacheableWidgetBehavior extends Behavior
4851
{

framework/behaviors/OptimisticLockBehavior.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@
6161
* @author Salem Ouerdani <tunecino@gmail.com>
6262
* @since 2.0.16
6363
* @see \yii\db\BaseActiveRecord::optimisticLock() for details on how to enable optimistic lock.
64+
*
65+
* @template T of BaseActiveRecord
66+
* @extends AttributeBehavior<T>
6467
*/
6568
class OptimisticLockBehavior extends AttributeBehavior
6669
{

framework/behaviors/SluggableBehavior.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
* @author Alexander Kochetov <creocoder@gmail.com>
6161
* @author Paul Klimov <klimov.paul@gmail.com>
6262
* @since 2.0
63+
*
64+
* @template T of BaseActiveRecord
65+
* @extends AttributeBehavior<T>
6366
*/
6467
class SluggableBehavior extends AttributeBehavior
6568
{

framework/behaviors/TimestampBehavior.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868
* @author Qiang Xue <qiang.xue@gmail.com>
6969
* @author Alexander Kochetov <creocoder@gmail.com>
7070
* @since 2.0
71+
*
72+
* @template T of BaseActiveRecord
73+
* @extends AttributeBehavior<T>
7174
*/
7275
class TimestampBehavior extends AttributeBehavior
7376
{

0 commit comments

Comments
 (0)