From 2165298e66f941bb0d173937f219973397b73754 Mon Sep 17 00:00:00 2001 From: kkmuffme <11071985+kkmuffme@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:04:58 +0100 Subject: [PATCH] Remove tests for partially stubbed classes introduced in https://github.com/vimeo/psalm/issues/849, as this didn't work correctly and lead to errors not being reported at all in many cases (since the error was reported for the stubs file and therefore suppressed) With the previous commit "Fix for classes what https://github.com/vimeo/psalm/pull/8503 fixed for functions", the stubs of classes where the actual file is in the analyzed files are ignored completely. --- tests/StubTest.php | 96 ++-------------------------------------------- 1 file changed, 4 insertions(+), 92 deletions(-) diff --git a/tests/StubTest.php b/tests/StubTest.php index 8d92421a1a2..6c835a65d8d 100644 --- a/tests/StubTest.php +++ b/tests/StubTest.php @@ -317,10 +317,10 @@ public function testPhpStormMetaParsingFile(): void 'creAte2("object"); $y2 = (new \Ns\MyClass)->creaTe2("exception"); - + $const1 = (new \Ns\MyClass)->creAte3(\Ns\MyClass::OBJECT); $const2 = (new \Ns\MyClass)->creaTe3("exception"); @@ -1194,94 +1194,6 @@ class Bar extends PartiallyStubbedClass {} $this->analyzeFile($file_path, new Context()); } - public function testStubFileWithPartialClassDefinitionWithCoercion(): void - { - $this->expectExceptionMessage('TypeCoercion'); - $this->expectException(CodeException::class); - $this->project_analyzer = $this->getProjectAnalyzerWithConfig( - TestConfig::loadFromXML( - dirname(__DIR__), - ' - - - - - - - - - ', - ), - ); - - $file_path = getcwd() . '/src/somefile.php'; - - $this->addFile( - $file_path, - 'foo("dasda");', - ); - - $this->analyzeFile($file_path, new Context()); - } - - public function testStubFileWithPartialClassDefinitionGeneralReturnType(): void - { - $this->expectExceptionMessage('InvalidReturnStatement'); - $this->expectException(CodeException::class); - $this->project_analyzer = $this->getProjectAnalyzerWithConfig( - TestConfig::loadFromXML( - dirname(__DIR__), - ' - - - - - - - - - ', - ), - ); - - $file_path = getcwd() . '/src/somefile.php'; - - $this->addFile( - $file_path, - 'analyzeFile($file_path, new Context()); - } - public function testStubFileWithTemplatedClassDefinitionAndMagicMethodOverride(): void { $this->project_analyzer = $this->getProjectAnalyzerWithConfig(