From deb846ba9090305feb554f34cb204c500e873f21 Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Sun, 14 Jan 2024 23:32:50 +0100 Subject: [PATCH] fix phpstan repored issues --- phpstan.dist.neon | 2 +- .../NoUselessReturnFixerTest.php | 3 +++ .../ReturnAssignmentFixerTest.php | 21 +++++++++++++++++++ .../SimplifiedNullReturnFixerTest.php | 6 ++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 2ad00b5e774..13db70262b1 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -21,7 +21,7 @@ parameters: - message: '#^Method PhpCsFixer\\Tests\\.+::provide.+Cases\(\) return type has no value type specified in iterable type iterable\.$#' path: tests - count: 1034 + count: 1025 - message: '#Call to static method .+ with .+ will always evaluate to true.$#' diff --git a/tests/Fixer/ReturnNotation/NoUselessReturnFixerTest.php b/tests/Fixer/ReturnNotation/NoUselessReturnFixerTest.php index d8d6daf26d7..e5571de5730 100644 --- a/tests/Fixer/ReturnNotation/NoUselessReturnFixerTest.php +++ b/tests/Fixer/ReturnNotation/NoUselessReturnFixerTest.php @@ -31,6 +31,9 @@ public function testFix(string $expected, ?string $input = null): void $this->doTest($expected, $input); } + /** + * @return iterable + */ public static function provideFixCases(): iterable { yield [ diff --git a/tests/Fixer/ReturnNotation/ReturnAssignmentFixerTest.php b/tests/Fixer/ReturnNotation/ReturnAssignmentFixerTest.php index ba780523720..87b37916948 100644 --- a/tests/Fixer/ReturnNotation/ReturnAssignmentFixerTest.php +++ b/tests/Fixer/ReturnNotation/ReturnAssignmentFixerTest.php @@ -31,6 +31,9 @@ public function testFixNestedFunctions(string $expected, string $input): void $this->doTest($expected, $input); } + /** + * @return iterable + */ public static function provideFixNestedFunctionsCases(): iterable { yield [ @@ -189,6 +192,9 @@ public function testFix(string $expected, string $input): void $this->doTest($expected, $input); } + /** + * @return iterable + */ public static function provideFixCases(): iterable { yield [ @@ -819,6 +825,9 @@ public function testDoNotFix(string $expected): void $this->doTest($expected); } + /** + * @return iterable + */ public static function provideDoNotFixCases(): iterable { yield 'invalid reference stays invalid' => [ @@ -1261,6 +1270,9 @@ public function testDoNotFix80(string $expected): void $this->doTest($expected); } + /** + * @return iterable + */ public static function provideDoNotFix80Cases(): iterable { yield 'try with non-capturing catch block' => [ @@ -1291,6 +1303,9 @@ public function testRepetitiveFix(string $expected, ?string $input = null): void $this->doTest($expected, $input); } + /** + * @return iterable + */ public static function provideRepetitiveFixCases(): iterable { yield [ @@ -1344,6 +1359,9 @@ public function testFix80(string $expected, ?string $input = null): void $this->doTest($expected, $input); } + /** + * @return iterable + */ public static function provideFix80Cases(): iterable { yield 'match' => [ @@ -1394,6 +1412,9 @@ public function testFixPhp83(string $expected, ?string $input = null): void $this->doTest($expected, $input); } + /** + * @return iterable + */ public static function provideFixPhp83Cases(): iterable { yield 'anonymous readonly class' => [ diff --git a/tests/Fixer/ReturnNotation/SimplifiedNullReturnFixerTest.php b/tests/Fixer/ReturnNotation/SimplifiedNullReturnFixerTest.php index 03e50c1ee68..04f80353671 100644 --- a/tests/Fixer/ReturnNotation/SimplifiedNullReturnFixerTest.php +++ b/tests/Fixer/ReturnNotation/SimplifiedNullReturnFixerTest.php @@ -33,6 +33,9 @@ public function testFix(string $expected, ?string $input = null): void $this->doTest($expected, $input); } + /** + * @return iterable + */ public static function provideFixCases(): iterable { // check correct statements aren't changed @@ -101,6 +104,9 @@ public function testFix80(string $expected, ?string $input = null): void $this->doTest($expected, $input); } + /** + * @return iterable + */ public static function provideFix80Cases(): iterable { yield [