diff --git a/tests/ClassPropertyExtension/ClassComponentPropertyExtension/ClassComponentPropertyExtensionTest.php b/tests/ClassPropertyExtension/ClassComponentPropertyExtension/ClassComponentPropertyExtensionTest.php index 2ff250f..47763da 100644 --- a/tests/ClassPropertyExtension/ClassComponentPropertyExtension/ClassComponentPropertyExtensionTest.php +++ b/tests/ClassPropertyExtension/ClassComponentPropertyExtension/ClassComponentPropertyExtensionTest.php @@ -22,7 +22,7 @@ public function test(string $assertType, string $file, ...$args): void /** * @return mixed[] */ - public static function dataFileAsserts(): iterable + public static function dataFileAsserts(): \Iterator { yield from self::gatherAssertTypes(__DIR__ . '/Fixture/existing_component_component.php'); yield from self::gatherAssertTypes(__DIR__ . '/Fixture/invalid_component_property.php'); diff --git a/tests/ClassPropertyExtension/ClassModelsPropertyExtension/ClassModelPropertyExtensionsTest.php b/tests/ClassPropertyExtension/ClassModelsPropertyExtension/ClassModelPropertyExtensionsTest.php index 73be525..fdb3fc1 100644 --- a/tests/ClassPropertyExtension/ClassModelsPropertyExtension/ClassModelPropertyExtensionsTest.php +++ b/tests/ClassPropertyExtension/ClassModelsPropertyExtension/ClassModelPropertyExtensionsTest.php @@ -21,7 +21,7 @@ public function test(string $assertType, string $file, ...$args): void /** * @return mixed[] */ - public static function dataFileAsserts(): iterable + public static function dataFileAsserts(): \Iterator { yield from self::gatherAssertTypes(__DIR__ . '/Fixture/core_model_behavior.php'); // yield from self::gatherAssertTypes(__DIR__ . '/Fixture/custom_model_behavior.php'); diff --git a/tests/ClassPropertyExtension/ShellClassPropertyExtension/ShellClassPropertyExtensionTest.php b/tests/ClassPropertyExtension/ShellClassPropertyExtension/ShellClassPropertyExtensionTest.php index 358ace0..59e03bf 100644 --- a/tests/ClassPropertyExtension/ShellClassPropertyExtension/ShellClassPropertyExtensionTest.php +++ b/tests/ClassPropertyExtension/ShellClassPropertyExtension/ShellClassPropertyExtensionTest.php @@ -19,7 +19,7 @@ public function test(string $assertType, string $file, ...$args): void $this->assertFileAsserts($assertType, $file, ...$args); } - public static function dataFileAsserts(): iterable + public static function dataFileAsserts(): \Iterator { yield from self::gatherAssertTypes(__DIR__ . '/Fixture/existing_shell_model.php'); yield from self::gatherAssertTypes(__DIR__ . '/Fixture/existing_shell_task.php'); diff --git a/tests/Feature/ControllerExtensionsTest.php b/tests/Feature/ControllerExtensionsTest.php index ebaa894..091795f 100644 --- a/tests/Feature/ControllerExtensionsTest.php +++ b/tests/Feature/ControllerExtensionsTest.php @@ -12,7 +12,7 @@ class ControllerExtensionsTest extends TypeInferenceTestCase /** * @return mixed[] */ - public static function dataFileAsserts(): iterable + public static function dataFileAsserts(): \Iterator { yield from self::gatherAssertTypes(__DIR__ . '/data/existing_controller_model.php'); yield from self::gatherAssertTypes(__DIR__ . '/data/existing_controller_component.php'); diff --git a/tests/Feature/LoadComponentOnFlyMethodReturnTypeExtensionTest.php b/tests/Feature/LoadComponentOnFlyMethodReturnTypeExtensionTest.php index 36b83f2..4b65567 100644 --- a/tests/Feature/LoadComponentOnFlyMethodReturnTypeExtensionTest.php +++ b/tests/Feature/LoadComponentOnFlyMethodReturnTypeExtensionTest.php @@ -5,30 +5,23 @@ namespace PHPStanCakePHP2\Tests\Feature; use PHPStan\Testing\TypeInferenceTestCase; +use PHPUnit\Framework\Attributes\DataProvider; -class LoadComponentOnFlyMethodReturnTypeExtensionTest extends TypeInferenceTestCase +final class LoadComponentOnFlyMethodReturnTypeExtensionTest extends TypeInferenceTestCase { - /** - * @return mixed[] - */ - public static function dataFileAsserts(): iterable + #[DataProvider('dataFileAsserts')] + public function test(string $assertType, string $file, ...$args): void { - yield from self::gatherAssertTypes(__DIR__ . '/data/loading_component_loaded_on_fly.php'); + $this->assertFileAsserts($assertType, $file, ...$args); } - /** - * @dataProvider dataFileAsserts - * @param mixed $args - */ - public function testControllerExtensions(string $assertType, string $file, ...$args): void + public static function dataFileAsserts(): \Iterator { - $this->assertFileAsserts($assertType, $file, ...$args); + yield from self::gatherAssertTypes(__DIR__ . '/data/loading_component_loaded_on_fly.php'); } public static function getAdditionalConfigFiles(): array { - return [ - __DIR__ . '/data/phpstan.neon', - ]; + return [__DIR__ . '/data/phpstan.neon']; } } diff --git a/tests/ReturnTypeExtension/ClassRegistryInitExtension/ClassRegistryInitExtensionTest.php b/tests/ReturnTypeExtension/ClassRegistryInitExtension/ClassRegistryInitExtensionTest.php index 6c25742..0144f5e 100644 --- a/tests/ReturnTypeExtension/ClassRegistryInitExtension/ClassRegistryInitExtensionTest.php +++ b/tests/ReturnTypeExtension/ClassRegistryInitExtension/ClassRegistryInitExtensionTest.php @@ -15,7 +15,7 @@ final class ClassRegistryInitExtensionTest extends TypeInferenceTestCase /** * @return mixed[] */ - public static function dataFileAsserts(): iterable + public static function dataFileAsserts(): \Iterator { yield from self::gatherAssertTypes(__DIR__ . '/Fixture/variable_reference.php'); yield from self::gatherAssertTypes(__DIR__ . '/Fixture/not_a_class.php');