Skip to content

Commit 652143d

Browse files
Fix #20395: Add PHPStan/Psalm annotations for ActiveForm::validate and ArrayHelper::merge
1 parent af600c3 commit 652143d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

framework/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Yii Framework 2 Change Log
1919
- Bug #20373: Fixed the type of the first parameter `yii\base\Controller::bindInjectedParams()` (max-s-lab)
2020
- Enh #20374: Add PHPStan/Psalm annotations for `BaseYii`, `BaseObject`, `Component`, `Model`, `Module` and `yii\base\Controller` (max-s-lab)
2121
- Enh #20394: Add PHPStan/Psalm annotations for `Yii::getAlias` (max-s-lab)
22+
- Enh #20395: Add PHPStan/Psalm annotations for `ActiveForm::validate` (samuelrajan747)
23+
- Enh #20397: Add PHPStan/Psalm annotations for `ArrayHelper::merge` (samuelrajan747)
2224

2325

2426
2.0.52 February 13, 2025

framework/helpers/BaseArrayHelper.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,18 @@ public static function toArray($object, $properties = [], $recursive = true)
117117
* @param array $b array to be merged from. You can specify additional
118118
* arrays via third argument, fourth argument etc.
119119
* @return array the merged array (the original arrays are not changed.)
120+
* @phpstan-template TItemA
121+
* @phpstan-template TItemB
122+
* @psalm-template TItemA
123+
* @psalm-template TItemB
124+
* @phpstan-param array<TItemA> $a
125+
* @phpstan-param array<array<TItemB>> ...$b
126+
* @psalm-param array<TItemA> $a
127+
* @psalm-param array<array<TItemB>> ...$b
128+
* @phpstan-return array<TItemA|TItemB>
129+
* @psalm-return array<TItemA|TItemB>
120130
*/
121-
public static function merge($a, $b)
131+
public static function merge($a, ...$b)
122132
{
123133
$args = func_get_args();
124134
$res = array_shift($args);

0 commit comments

Comments
 (0)