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" > 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 ) { } 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]); +};