From 8ee875086f356369cad7376fc0b295239becd227 Mon Sep 17 00:00:00 2001 From: ging-dev Date: Tue, 17 Oct 2023 20:17:15 +0700 Subject: [PATCH 1/2] chore: add failing test --- tests/Cache/CacheTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/Cache/CacheTest.php b/tests/Cache/CacheTest.php index 04f44eda644..f2d8443a711 100644 --- a/tests/Cache/CacheTest.php +++ b/tests/Cache/CacheTest.php @@ -219,6 +219,16 @@ public function foo($baz): void } } PHP, + '/src/B.php' => <<<'PHP' + foo(1); + } + } + PHP, ], 'issues' => [], ], @@ -244,6 +254,9 @@ public function foo($baz): void '/src/A.php' => [ "UndefinedDocblockClass: Docblock-defined class, interface or enum named T does not exist", ], + '/src/B.php' => [ + "InvalidArgument: Argument 1 of A::foo expects T, but 1 provided", + ], ], ], ], From 18c037ec6eeccbcaf95ab7b004507f7bb3be29c4 Mon Sep 17 00:00:00 2001 From: ging-dev Date: Tue, 17 Oct 2023 20:23:11 +0700 Subject: [PATCH 2/2] fix: bug fixes for test cases --- src/Psalm/Internal/Diff/FileStatementsDiffer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Diff/FileStatementsDiffer.php b/src/Psalm/Internal/Diff/FileStatementsDiffer.php index 665cb47cafd..1fb58c710c5 100644 --- a/src/Psalm/Internal/Diff/FileStatementsDiffer.php +++ b/src/Psalm/Internal/Diff/FileStatementsDiffer.php @@ -118,7 +118,7 @@ static function ( if ($diff_elem->old->getDocComment() === $diff_elem->new->getDocComment()) { $keep = [...$keep, ...$class_keep[0]]; } else { - $keep_signature = [...$keep_signature, ...$class_keep[0]]; + $add_or_delete = [...$add_or_delete, ...$class_keep[0]]; } $keep_signature = [...$keep_signature, ...$class_keep[1]]; $add_or_delete = [...$add_or_delete, ...$class_keep[2]];