From 456a5cde16bba4209cb4d17e6e965642fabb542d Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 19 Dec 2023 10:57:16 +0100 Subject: [PATCH] Fixes --- src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php | 2 +- src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php | 2 +- src/Psalm/Type.php | 4 ++-- src/Psalm/Type/Reconciler.php | 6 +----- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index 35ab5488bb9..6f0c64de108 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -164,7 +164,7 @@ public function analyze( NodeDataProvider $type_provider, ?Context $global_context = null, bool $add_mutations = false, - array &$byref_vars = [] + array &$byref_vars = [], ): ?bool { $storage = $this->storage; diff --git a/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php b/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php index d479c926e48..c9ac356eb68 100644 --- a/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php @@ -57,7 +57,7 @@ public static function isContainedBy( && !$container_type_part->isNonEmpty() && !$container_type_part->isSealed() && $input_type_part->equals( - $container_type_part->getGenericArrayType($container_type_part->isNonEmpty()), + $container_type_part->getGenericArrayType(), false, ) ) { diff --git a/src/Psalm/Type.php b/src/Psalm/Type.php index 589e6bd0711..12f19b3d658 100644 --- a/src/Psalm/Type.php +++ b/src/Psalm/Type.php @@ -716,7 +716,7 @@ public static function intersectUnionTypes( ?Union $type_2, Codebase $codebase, bool $allow_interface_equality = false, - bool $allow_float_int_equality = true + bool $allow_float_int_equality = true, ): ?Union { if ($type_2 === null && $type_1 === null) { throw new UnexpectedValueException('At least one type must be provided to combine'); @@ -846,7 +846,7 @@ private static function intersectAtomicTypes( Codebase $codebase, bool &$intersection_performed, bool $allow_interface_equality = false, - bool $allow_float_int_equality = true + bool $allow_float_int_equality = true, ): ?Atomic { $intersection_atomic = null; $wider_type = null; diff --git a/src/Psalm/Type/Reconciler.php b/src/Psalm/Type/Reconciler.php index 1836641a169..1822bf75422 100644 --- a/src/Psalm/Type/Reconciler.php +++ b/src/Psalm/Type/Reconciler.php @@ -47,7 +47,6 @@ use Psalm\Type\Atomic\TFalse; use Psalm\Type\Atomic\TInt; use Psalm\Type\Atomic\TKeyedArray; -use Psalm\Type\Atomic\TList; use Psalm\Type\Atomic\TLiteralInt; use Psalm\Type\Atomic\TLiteralString; use Psalm\Type\Atomic\TMixed; @@ -1152,11 +1151,8 @@ private static function adjustTKeyedArrayType( ); foreach ($array_key_offsets as $array_key_offset) { - if (isset($existing_types[$base_key]) && $array_key_offset !== false) { + if (isset($existing_types[$base_key])) { foreach ($existing_types[$base_key]->getAtomicTypes() as $base_atomic_type) { - if ($base_atomic_type instanceof TList) { - $base_atomic_type = $base_atomic_type->getKeyedArray(); - } if ($base_atomic_type instanceof TKeyedArray || ($base_atomic_type instanceof TArray && !$base_atomic_type->isEmptyArray())