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

Merge pull request #9903 from ygottschalk/fix/9827-union-empty-array-and-false

Fixes #9827
This commit is contained in:
orklah 2023-06-15 21:19:44 +02:00 committed by GitHub
commit eb64a471c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View File

@ -130,7 +130,9 @@ class TypeCombiner
if (count($combination->value_types) === 1
&& !count($combination->objectlike_entries)
&& (!$combination->array_type_params
|| $combination->array_type_params[1]->isNever()
|| ( $overwrite_empty_array
&& $combination->array_type_params[1]->isNever()
)
)
&& !$combination->builtin_type_params
&& !$combination->object_type_params

View File

@ -338,6 +338,28 @@ class TypeCombinationTest extends TestCase
'ArrayObject<int, string>',
],
],
'emptyArrayAndFalse' => [
'array<never, never>|false',
[
'array<never, never>',
'false',
],
],
'emptyArrayAndTrue' => [
'array<never, never>|true',
[
'array<never, never>',
'true',
],
],
'emptyArrayWithTrueAndFalse' => [
'array<never, never>|bool',
[
'array<never, never>',
'true',
'false',
],
],
'falseDestruction' => [
'bool',
[