From 80d3ba28016ebeb55cfbd3900abf6fbc0a466b2c Mon Sep 17 00:00:00 2001 From: Artem Lopata Date: Thu, 7 Aug 2025 18:58:36 +0200 Subject: [PATCH 1/4] Cover array shape iterator for YieldDataProviderRector+RemoveUselessReturnTagRector. --- .../AnnotationParsingTest.php | 28 +++++++++ .../Fixture/some_test.php.inc | 57 +++++++++++++++++++ .../config/configured_rule.php | 11 ++++ 3 files changed, 96 insertions(+) create mode 100644 tests/Issues/AnnotationParsing/AnnotationParsingTest.php create mode 100644 tests/Issues/AnnotationParsing/Fixture/some_test.php.inc create mode 100644 tests/Issues/AnnotationParsing/config/configured_rule.php diff --git a/tests/Issues/AnnotationParsing/AnnotationParsingTest.php b/tests/Issues/AnnotationParsing/AnnotationParsingTest.php new file mode 100644 index 00000000..b915b2ad --- /dev/null +++ b/tests/Issues/AnnotationParsing/AnnotationParsingTest.php @@ -0,0 +1,28 @@ +doTestFile($filePath); + } + + public static function provideData(): Iterator + { + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__ . '/config/configured_rule.php'; + } +} diff --git a/tests/Issues/AnnotationParsing/Fixture/some_test.php.inc b/tests/Issues/AnnotationParsing/Fixture/some_test.php.inc new file mode 100644 index 00000000..ba06bc17 --- /dev/null +++ b/tests/Issues/AnnotationParsing/Fixture/some_test.php.inc @@ -0,0 +1,57 @@ +assertTrue($param1); + $this->assertSame('string', $param2); + $this->assertTrue($param3); + } + + /** + * @return array + */ + public static function dataProvider(): array + { + return [ + 'data1' => [null, 'string', false], + 'data2' => [false, 'string', false], + ]; + } +} + +?> +----- +assertTrue($param1); + $this->assertSame('string', $param2); + $this->assertTrue($param3); + } + + /** + * @return \Iterator<(int | string), array{(bool | null), string, bool}> + */ + public static function dataProvider(): \Iterator + { + yield 'data1' => [null, 'string', false]; + yield 'data2' => [false, 'string', false]; + } +} + +?> diff --git a/tests/Issues/AnnotationParsing/config/configured_rule.php b/tests/Issues/AnnotationParsing/config/configured_rule.php new file mode 100644 index 00000000..09ef0e03 --- /dev/null +++ b/tests/Issues/AnnotationParsing/config/configured_rule.php @@ -0,0 +1,11 @@ +rules([YieldDataProviderRector::class, RemoveUselessReturnTagRector::class]); +}; From 91cc51b481f0354678a33bb3b02a032498c61666 Mon Sep 17 00:00:00 2001 From: Artem Lopata Date: Fri, 8 Aug 2025 12:03:32 +0200 Subject: [PATCH 2/4] Rector changes. --- src/NodeFactory/ConsecutiveIfsFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NodeFactory/ConsecutiveIfsFactory.php b/src/NodeFactory/ConsecutiveIfsFactory.php index e0cfbfce..f7be2e67 100644 --- a/src/NodeFactory/ConsecutiveIfsFactory.php +++ b/src/NodeFactory/ConsecutiveIfsFactory.php @@ -26,7 +26,7 @@ { public function __construct( private NodeNameResolver $nodeNameResolver, - private readonly NestedClosureAssertFactory $nestedClosureAssertFactory + private NestedClosureAssertFactory $nestedClosureAssertFactory ) { } From 7c20cc8cffde5f698705cb9a0320813fc26f4554 Mon Sep 17 00:00:00 2001 From: Artem Lopata Date: Fri, 8 Aug 2025 12:39:37 +0200 Subject: [PATCH 3/4] PHPUnit fail on warnings and notices. --- phpunit.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpunit.xml b/phpunit.xml index d0f76422..b41f44a0 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -4,6 +4,8 @@ bootstrap="vendor/autoload.php" colors="true" displayDetailsOnTestsThatTriggerWarnings="true" + failOnWarning="true" + failOnNotice="true" > From 55220b80326d39eb792c1107dc01707f8df93f3a Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 8 Aug 2025 18:35:14 +0700 Subject: [PATCH 4/4] trigger latest rector-src