1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

makes array_combine return non-empty-array for most cases (#5393)

* makes array_combine return non-empty-array for most cases

* Add back newline

Co-authored-by: Matthew Brown <github@muglug.com>
This commit is contained in:
orklah 2021-03-15 02:18:19 +01:00 committed by GitHub
parent f1a840727d
commit dd4d970a37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -66,7 +66,7 @@ function array_intersect_assoc(array $arr, array $arr2, array ...$arr3)
* @param array<mixed, TKey> $arr
* @param array<mixed, TValue> $arr2
*
* @return array<TKey, TValue>|false
* @return ($arr is non-empty-array ? non-empty-array<TKey, TValue>|false : array<empty, empty>|false)
* @psalm-ignore-falsable-return
* @psalm-pure
*/

View File

@ -157,14 +157,14 @@ class ArrayFunctionCallTest extends TestCase
'<?php
$c = array_combine(["a", "b", "c"], [1, 2, 3]);',
'assertions' => [
'$c' => 'array<string, int>|false',
'$c' => 'false|non-empty-array<string, int>',
],
],
'arrayCombineFalse' => [
'<?php
$c = array_combine(["a", "b"], [1, 2, 3]);',
'assertions' => [
'$c' => 'array<string, int>|false',
'$c' => 'false|non-empty-array<string, int>',
],
],
'arrayMergeIntArrays' => [