From 43b782ed2762d64d62c93837a844b98812c4002c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Mon, 13 Nov 2023 13:45:48 +0100 Subject: [PATCH] Make all data providers return iterable --- phpstan.tests.neon | 4 ++++ .../Parameters/ParameterType/SectionTypeTest.php | 13 +++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/phpstan.tests.neon b/phpstan.tests.neon index 77da950..d6d6b36 100644 --- a/phpstan.tests.neon +++ b/phpstan.tests.neon @@ -12,3 +12,7 @@ parameters: - message: '#RepositoryInterface (but )?does not specify its types#' path: tests/lib/Validator/RepositoryValidatorFactory.php + + # Disable errors about missing value types in PHPUnit data providers + + - '#Method .+Test::\w+DataProvider\(\) return type has no value type specified in iterable type iterable.#' diff --git a/tests/lib/Parameters/ParameterType/SectionTypeTest.php b/tests/lib/Parameters/ParameterType/SectionTypeTest.php index f6fcdb5..7285d34 100644 --- a/tests/lib/Parameters/ParameterType/SectionTypeTest.php +++ b/tests/lib/Parameters/ParameterType/SectionTypeTest.php @@ -60,10 +60,8 @@ public function testInvalidOptions(array $options): void /** * Provider for testing valid parameter attributes. - * - * @return mixed[] */ - public static function validOptionsDataProvider(): array + public static function validOptionsDataProvider(): iterable { return [ [ @@ -75,10 +73,8 @@ public static function validOptionsDataProvider(): array /** * Provider for testing invalid parameter attributes. - * - * @return mixed[] */ - public static function invalidOptionsDataProvider(): array + public static function invalidOptionsDataProvider(): iterable { return [ [ @@ -144,10 +140,7 @@ public function testIsValueEmpty(mixed $value, bool $isEmpty): void self::assertSame($isEmpty, $this->type->isValueEmpty(new ParameterDefinition(), $value)); } - /** - * @return mixed[] - */ - public static function emptyDataProvider(): array + public static function emptyDataProvider(): iterable { return [ [null, true],