From 703a4b46c3b15907bdba85e70d6d9f3ff23b6aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tinjo=20Sch=C3=B6ni?= <32767367+tscni@users.noreply.github.com> Date: Sat, 24 Jun 2023 04:36:50 +0200 Subject: [PATCH] Add test case for property type change not invalidating methods --- tests/Cache/CacheTest.php | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/Cache/CacheTest.php b/tests/Cache/CacheTest.php index bcb777b8e..0efce1c68 100644 --- a/tests/Cache/CacheTest.php +++ b/tests/Cache/CacheTest.php @@ -158,5 +158,46 @@ class CacheTest extends TestCase ], ], ]; + + yield 'classPropertyTypeChangeInvalidatesReferencingMethod' => [ + [ + [ + 'files' => [ + '/src/A.php' => <<<'PHP' + value; + } + } + PHP, + '/src/B.php' => <<<'PHP' + [ + '/src/A.php' => [ + "NullableReturnStatement: The declared return type 'int' for A::foo is not nullable, but the function returns 'int|null'", + "InvalidNullableReturnType: The declared return type 'int' for A::foo is not nullable, but 'int|null' contains null", + ], + ], + ], + [ + 'files' => [ + '/src/B.php' => <<<'PHP' + [], + ], + ], + ]; } }