mirror of
https://github.com/yiisoft/yii2.git
synced 2025-12-12 09:20:57 +08:00
Fix #20645: Add missing generics in yii\helpers and yii\test namespaces. Fix PHPDoc annotations in ArrayAccessTrait
This commit is contained in:
@@ -71,6 +71,7 @@ Yii Framework 2 Change Log
|
||||
- Bug #20636: Fix `@param` annotations for `$message` in logging methods (mspirkov)
|
||||
- Bug #20637: Fix PHPDoc annotations in `ActiveRelationTrait`. Add PHPStan/Psalm annotations for `$modelClass` in `ActiveQuery`, `ActiveQueryTrait` and `ActiveRelationTrait` (mspirkov)
|
||||
- Bug #20639: Add missing generics in `yii\web` namespace (mspirkov)
|
||||
- Bug #20645: Add missing generics in `yii\helpers` and `yii\test` namespaces. Fix PHPDoc annotations in `ArrayAccessTrait` (mspirkov)
|
||||
- Bug #20640: Fix `@param` annotation for `$block` in `yii\console\Markdown::renderParagraph()` (mspirkov)
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ namespace yii\base;
|
||||
*
|
||||
* @author Qiang Xue <qiang.xue@gmail.com>
|
||||
* @since 2.0
|
||||
*
|
||||
* @phpstan-property array<array-key, mixed> $data
|
||||
* @psalm-property array<array-key, mixed> $data
|
||||
*/
|
||||
trait ArrayAccessTrait
|
||||
{
|
||||
@@ -45,7 +48,7 @@ trait ArrayAccessTrait
|
||||
|
||||
/**
|
||||
* This method is required by the interface [[\ArrayAccess]].
|
||||
* @param mixed $offset the offset to check on
|
||||
* @param int|string $offset the offset to check on
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
@@ -56,7 +59,7 @@ trait ArrayAccessTrait
|
||||
|
||||
/**
|
||||
* This method is required by the interface [[\ArrayAccess]].
|
||||
* @param int $offset the offset to retrieve element.
|
||||
* @param int|string $offset the offset to retrieve element.
|
||||
* @return mixed the element at the offset, null if no element is found at the offset
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
@@ -67,7 +70,7 @@ trait ArrayAccessTrait
|
||||
|
||||
/**
|
||||
* This method is required by the interface [[\ArrayAccess]].
|
||||
* @param int $offset the offset to set element
|
||||
* @param int|string $offset the offset to set element
|
||||
* @param mixed $item the element value
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
@@ -78,7 +81,7 @@ trait ArrayAccessTrait
|
||||
|
||||
/**
|
||||
* This method is required by the interface [[\ArrayAccess]].
|
||||
* @param mixed $offset the offset to unset element
|
||||
* @param int|string $offset the offset to unset element
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
|
||||
@@ -628,6 +628,9 @@ class BaseArrayHelper
|
||||
* @param array|ArrayAccess $array the array with keys to check
|
||||
* @param bool $caseSensitive whether the key comparison should be case-sensitive
|
||||
* @return bool whether the array contains the specified key
|
||||
*
|
||||
* @phpstan-param array<array-key, mixed>|ArrayAccess<array-key, mixed> $array
|
||||
* @psalm-param array<array-key, mixed>|ArrayAccess<array-key, mixed> $array
|
||||
*/
|
||||
public static function keyExists($key, $array, $caseSensitive = true)
|
||||
{
|
||||
|
||||
@@ -17,6 +17,9 @@ use yii\base\InvalidConfigException;
|
||||
*
|
||||
* @author Mark Jebri <mark.github@yandex.ru>
|
||||
* @since 2.0
|
||||
*
|
||||
* @implements \IteratorAggregate<string, array<string, mixed>>
|
||||
* @implements \ArrayAccess<string, array<string, mixed>|null>
|
||||
*/
|
||||
class ArrayFixture extends Fixture implements \IteratorAggregate, \ArrayAccess, \Countable
|
||||
{
|
||||
@@ -25,6 +28,9 @@ class ArrayFixture extends Fixture implements \IteratorAggregate, \ArrayAccess,
|
||||
|
||||
/**
|
||||
* @var array the data rows. Each array element represents one row of data (column name => column value).
|
||||
*
|
||||
* @phpstan-var array<string, array<string, mixed>>
|
||||
* @psalm-var array<string, array<string, mixed>>
|
||||
*/
|
||||
public $data = [];
|
||||
|
||||
@@ -48,6 +54,9 @@ class ArrayFixture extends Fixture implements \IteratorAggregate, \ArrayAccess,
|
||||
*
|
||||
* @return array the data to be put into the database
|
||||
* @throws InvalidConfigException if the specified data file does not exist.
|
||||
*
|
||||
* @phpstan-return array<string, array<string, mixed>>
|
||||
* @psalm-return array<string, array<string, mixed>>
|
||||
*/
|
||||
protected function getData()
|
||||
{
|
||||
|
||||
@@ -17,6 +17,9 @@ use yii\base\InvalidConfigException;
|
||||
*
|
||||
* @author Qiang Xue <qiang.xue@gmail.com>
|
||||
* @since 2.0
|
||||
*
|
||||
* @implements \IteratorAggregate<string, array<string, mixed>>
|
||||
* @implements \ArrayAccess<string, array<string, mixed>|null>
|
||||
*/
|
||||
abstract class BaseActiveFixture extends DbFixture implements \IteratorAggregate, \ArrayAccess, \Countable
|
||||
{
|
||||
@@ -29,6 +32,9 @@ abstract class BaseActiveFixture extends DbFixture implements \IteratorAggregate
|
||||
public $modelClass;
|
||||
/**
|
||||
* @var array the data rows. Each array element represents one row of data (column name => column value).
|
||||
*
|
||||
* @phpstan-var array<string, array<string, mixed>>
|
||||
* @psalm-var array<string, array<string, mixed>>
|
||||
*/
|
||||
public $data = [];
|
||||
|
||||
@@ -85,6 +91,9 @@ abstract class BaseActiveFixture extends DbFixture implements \IteratorAggregate
|
||||
* @return array the data to be put into the database
|
||||
* @throws InvalidConfigException if the specified data file does not exist.
|
||||
* @see loadData()
|
||||
*
|
||||
* @phpstan-return array<string, array<string, mixed>>
|
||||
* @psalm-return array<string, array<string, mixed>>
|
||||
*/
|
||||
protected function getData()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user