From 7683a48de34a5946d3b5f967f6f0b9420cd05fd1 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 21 Nov 2022 19:18:14 +0100 Subject: [PATCH] Revert --- src/Psalm/Type/Atomic/TKeyedArray.php | 2 +- tests/TypeReconciliation/ConditionalTest.php | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Psalm/Type/Atomic/TKeyedArray.php b/src/Psalm/Type/Atomic/TKeyedArray.php index bb4869476..a7e383f18 100644 --- a/src/Psalm/Type/Atomic/TKeyedArray.php +++ b/src/Psalm/Type/Atomic/TKeyedArray.php @@ -322,7 +322,7 @@ class TKeyedArray extends Atomic $value_type = $value_type->setPossiblyUndefined(false); - if ($has_defined_keys) { + if ($has_defined_keys || $this->fallback_params !== null) { $array_type = new TNonEmptyArray([$key_type, $value_type]); } else { $array_type = new TArray([$key_type, $value_type]); diff --git a/tests/TypeReconciliation/ConditionalTest.php b/tests/TypeReconciliation/ConditionalTest.php index 1c5d9bdf2..5d33c49b4 100644 --- a/tests/TypeReconciliation/ConditionalTest.php +++ b/tests/TypeReconciliation/ConditionalTest.php @@ -1586,11 +1586,7 @@ class ConditionalTest extends TestCase echo $a; }' ], - // It is technically non-empty, but creating - // array{a: int}|array{b: int} will produce: - // array{a?: int, b?: int}, which is technically correct. - // Unmark as skipped when (if) support for unions of shapes is added. - 'SKIPPED-nonEmptyArrayAfterIsset' => [ + 'nonEmptyArrayAfterIsset' => [ 'code' => ' $arr