diff --git a/tests/StubTest.php b/tests/StubTest.php index 863caad0b9f..5be8f42af85 100644 --- a/tests/StubTest.php +++ b/tests/StubTest.php @@ -1301,4 +1301,60 @@ function em(EntityManager $em) : void { $this->analyzeFile($file_path, new Context()); } + + public function testOverriddenStubProperty(): void + { + $this->project_analyzer = $this->getProjectAnalyzerWithConfig( + TestConfig::loadFromXML( + dirname(__DIR__), + ' + + + + + + + + ' + ) + ); + + $vendor_file_path = getcwd() . '/vendor/Kernel.php'; + + $this->addFile( + $vendor_file_path, + 'environment = $environment) { + throw new InvalidArgumentException; + } + } + }' + ); + + $file_path = getcwd() . '/src/somefile.php'; + $this->addFile( + $file_path, + 'analyzeFile($file_path, new Context(), false); + } } diff --git a/tests/fixtures/stubs/SymfonyKernel.phpstub b/tests/fixtures/stubs/SymfonyKernel.phpstub new file mode 100644 index 00000000000..445bac7c58f --- /dev/null +++ b/tests/fixtures/stubs/SymfonyKernel.phpstub @@ -0,0 +1,11 @@ +