1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00
This commit is contained in:
Guuzen 2019-10-06 22:28:41 +03:00 committed by Matthew Brown
parent 064d4886c3
commit 50df2868f2
2 changed files with 28 additions and 12 deletions

View File

@ -45,13 +45,12 @@ function array_unique(array $arr, int $sort_flags = 0)
* *
* @param array<TKey, TValue> $arr * @param array<TKey, TValue> $arr
* @param array $arr2 * @param array $arr2
* @param array|null $arr3 * @param array ...$arr3
* @param array|null $arr4
* *
* @return array<TKey, TValue> * @return array<TKey, TValue>
* @psalm-pure * @psalm-pure
*/ */
function array_intersect(array $arr, array $arr2, array $arr3 = null, array $arr4 = null) function array_intersect(array $arr, array $arr2, array ...$arr3)
{ {
} }
@ -61,13 +60,12 @@ function array_intersect(array $arr, array $arr2, array $arr3 = null, array $arr
* *
* @param array<TKey, TValue> $arr * @param array<TKey, TValue> $arr
* @param array $arr2 * @param array $arr2
* @param array|null $arr3 * @param array ...$arr3
* @param array|null $arr4
* *
* @return array<TKey, TValue> * @return array<TKey, TValue>
* @psalm-pure * @psalm-pure
*/ */
function array_intersect_key(array $arr, array $arr2, array $arr3 = null, array $arr4 = null) function array_intersect_key(array $arr, array $arr2, array ...$arr3)
{ {
} }
@ -92,13 +90,12 @@ function array_combine(array $arr, array $arr2)
* *
* @param array<TKey, TValue> $arr * @param array<TKey, TValue> $arr
* @param array $arr2 * @param array $arr2
* @param array|null $arr3 * @param array ...$arr3
* @param array|null $arr4
* *
* @return array<TKey, TValue> * @return array<TKey, TValue>
* @psalm-pure * @psalm-pure
*/ */
function array_diff(array $arr, array $arr2, array $arr3 = null, array $arr4 = null) function array_diff(array $arr, array $arr2, array ...$arr3)
{ {
} }
@ -108,13 +105,12 @@ function array_diff(array $arr, array $arr2, array $arr3 = null, array $arr4 = n
* *
* @param array<TKey, TValue> $arr * @param array<TKey, TValue> $arr
* @param array $arr2 * @param array $arr2
* @param array|null $arr3 * @param array ...$arr3
* @param array|null $arr4
* *
* @return array<TKey, TValue> * @return array<TKey, TValue>
* @psalm-pure * @psalm-pure
*/ */
function array_diff_key(array $arr, array $arr2, array $arr3 = null, array $arr4 = null) function array_diff_key(array $arr, array $arr2, array ...$arr3)
{ {
} }

View File

@ -266,6 +266,16 @@ class FunctionCallTest extends TestCase
'$d' => 'array<string, int>', '$d' => 'array<string, int>',
], ],
], ],
'arrayDiffIsVariadic' => [
'<?php
array_diff([], [], [], [], []);',
'assertions' => [],
],
'arrayDiffKeyIsVariadic' => [
'<?php
array_diff_key([], [], [], [], []);',
'assertions' => [],
],
'arrayPopMixed' => [ 'arrayPopMixed' => [
'<?php '<?php
/** @var mixed */ /** @var mixed */
@ -1032,6 +1042,16 @@ class FunctionCallTest extends TestCase
'$bar' => 'array<int, int>', '$bar' => 'array<int, int>',
], ],
], ],
'arrayIntersectIsVariadic' => [
'<?php
array_intersect([], [], [], [], []);',
'assertions' => [],
],
'arrayIntersectKeyIsVariadic' => [
'<?php
array_intersect_key([], [], [], [], []);',
'assertions' => [],
],
'arrayReduce' => [ 'arrayReduce' => [
'<?php '<?php
$arr = [2, 3, 4, 5]; $arr = [2, 3, 4, 5];