diff --git a/tests/FileUpdates/AnalyzedMethodTest.php b/tests/FileUpdates/AnalyzedMethodTest.php index d4fa893ff..86a4f4cc6 100644 --- a/tests/FileUpdates/AnalyzedMethodTest.php +++ b/tests/FileUpdates/AnalyzedMethodTest.php @@ -997,6 +997,71 @@ class AnalyzedMethodTest extends \Psalm\Tests\TestCase ], ], ], + 'invalidateConstructorWhenDependentMethodInSubclassChanges' => [ + 'start_files' => [ + getcwd() . DIRECTORY_SEPARATOR . 'A.php' => 'setFoo(); + } + + protected function setFoo() : void { + $this->foo = "bar"; + } + }', + getcwd() . DIRECTORY_SEPARATOR . 'AChild.php' => ' [ + getcwd() . DIRECTORY_SEPARATOR . 'A.php' => 'setFoo(); + } + + protected function setFoo() : void { + $this->foo = "baz"; + } + }', + getcwd() . DIRECTORY_SEPARATOR . 'AChild.php' => ' [ + getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [ + 'foo\a::__construct' => 2, + 'foo\a::setfoo' => 1, + ], + getcwd() . DIRECTORY_SEPARATOR . 'AChild.php' => [ + 'foo\achild::__construct' => 2, + ], + ], + 'unaffected_analyzed_methods' => [ + getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [], + getcwd() . DIRECTORY_SEPARATOR . 'AChild.php' => [], + ], + ], 'invalidateConstructorWhenDependentTraitMethodChanges' => [ 'start_files' => [ getcwd() . DIRECTORY_SEPARATOR . 'A.php' => '