diff --git a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php index b7f4e5471..4f933239c 100644 --- a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php @@ -119,9 +119,6 @@ class ClassAnalyzer extends ClassLikeAnalyzer . '_' . $class->getLine() . '_' . (int)$class->getAttribute('startFilePos'); } - /** - * @return void - */ public function analyze( ?Context $class_context = null, ?Context $global_context = null diff --git a/src/Psalm/Plugin/EventHandler/AfterClassLikeVisitInterface.php b/src/Psalm/Plugin/EventHandler/AfterClassLikeVisitInterface.php index 99b110ec5..e12d86ed5 100644 --- a/src/Psalm/Plugin/EventHandler/AfterClassLikeVisitInterface.php +++ b/src/Psalm/Plugin/EventHandler/AfterClassLikeVisitInterface.php @@ -5,8 +5,5 @@ use Psalm\Plugin\EventHandler\Event\AfterClassLikeVisitEvent; interface AfterClassLikeVisitInterface { - /** - * @return void - */ - public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event); + public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event): void; } diff --git a/src/Psalm/Plugin/EventHandler/AfterCodebasePopulatedInterface.php b/src/Psalm/Plugin/EventHandler/AfterCodebasePopulatedInterface.php index 21977bf40..e898e3593 100644 --- a/src/Psalm/Plugin/EventHandler/AfterCodebasePopulatedInterface.php +++ b/src/Psalm/Plugin/EventHandler/AfterCodebasePopulatedInterface.php @@ -7,8 +7,6 @@ interface AfterCodebasePopulatedInterface { /** * Called after codebase has been populated - * - * @return void */ - public static function afterCodebasePopulated(AfterCodebasePopulatedEvent $event); + public static function afterCodebasePopulated(AfterCodebasePopulatedEvent $event): void; } diff --git a/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeVisitEvent.php b/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeVisitEvent.php index 27b98ef82..c478a5bed 100644 --- a/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeVisitEvent.php +++ b/src/Psalm/Plugin/EventHandler/Event/AfterClassLikeVisitEvent.php @@ -34,8 +34,6 @@ class AfterClassLikeVisitEvent /** * @param FileManipulation[] $file_replacements - * - * @return void */ public function __construct( ClassLike $stmt, diff --git a/src/Psalm/Plugin/Hook/AfterClassLikeVisitInterface.php b/src/Psalm/Plugin/Hook/AfterClassLikeVisitInterface.php index aaeb3265b..5afbc7f39 100644 --- a/src/Psalm/Plugin/Hook/AfterClassLikeVisitInterface.php +++ b/src/Psalm/Plugin/Hook/AfterClassLikeVisitInterface.php @@ -12,8 +12,6 @@ interface AfterClassLikeVisitInterface { /** * @param FileManipulation[] $file_replacements - * - * @return void */ public static function afterClassLikeVisit( ClassLike $stmt, @@ -21,5 +19,5 @@ interface AfterClassLikeVisitInterface FileSource $statements_source, Codebase $codebase, array &$file_replacements = [] - ); + ): void; } diff --git a/src/Psalm/Plugin/Hook/AfterCodebasePopulatedInterface.php b/src/Psalm/Plugin/Hook/AfterCodebasePopulatedInterface.php index e43e74b24..df344976f 100644 --- a/src/Psalm/Plugin/Hook/AfterCodebasePopulatedInterface.php +++ b/src/Psalm/Plugin/Hook/AfterCodebasePopulatedInterface.php @@ -8,8 +8,6 @@ interface AfterCodebasePopulatedInterface { /** * Called after codebase has been populated - * - * @return void */ - public static function afterCodebasePopulated(Codebase $codebase); + public static function afterCodebasePopulated(Codebase $codebase): void; } diff --git a/tests/BinaryOperationTest.php b/tests/BinaryOperationTest.php index baaf581d4..e663c6cac 100644 --- a/tests/BinaryOperationTest.php +++ b/tests/BinaryOperationTest.php @@ -10,10 +10,7 @@ class BinaryOperationTest extends TestCase use Traits\InvalidCodeAnalysisTestTrait; use Traits\ValidCodeAnalysisTestTrait; - /** - * @return void - */ - public function testGMPOperations() + public function testGMPOperations(): void { if (class_exists('GMP') === false) { $this->markTestSkipped('Cannot run test, base class "GMP" does not exist!'); diff --git a/tests/ClassTest.php b/tests/ClassTest.php index 7ea1f0595..e9cfeb3d9 100644 --- a/tests/ClassTest.php +++ b/tests/ClassTest.php @@ -8,10 +8,7 @@ class ClassTest extends TestCase use Traits\InvalidCodeAnalysisTestTrait; use Traits\ValidCodeAnalysisTestTrait; - /** - * @return void - */ - public function testExtendsMysqli() + public function testExtendsMysqli(): void { if (class_exists('mysqli') === false) { $this->markTestSkipped('Cannot run test, base class "mysqli" does not exist!'); diff --git a/tests/CodebaseTest.php b/tests/CodebaseTest.php index 747a8dfa7..a8a7623d3 100644 --- a/tests/CodebaseTest.php +++ b/tests/CodebaseTest.php @@ -143,10 +143,7 @@ class CodebaseTest extends TestCase ' ); $hook = new class implements AfterClassLikeVisitInterface { - /** - * @return void - */ - public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event) + public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event): void { $stmt = $event->getStmt(); $storage = $event->getStorage(); diff --git a/tests/Config/ConfigTest.php b/tests/Config/ConfigTest.php index 3c5050a92..ef353744a 100644 --- a/tests/Config/ConfigTest.php +++ b/tests/Config/ConfigTest.php @@ -140,10 +140,7 @@ class ConfigTest extends \Psalm\Tests\TestCase $this->assertFalse($config->isInProjectDirs(realpath('examples/StringAnalyzer.php'))); } - /** - * @return void - */ - public function testIgnoreSymlinkedProjectDirectory() + public function testIgnoreSymlinkedProjectDirectory(): void { @unlink(dirname(__DIR__, 1) . '/fixtures/symlinktest/ignored/b'); @@ -1378,8 +1375,7 @@ class ConfigTest extends \Psalm\Tests\TestCase $this->assertFalse($this->project_analyzer->getConfig()->use_phpstorm_meta_path); } - /** @return void */ - public function testSetsUniversalObjectCrates() + public function testSetsUniversalObjectCrates(): void { $this->project_analyzer = $this->getProjectAnalyzerWithConfig( TestConfig::loadFromXML( diff --git a/tests/Config/PluginTest.php b/tests/Config/PluginTest.php index 64eda8a89..815d588bf 100644 --- a/tests/Config/PluginTest.php +++ b/tests/Config/PluginTest.php @@ -540,8 +540,7 @@ class PluginTest extends \Psalm\Tests\TestCase ); $hook = new class implements AfterCodebasePopulatedInterface { - /** @return void */ - public static function afterCodebasePopulated(AfterCodebasePopulatedEvent $event) + public static function afterCodebasePopulated(AfterCodebasePopulatedEvent $event): void { } }; diff --git a/tests/ErrorBaselineTest.php b/tests/ErrorBaselineTest.php index 56be18758..845af5f7a 100644 --- a/tests/ErrorBaselineTest.php +++ b/tests/ErrorBaselineTest.php @@ -24,10 +24,7 @@ class ErrorBaselineTest extends TestCase $this->fileProvider = $this->prophesize(FileProvider::class); } - /** - * @return void - */ - public function testLoadShouldParseXmlBaselineToPhpArray() + public function testLoadShouldParseXmlBaselineToPhpArray(): void { $baselineFilePath = 'baseline.xml'; @@ -95,10 +92,7 @@ class ErrorBaselineTest extends TestCase ); } - /** - * @return void - */ - public function testLoadShouldThrowExceptionWhenFilesAreNotDefinedInBaselineFile() + public function testLoadShouldThrowExceptionWhenFilesAreNotDefinedInBaselineFile(): void { $this->expectException(ConfigException::class); @@ -115,10 +109,7 @@ class ErrorBaselineTest extends TestCase ErrorBaseline::read($this->fileProvider->reveal(), $baselineFile); } - /** - * @return void - */ - public function testLoadShouldThrowExceptionWhenBaselineFileDoesNotExist() + public function testLoadShouldThrowExceptionWhenBaselineFileDoesNotExist(): void { $this->expectException(ConfigException::class); @@ -129,10 +120,7 @@ class ErrorBaselineTest extends TestCase ErrorBaseline::read($this->fileProvider->reveal(), $baselineFile); } - /** - * @return void - */ - public function testCountTotalIssuesShouldReturnCorrectNumber() + public function testCountTotalIssuesShouldReturnCorrectNumber(): void { $existingIssues = [ 'sample/sample-file.php' => [ @@ -149,10 +137,7 @@ class ErrorBaselineTest extends TestCase $this->assertSame($totalIssues, 5); } - /** - * @return void - */ - public function testCreateShouldAggregateIssuesPerFile() + public function testCreateShouldAggregateIssuesPerFile(): void { $baselineFile = 'baseline.xml'; @@ -342,10 +327,7 @@ class ErrorBaselineTest extends TestCase $this->assertSame('1', $file2Issues[1]->getAttribute('occurrences')); } - /** - * @return void - */ - public function testUpdateShouldRemoveExistingIssuesWithoutAddingNewOnes() + public function testUpdateShouldRemoveExistingIssuesWithoutAddingNewOnes(): void { $baselineFile = 'baseline.xml'; @@ -481,10 +463,7 @@ class ErrorBaselineTest extends TestCase ], $remainingBaseline); } - /** - * @return void - */ - public function testAddingACommentInBaselineDoesntTriggerNotice() + public function testAddingACommentInBaselineDoesntTriggerNotice(): void { $baselineFilePath = 'baseline.xml'; diff --git a/tests/MethodCallTest.php b/tests/MethodCallTest.php index deab0ad35..49dfcebee 100644 --- a/tests/MethodCallTest.php +++ b/tests/MethodCallTest.php @@ -10,10 +10,7 @@ class MethodCallTest extends TestCase use Traits\InvalidCodeAnalysisTestTrait; use Traits\ValidCodeAnalysisTestTrait; - /** - * @return void - */ - public function testExtendDocblockParamType() + public function testExtendDocblockParamType(): void { if (class_exists('SoapClient') === false) { $this->markTestSkipped('Cannot run test, base class "SoapClient" does not exist!'); diff --git a/tests/MethodSignatureTest.php b/tests/MethodSignatureTest.php index 13b700fa0..4d89bdc89 100644 --- a/tests/MethodSignatureTest.php +++ b/tests/MethodSignatureTest.php @@ -12,10 +12,7 @@ class MethodSignatureTest extends TestCase use Traits\ValidCodeAnalysisTestTrait; use Traits\InvalidCodeAnalysisTestTrait; - /** - * @return void - */ - public function testExtendSoapClientWithDocblockTypes() + public function testExtendSoapClientWithDocblockTypes(): void { if (class_exists('SoapClient') === false) { $this->markTestSkipped('Cannot run test, base class "SoapClient" does not exist!'); @@ -49,10 +46,7 @@ class MethodSignatureTest extends TestCase $this->analyzeFile('somefile.php', new Context()); } - /** - * @return void - */ - public function testExtendSoapClientWithNoDocblockTypes() + public function testExtendSoapClientWithNoDocblockTypes(): void { if (class_exists('SoapClient') === false) { $this->markTestSkipped('Cannot run test, base class "SoapClient" does not exist!'); @@ -78,10 +72,7 @@ class MethodSignatureTest extends TestCase $this->analyzeFile('somefile.php', new Context()); } - /** - * @return void - */ - public function testExtendSoapClientWithParamType() + public function testExtendSoapClientWithParamType(): void { if (class_exists('SoapClient') === false) { $this->markTestSkipped('Cannot run test, base class "SoapClient" does not exist!'); @@ -250,10 +241,7 @@ class MethodSignatureTest extends TestCase $this->analyzeFile('somefile.php', new Context()); } - /** - * @return void - */ - public function testExtendDocblockParamTypeWithWrongDocblockParam() + public function testExtendDocblockParamTypeWithWrongDocblockParam(): void { $this->expectExceptionMessage('ImplementedParamTypeMismatch'); $this->expectException(\Psalm\Exception\CodeException::class); diff --git a/tests/ProjectCheckerTest.php b/tests/ProjectCheckerTest.php index 1945e9233..c5199a8fe 100644 --- a/tests/ProjectCheckerTest.php +++ b/tests/ProjectCheckerTest.php @@ -108,8 +108,7 @@ class ProjectCheckerTest extends TestCase /** @var bool */ public static $called = false; - /** @return void */ - public static function afterCodebasePopulated(AfterCodebasePopulatedEvent $event) + public static function afterCodebasePopulated(AfterCodebasePopulatedEvent $event): void { self::$called = true; } diff --git a/tests/Traits/InvalidCodeAnalysisTestTrait.php b/tests/Traits/InvalidCodeAnalysisTestTrait.php index 6a744ae14..9efd68762 100644 --- a/tests/Traits/InvalidCodeAnalysisTestTrait.php +++ b/tests/Traits/InvalidCodeAnalysisTestTrait.php @@ -26,8 +26,6 @@ trait InvalidCodeAnalysisTestTrait * @param string $error_message * @param array $error_levels * @param bool $strict_mode - * - * @return void */ public function testInvalidCode( $code, @@ -35,7 +33,7 @@ trait InvalidCodeAnalysisTestTrait $error_levels = [], $strict_mode = false, string $php_version = '7.3' - ) { + ): void { $test_name = $this->getTestName(); if (strpos($test_name, 'PHP71-') !== false) { if (version_compare(PHP_VERSION, '7.1.0', '<')) { diff --git a/tests/Traits/ValidCodeAnalysisTestTrait.php b/tests/Traits/ValidCodeAnalysisTestTrait.php index f5db49b50..2769e58bb 100644 --- a/tests/Traits/ValidCodeAnalysisTestTrait.php +++ b/tests/Traits/ValidCodeAnalysisTestTrait.php @@ -27,15 +27,13 @@ trait ValidCodeAnalysisTestTrait * @param array $error_levels * * @small - * - * @return void */ public function testValidCode( $code, $assertions = [], $error_levels = [], string $php_version = '7.3' - ) { + ): void { $test_name = $this->getTestName(); if (strpos($test_name, 'PHP73-') !== false) { if (version_compare(PHP_VERSION, '7.3.0', '<')) {