diff --git a/src/Psalm/Internal/Type/Comparator/GenericTypeComparator.php b/src/Psalm/Internal/Type/Comparator/GenericTypeComparator.php index 30b0088e367..64028cdb42a 100644 --- a/src/Psalm/Internal/Type/Comparator/GenericTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/GenericTypeComparator.php @@ -177,7 +177,7 @@ public static function isContainedBy( && $atomic_comparison_result->replacement_atomic_type instanceof TGenericObject && $atomic_comparison_result_type_params ) { - /** @psalm-suppress InvalidArgument Psalm bug */ + /** @psalm-suppress ArgumentTypeCoercion Psalm bug */ $atomic_comparison_result->replacement_atomic_type = $atomic_comparison_result->replacement_atomic_type ->setTypeParams($atomic_comparison_result_type_params); diff --git a/src/Psalm/Internal/Type/TypeCombiner.php b/src/Psalm/Internal/Type/TypeCombiner.php index 4e42c2dbe22..79c5bf9d09e 100644 --- a/src/Psalm/Internal/Type/TypeCombiner.php +++ b/src/Psalm/Internal/Type/TypeCombiner.php @@ -476,7 +476,7 @@ private static function scrapeTypeProperties( } else { foreach ($combination->array_type_params as $i => $array_type_param) { $iterable_type_param = $combination->builtin_type_params['iterable'][$i]; - /** @psalm-suppress InvalidPropertyAssignmentValue */ + /** @psalm-suppress PropertyTypeCoercion */ $combination->builtin_type_params['iterable'][$i] = Type::combineUnionTypes( $iterable_type_param, $array_type_param @@ -497,7 +497,7 @@ private static function scrapeTypeProperties( } elseif (isset($combination->builtin_type_params['Traversable'])) { foreach ($combination->builtin_type_params['Traversable'] as $i => $array_type_param) { $iterable_type_param = $combination->builtin_type_params['iterable'][$i]; - /** @psalm-suppress InvalidPropertyAssignmentValue */ + /** @psalm-suppress PropertyTypeCoercion */ $combination->builtin_type_params['iterable'][$i] = Type::combineUnionTypes( $iterable_type_param, $array_type_param @@ -615,7 +615,7 @@ private static function scrapeTypeProperties( || ($type instanceof TArray && $type_key === 'iterable') ) { foreach ($type->type_params as $i => $type_param) { - /** @psalm-suppress InvalidPropertyAssignmentValue */ + /** @psalm-suppress PropertyTypeCoercion */ $combination->builtin_type_params[$type_key][$i] = Type::combineUnionTypes( $combination->builtin_type_params[$type_key][$i] ?? null, $type_param, @@ -629,7 +629,7 @@ private static function scrapeTypeProperties( if ($type instanceof TGenericObject) { foreach ($type->type_params as $i => $type_param) { - /** @psalm-suppress InvalidPropertyAssignmentValue */ + /** @psalm-suppress PropertyTypeCoercion */ $combination->object_type_params[$type_key][$i] = Type::combineUnionTypes( $combination->object_type_params[$type_key][$i] ?? null, $type_param, diff --git a/src/Psalm/IssueBuffer.php b/src/Psalm/IssueBuffer.php index 8d82fee3b68..369f6a7629d 100644 --- a/src/Psalm/IssueBuffer.php +++ b/src/Psalm/IssueBuffer.php @@ -647,7 +647,7 @@ public static function finish( // do nothing } - /** @psalm-suppress InvalidArgument due to Psalm bug */ + /** @psalm-suppress ArgumentTypeCoercion due to Psalm bug */ $event = new AfterAnalysisEvent( $codebase, $issues_data, diff --git a/src/Psalm/Type/Atomic/TKeyedArray.php b/src/Psalm/Type/Atomic/TKeyedArray.php index 02b8138816a..d861242ba0a 100644 --- a/src/Psalm/Type/Atomic/TKeyedArray.php +++ b/src/Psalm/Type/Atomic/TKeyedArray.php @@ -519,6 +519,7 @@ public function replaceTemplateTypesWithStandins( } $cloned = clone $this; $cloned->properties = $properties; + /** @psalm-suppress PropertyTypeCoercion */ $cloned->fallback_params = $fallback_params; return $cloned; } @@ -549,6 +550,7 @@ public function replaceTemplateTypesWithArgTypes( if ($properties !== $this->properties || $fallback_params !== $this->fallback_params) { $cloned = clone $this; $cloned->properties = $properties; + /** @psalm-suppress PropertyTypeCoercion */ $cloned->fallback_params = $fallback_params; return $cloned; } diff --git a/tests/ArgTest.php b/tests/ArgTest.php index a94ad33fe11..d803723e13a 100644 --- a/tests/ArgTest.php +++ b/tests/ArgTest.php @@ -630,7 +630,7 @@ function foo(int ...$values): array return $values; } ', - 'error_message' => 'InvalidReturnStatement', + 'error_message' => 'LessSpecificReturnStatement', ], 'preventUnpackingPossiblyIterable' => [ 'code' => ' 'InvalidReturnStatement', + 'error_message' => 'LessSpecificReturnStatement', ], 'simpleXmlArrayFetchResultCannotEqualString' => [ 'code' => ' 'InvalidReturnStatement', + 'error_message' => 'LessSpecificReturnStatement', ], // Skipped because the ref-type of array_pop was fixed (list->list) 'SKIPPED-assignToListWithAlteredForeachKeyVar' => [ diff --git a/tests/ArrayFunctionCallTest.php b/tests/ArrayFunctionCallTest.php index eeb90e6548e..784a91408aa 100644 --- a/tests/ArrayFunctionCallTest.php +++ b/tests/ArrayFunctionCallTest.php @@ -2528,7 +2528,7 @@ function foo($data): void { function ints(array $ints) : void {} $brr = array_filter([2,3,0,4,5]); ints($brr);', - 'error_message' => 'InvalidArgument', + 'error_message' => 'ArgumentTypeCoercion', ], 'usortOneParamInvalid' => [ 'code' => ' 1]; takesList($a);', - 'error_message' => 'InvalidArgument', + 'error_message' => 'ArgumentTypeCoercion', ], ]; }