diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php index da09dc906763e..aa36885cad44e 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php @@ -197,7 +197,7 @@ public function testMappingTypeDetection() $this->assertSame($mappingType, \PHP_VERSION_ID < 80000 ? 'annotation' : 'attribute'); } - public static function providerBasicDrivers() + public static function providerBasicDrivers(): array { return [ ['doctrine.orm.cache.apc.class', ['type' => 'apc']], @@ -276,7 +276,7 @@ public function testUnrecognizedCacheDriverException() $this->invokeLoadCacheDriver($objectManager, $container, $cacheName); } - public static function providerBundles() + public static function providerBundles(): iterable { yield ['AnnotationsBundle', \PHP_VERSION_ID < 80000 ? 'annotation' : 'attribute', '/Entity']; yield ['AnnotationsOneLineBundle', \PHP_VERSION_ID < 80000 ? 'annotation' : 'attribute', '/Entity']; diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index d8491588fe357..75102ee331410 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -158,7 +158,7 @@ public function testChoiceTranslationDomainIsDisabledByDefault($expanded) } } - public static function choiceTranslationDomainProvider() + public static function choiceTranslationDomainProvider(): array { return [ [false], @@ -240,8 +240,6 @@ public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder() return new \stdClass(); }, ]); - - $field->submit('2'); } public function testConfigureQueryBuilderWithClosureReturningNullUseDefault() diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index 66849208fd44b..75eae2c311d9f 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -479,7 +479,7 @@ public function testValidateResultTypes($entity1, $result) $this->assertNoViolation(); } - public static function resultTypesProvider() + public static function resultTypesProvider(): array { $entity = new SingleIntIdEntity(1, 'foo'); diff --git a/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php b/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php index e3d06b52f4035..4ddaddbde1218 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php @@ -89,7 +89,7 @@ public function testVerbosityMapping($verbosity, $level, $isHandling, array $map $this->assertFalse($handler->handle($infoRecord), 'The handler finished handling the log.'); } - public static function provideVerbosityMappingTests() + public static function provideVerbosityMappingTests(): array { return [ [OutputInterface::VERBOSITY_QUIET, Logger::ERROR, true], diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php index 6116fbe9f0260..726f397f919b3 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php @@ -249,8 +249,8 @@ public function testToleratesForIndividualGroups(string $deprecationsHelper, arr } } - public static function provideDataForToleratesForGroup() { - + public static function provideDataForToleratesForGroup(): iterable + { yield 'total threshold not reached' => ['max[total]=1', [ 'unsilenced' => 0, 'self' => 0, diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php index 5c7cf991b3f2f..01d418ef23829 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php @@ -97,7 +97,7 @@ public function testItMutesOnlySpecificErrorMessagesWhenTheCallingCodeIsInPhpuni $this->assertSame($muted, $deprecation->isMuted()); } - public static function mutedProvider() + public static function mutedProvider(): iterable { yield 'not from phpunit, and not a whitelisted message' => [ false, @@ -147,7 +147,7 @@ public function testItTakesMutesDeprecationFromPhpUnitFiles() $this->assertTrue($deprecation->isMuted()); } - public static function providerGetTypeDetectsSelf() + public static function providerGetTypeDetectsSelf(): array { return [ 'not_from_vendors_file' => [Deprecation::TYPE_SELF, '', 'MyClass1', __FILE__], @@ -182,7 +182,7 @@ public function testGetTypeDetectsSelf(string $expectedType, string $message, st $this->assertSame($expectedType, $deprecation->getType()); } - public static function providerGetTypeUsesRightTrace() + public static function providerGetTypeUsesRightTrace(): array { $vendorDir = self::getVendorDir(); $fakeTrace = [ diff --git a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php index ea3fbfda3a659..9378e87c46939 100644 --- a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php +++ b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php @@ -43,7 +43,7 @@ public function testDebug($debugFlag) $this->assertEquals($debugFlag, $this->appVariable->getDebug()); } - public static function debugDataProvider() + public static function debugDataProvider(): array { return [ 'debug on' => [true], diff --git a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php index a898680fdd3e3..18d09b20b2d95 100644 --- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php @@ -150,7 +150,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $tester->complete($input)); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'option' => [['--format', ''], ['txt', 'json', 'github']]; } diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php index 3809f3fa1f4cf..5de8fb90e1a93 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php @@ -100,7 +100,7 @@ public function testThemeBlockInheritanceUsingDynamicExtend() ); } - public static function isSelectedChoiceProvider() + public static function isSelectedChoiceProvider(): array { return [ [true, '0', '0'], @@ -150,7 +150,7 @@ public function testStartTagHasActionAttributeWhenActionIsZero() $this->assertSame('
')); @@ -623,7 +627,7 @@ public function testFollowMetaRefresh(string $content, string $expectedEndingUrl $this->assertSame($expectedEndingUrl, $client->getRequest()->getUri()); } - public static function getTestsForMetaRefresh() + public static function getTestsForMetaRefresh(): array { return [ ['', 'http://www.example.com/redirected'], @@ -844,10 +848,11 @@ public function testInternalRequest() public function testInternalRequestNull() { + $client = $this->getBrowser(); + $this->expectException(BadMethodCallException::class); $this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getInternalRequest()".'); - $client = $this->getBrowser(); - $this->assertNull($client->getInternalRequest()); + $client->getInternalRequest(); } } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterSentinelTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterSentinelTest.php index 601715645a8db..c05c6f3e7341a 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterSentinelTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterSentinelTest.php @@ -48,7 +48,7 @@ public function testExceptionMessageWhenFailingToRetrieveMasterInformation() { $hosts = getenv('REDIS_SENTINEL_HOSTS'); $dsn = 'redis:?host['.str_replace(' ', ']&host[', $hosts).']'; - $this->expectException(\Symfony\Component\Cache\Exception\InvalidArgumentException::class); + $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Failed to retrieve master information from sentinel "invalid-masterset-name" and dsn "'.$dsn.'".'); AbstractAdapter::createConnection($dsn, ['redis_sentinel' => 'invalid-masterset-name']); } diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index d06abcb8c10dc..bf5652ccc47f2 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -1536,7 +1536,7 @@ public function testRunWithErrorAndDispatcher() $tester = new ApplicationTester($application); $tester->run(['command' => 'dym']); - $this->assertStringContainsString('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events'); + $this->assertStringContainsString('before.dym.error.after.', $tester->getDisplay(), 'The PHP error did not dispatch events'); } public function testRunDispatchesAllEventsWithError() @@ -1553,7 +1553,7 @@ public function testRunDispatchesAllEventsWithError() $tester = new ApplicationTester($application); $tester->run(['command' => 'dym']); - $this->assertStringContainsString('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events'); + $this->assertStringContainsString('before.dym.error.after.', $tester->getDisplay(), 'The PHP error did not dispatch events'); } public function testRunWithErrorFailingStatusCode() diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index 1f313a680f04a..e7822a4565590 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -1017,15 +1017,16 @@ public function testColumnStyle() public function testThrowsWhenTheCellInAnArray() { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('A cell must be a TableCell, a scalar or an object implementing "__toString()", "array" given.'); - $table = new Table($output = $this->getOutputStream()); + $table = new Table($this->getOutputStream()); $table ->setHeaders(['ISBN', 'Title', 'Author', 'Price']) ->setRows([ ['99921-58-10-7', [], 'Dante Alighieri', '9.95'], ]); + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('A cell must be a TableCell, a scalar or an object implementing "__toString()", "array" given.'); + $table->render(); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php index 91447c7ef4459..90a5248f1e47d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php @@ -265,17 +265,15 @@ public function testProcessSuccessWhenPassingNullToOptionalThatDoesNotAcceptNull public function testProcessFailsWhenPassingBadTypeToOptional() { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Invalid definition for service "bar": argument 1 of "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CheckTypeDeclarationsPass\\BarOptionalArgument::__construct()" accepts "stdClass", "string" passed.'); - $container = new ContainerBuilder(); $container->register('bar', BarOptionalArgument::class) ->addArgument('string instead of stdClass'); - (new CheckTypeDeclarationsPass(true))->process($container); + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid definition for service "bar": argument 1 of "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CheckTypeDeclarationsPass\\BarOptionalArgument::__construct()" accepts "stdClass", "string" passed.'); - $this->assertNull($container->get('bar')->foo); + (new CheckTypeDeclarationsPass(true))->process($container); } public function testProcessSuccessScalarType() @@ -604,17 +602,15 @@ public function testProcessDoesNotThrowsExceptionOnValidTypes() public function testProcessThrowsOnIterableTypeWhenScalarPassed() { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Invalid definition for service "bar_call": argument 1 of "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CheckTypeDeclarationsPass\\BarMethodCall::setIterable()" accepts "iterable", "int" passed.'); - $container = new ContainerBuilder(); $container->register('bar_call', BarMethodCall::class) ->addMethodCall('setIterable', [2]); - (new CheckTypeDeclarationsPass(true))->process($container); + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid definition for service "bar_call": argument 1 of "Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CheckTypeDeclarationsPass\\BarMethodCall::setIterable()" accepts "iterable", "int" passed.'); - $this->assertInstanceOf(\stdClass::class, $container->get('bar')->foo); + (new CheckTypeDeclarationsPass(true))->process($container); } public function testProcessResolveExpressions() diff --git a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTestCase.php b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTestCase.php index 09c8584431856..d9ca3ef109401 100644 --- a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTestCase.php +++ b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTestCase.php @@ -68,7 +68,7 @@ public function getNormalizedIniPostMaxSize(): string $this->request = null; } - public static function methodExceptGetProvider() + public static function methodExceptGetProvider(): array { return [ ['POST'], @@ -78,7 +78,7 @@ public static function methodExceptGetProvider() ]; } - public static function methodProvider() + public static function methodProvider(): array { return array_merge([ ['GET'], diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php index b23dab0c48801..4b504a3c74d6b 100644 --- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php +++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php @@ -574,7 +574,7 @@ public function testSubmitMapsSubmittedChildrenOntoEmptyData() $this->assertSame('Bernhard', $object['name']); } - public static function requestMethodProvider() + public static function requestMethodProvider(): array { return [ ['POST'], diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php index 5253058527516..a34a1f403343f 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php @@ -36,7 +36,7 @@ protected function tearDown(): void $this->transformerWithNull = null; } - public static function transformProvider() + public static function transformProvider(): array { return [ // more extensive test set can be found in FormUtilTest diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php index 81e1885aa57fb..1a978737f982e 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php @@ -20,9 +20,9 @@ */ class DateIntervalToStringTransformerTest extends DateIntervalTestCase { - public static function dataProviderISO() + public static function dataProviderISO(): array { - $data = [ + return [ ['P%YY%MM%DDT%HH%IM%SS', 'P00Y00M00DT00H00M00S', 'PT0S'], ['P%yY%mM%dDT%hH%iM%sS', 'P0Y0M0DT0H0M0S', 'PT0S'], ['P%yY%mM%dDT%hH%iM%sS', 'P10Y2M3DT16H5M6S', 'P10Y2M3DT16H5M6S'], @@ -30,13 +30,11 @@ public static function dataProviderISO() ['P%yY%mM%dDT%hH', 'P10Y2M3DT16H', 'P10Y2M3DT16H'], ['P%yY%mM%dD', 'P10Y2M3D', 'P10Y2M3DT0H'], ]; - - return $data; } - public static function dataProviderDate() + public static function dataProviderDate(): array { - $data = [ + return [ [ '%y years %m months %d days %h hours %i minutes %s seconds', '10 years 2 months 3 days 16 hours 5 minutes 6 seconds', @@ -52,8 +50,6 @@ public static function dataProviderDate() ['%y years %m months', '10 years 2 months', 'P10Y2M'], ['%y year', '1 year', 'P1Y'], ]; - - return $data; } /** diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformerTest.php index 800120ae98daa..04f8e74a4a750 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformerTest.php @@ -30,7 +30,7 @@ public function testTransform(\DateTime $expectedOutput, \DateTimeImmutable $inp $this->assertEquals($expectedOutput->getTimezone(), $actualOutput->getTimezone()); } - public static function provider() + public static function provider(): array { return [ [ diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php index 8dffb13e2f927..06f04150c6014 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php @@ -20,7 +20,7 @@ class DateTimeToHtml5LocalDateTimeTransformerTest extends BaseDateTimeTransforme { use DateTimeEqualsTrait; - public static function transformProvider() + public static function transformProvider(): array { return [ ['UTC', 'UTC', '2010-02-03 04:05:06 UTC', '2010-02-03T04:05:06'], @@ -32,7 +32,7 @@ public static function transformProvider() ]; } - public static function reverseTransformProvider() + public static function reverseTransformProvider(): array { return [ // format without seconds, as appears in some browsers diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php index 18005e0ed5559..1e9534fc70a7a 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php @@ -37,7 +37,7 @@ protected function tearDown(): void $this->dateTimeWithoutSeconds = null; } - public static function allProvider() + public static function allProvider(): array { return [ ['UTC', 'UTC', '2010-02-03 04:05:06 UTC', '2010-02-03T04:05:06Z'], diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php index 34fbd9571cfce..6afa4c35d8248 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php @@ -95,7 +95,7 @@ public function testReverseTransform() $this->assertEquals(2, $transformer->reverseTransform('200')); } - public static function reverseTransformWithRoundingProvider() + public static function reverseTransformWithRoundingProvider(): array { return [ // towards positive infinity (1.6 -> 2, -1.6 -> -1) diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php index 2cb20e1cbb6c5..4682c40e39276 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php @@ -166,7 +166,7 @@ function ($value) { $this->assertEquals($checked, $view->vars['checked']); } - public static function provideCustomModelTransformerData() + public static function provideCustomModelTransformerData(): array { return [ ['checked', true], @@ -186,7 +186,7 @@ public function testCustomFalseValues($falseValue) $this->assertFalse($form->getData()); } - public static function provideCustomFalseValues() + public static function provideCustomFalseValues(): array { return [ [''], diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ColorTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ColorTypeTest.php index dbbc1579ff521..52382cea20648 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ColorTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ColorTypeTest.php @@ -33,7 +33,7 @@ public function testValidationShouldPass(bool $html5, ?string $submittedValue) $this->assertEmpty($form->getErrors()); } - public static function validationShouldPassProvider() + public static function validationShouldPassProvider(): array { return [ [false, 'foo'], @@ -71,7 +71,7 @@ public function testValidationShouldFail(string $expectedValueParameterValue, ?s $this->assertEquals([$expectedFormError], iterator_to_array($form->getErrors())); } - public static function validationShouldFailProvider() + public static function validationShouldFailProvider(): array { return [ ['foo', 'foo'], diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateIntervalTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateIntervalTypeTest.php index cabb5ea5f5f35..58e242234d70e 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateIntervalTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateIntervalTypeTest.php @@ -440,7 +440,7 @@ public function testSubmitNullUsesDateEmptyData($widget, $emptyData, $expectedDa $this->assertEquals($expectedData, $form->getData()); } - public static function provideEmptyData() + public static function provideEmptyData(): array { $expectedData = new \DateInterval('P6Y4M'); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ExtendedChoiceTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ExtendedChoiceTypeTest.php index 246864bdfde0d..122ff44b5d4d8 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ExtendedChoiceTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ExtendedChoiceTypeTest.php @@ -58,7 +58,7 @@ public function testChoiceLoaderIsOverridden($type) $this->assertSame('lazy_b', $choices[1]->value); } - public static function provideTestedTypes() + public static function provideTestedTypes(): iterable { yield [CountryTypeTest::TESTED_TYPE]; yield [CurrencyTypeTest::TESTED_TYPE]; diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php index e39a96c25f5d7..b7f3332c1edf9 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php @@ -183,7 +183,7 @@ public function testSubmitNonArrayValueWhenMultiple(RequestHandlerInterface $req $this->assertSame([], $form->getViewData()); } - public static function requestHandlerProvider() + public static function requestHandlerProvider(): array { return [ [new HttpFoundationRequestHandler()], diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TextTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TextTypeTest.php index 7e565c7c9fcef..e14a816362945 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TextTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TextTypeTest.php @@ -32,7 +32,7 @@ public function testSubmitNullReturnsNullWithEmptyDataAsString() $this->assertSame('', $form->getViewData()); } - public static function provideZeros() + public static function provideZeros(): array { return [ [0, '0'], diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/WeekTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/WeekTypeTest.php index b093513b75f4c..a69b96a38ad88 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/WeekTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/WeekTypeTest.php @@ -313,7 +313,7 @@ public function testSubmitNullUsesDateEmptyDataString($widget, $emptyData, $expe $this->assertSame($expectedData, $form->getData()); } - public static function provideEmptyData() + public static function provideEmptyData(): array { return [ 'Compound text field' => ['text', ['year' => '2019', 'week' => '1'], ['year' => 2019, 'week' => 1]], diff --git a/src/Symfony/Component/Form/Tests/FormErrorIteratorTest.php b/src/Symfony/Component/Form/Tests/FormErrorIteratorTest.php index 10f8766c52037..8e9ecac51b712 100644 --- a/src/Symfony/Component/Form/Tests/FormErrorIteratorTest.php +++ b/src/Symfony/Component/Form/Tests/FormErrorIteratorTest.php @@ -55,7 +55,7 @@ public function testFindByCodes($code, $violationsCount) $this->assertCount($violationsCount, $specificFormErrors); } - public static function findByCodesProvider() + public static function findByCodesProvider(): array { return [ ['code1', 2], diff --git a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php index ca943fed53a0b..4d4aa5f30b228 100644 --- a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php +++ b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php @@ -192,7 +192,7 @@ public function testBlockPrefixDefaultsToFQCNIfNoName($typeClass, $blockPrefix) $this->assertSame($blockPrefix, $resolvedType->getBlockPrefix()); } - public static function provideTypeClassBlockPrefixTuples() + public static function provideTypeClassBlockPrefixTuples(): array { return [ [Fixtures\FooType::class, 'foo'], diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php index 0f9556b1a572e..624d0a4fe817a 100644 --- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php +++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php @@ -86,7 +86,7 @@ public function testGetPropertyPath($name, $propertyPath) $this->assertEquals($propertyPath, $form->getPropertyPath()); } - public static function provideFormNames() + public static function provideFormNames(): iterable { yield [null, null]; yield ['', null]; diff --git a/src/Symfony/Component/Form/Tests/Util/StringUtilTest.php b/src/Symfony/Component/Form/Tests/Util/StringUtilTest.php index 353e3c9667285..8199d6843ed8a 100644 --- a/src/Symfony/Component/Form/Tests/Util/StringUtilTest.php +++ b/src/Symfony/Component/Form/Tests/Util/StringUtilTest.php @@ -16,7 +16,7 @@ class StringUtilTest extends TestCase { - public static function trimProvider() + public static function trimProvider(): array { return [ [' Foo! ', 'Foo!'], @@ -49,7 +49,7 @@ public function testTrimUtf8Separators($hex) $this->assertSame("ab\ncd", StringUtil::trim($symbol)); } - public static function spaceProvider() + public static function spaceProvider(): array { return [ // separators @@ -97,7 +97,7 @@ public function testFqcnToBlockPrefix($fqcn, $expectedBlockPrefix) $this->assertSame($expectedBlockPrefix, $blockPrefix); } - public static function fqcnToBlockPrefixProvider() + public static function fqcnToBlockPrefixProvider(): array { return [ ['TYPE', 'type'], diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php index 94e94a62bce13..fe59e098bdbf5 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php @@ -31,9 +31,9 @@ protected function setUp(): void $this->normalizer = new DateIntervalNormalizer(); } - public static function dataProviderISO() + public static function dataProviderISO(): array { - $data = [ + return [ ['P%YY%MM%DDT%HH%IM%SS', 'P00Y00M00DT00H00M00S', 'PT0S'], ['P%yY%mM%dDT%hH%iM%sS', 'P0Y0M0DT0H0M0S', 'PT0S'], ['P%yY%mM%dDT%hH%iM%sS', 'P10Y2M3DT16H5M6S', 'P10Y2M3DT16H5M6S'], @@ -46,8 +46,6 @@ public static function dataProviderISO() ['%rP%yY%mM%dD', '-P10Y2M3D', '-P10Y2M3DT0H'], ['%rP%yY%mM%dD', 'P10Y2M3D', 'P10Y2M3DT0H'], ]; - - return $data; } public function testSupportsNormalization() diff --git a/src/Symfony/Component/Uid/Tests/Command/GenerateUuidCommandTest.php b/src/Symfony/Component/Uid/Tests/Command/GenerateUuidCommandTest.php index a0ee281c243b6..cbe4429ff0d42 100644 --- a/src/Symfony/Component/Uid/Tests/Command/GenerateUuidCommandTest.php +++ b/src/Symfony/Component/Uid/Tests/Command/GenerateUuidCommandTest.php @@ -132,7 +132,7 @@ public function testInvalidCombinationOfBasedOptions(array $input) $this->assertStringContainsString('Only one of "--time-based", "--name-based" or "--random-based"', $commandTester->getDisplay()); } - public static function provideInvalidCombinationOfBasedOptions() + public static function provideInvalidCombinationOfBasedOptions(): array { return [ [['--time-based' => 'now', '--name-based' => 'foo']], @@ -153,7 +153,7 @@ public function testExtraNodeOption(array $input) $this->assertStringContainsString('Option "--node" can only be used with "--time-based"', $commandTester->getDisplay()); } - public static function provideExtraNodeOption() + public static function provideExtraNodeOption(): array { return [ [['--node' => 'foo']], @@ -173,7 +173,7 @@ public function testExtraNamespaceOption(array $input) $this->assertStringContainsString('Option "--namespace" can only be used with "--name-based"', $commandTester->getDisplay()); } - public static function provideExtraNamespaceOption() + public static function provideExtraNamespaceOption(): array { return [ [['--namespace' => 'foo']], diff --git a/src/Symfony/Component/Uid/Tests/UlidTest.php b/src/Symfony/Component/Uid/Tests/UlidTest.php index 27f06645fccb2..192669c621366 100644 --- a/src/Symfony/Component/Uid/Tests/UlidTest.php +++ b/src/Symfony/Component/Uid/Tests/UlidTest.php @@ -149,7 +149,7 @@ public function testFromBinaryInvalidFormat(string $ulid) Ulid::fromBinary($ulid); } - public static function provideInvalidBinaryFormat() + public static function provideInvalidBinaryFormat(): array { return [ ['01EW2RYKDCT2SAK454KBR2QG08'], @@ -176,7 +176,7 @@ public function testFromBase58InvalidFormat(string $ulid) Ulid::fromBase58($ulid); } - public static function provideInvalidBase58Format() + public static function provideInvalidBase58Format(): array { return [ ["\x01\x77\x05\x8F\x4D\xAC\xD0\xB2\xA9\x90\xA4\x9A\xF0\x2B\xC0\x08"], @@ -203,7 +203,7 @@ public function testFromBase32InvalidFormat(string $ulid) Ulid::fromBase32($ulid); } - public static function provideInvalidBase32Format() + public static function provideInvalidBase32Format(): array { return [ ["\x01\x77\x05\x8F\x4D\xAC\xD0\xB2\xA9\x90\xA4\x9A\xF0\x2B\xC0\x08"], @@ -230,7 +230,7 @@ public function testFromRfc4122InvalidFormat(string $ulid) Ulid::fromRfc4122($ulid); } - public static function provideInvalidRfc4122Format() + public static function provideInvalidRfc4122Format(): array { return [ ["\x01\x77\x05\x8F\x4D\xAC\xD0\xB2\xA9\x90\xA4\x9A\xF0\x2B\xC0\x08"], diff --git a/src/Symfony/Component/Uid/Tests/UuidTest.php b/src/Symfony/Component/Uid/Tests/UuidTest.php index dbf5ea03c1375..1affd73af47f2 100644 --- a/src/Symfony/Component/Uid/Tests/UuidTest.php +++ b/src/Symfony/Component/Uid/Tests/UuidTest.php @@ -206,7 +206,7 @@ public function testEqualsAgainstOtherType($other) $this->assertFalse((new UuidV4(self::A_UUID_V4))->equals($other)); } - public static function provideInvalidEqualType() + public static function provideInvalidEqualType(): iterable { yield [null]; yield [self::A_UUID_V1]; @@ -268,7 +268,7 @@ public function testFromBinaryInvalidFormat(string $ulid) Uuid::fromBinary($ulid); } - public static function provideInvalidBinaryFormat() + public static function provideInvalidBinaryFormat(): array { return [ ['01EW2RYKDCT2SAK454KBR2QG08'], @@ -295,7 +295,7 @@ public function testFromBase58InvalidFormat(string $ulid) Uuid::fromBase58($ulid); } - public static function provideInvalidBase58Format() + public static function provideInvalidBase58Format(): array { return [ ["\x41\x4C\x08\x92\x57\x1B\x11\xEB\xBF\x70\x93\xF9\xB0\x82\x2C\x57"], @@ -322,7 +322,7 @@ public function testFromBase32InvalidFormat(string $ulid) Uuid::fromBase32($ulid); } - public static function provideInvalidBase32Format() + public static function provideInvalidBase32Format(): array { return [ ["\x5B\xA8\x32\x72\x45\x6D\x5A\xC0\xAB\xE3\xAA\x8B\xF7\x01\x96\x73"], @@ -349,7 +349,7 @@ public function testFromRfc4122InvalidFormat(string $ulid) Uuid::fromRfc4122($ulid); } - public static function provideInvalidRfc4122Format() + public static function provideInvalidRfc4122Format(): array { return [ ["\x1E\xB5\x71\xB4\x14\xC0\x68\x93\xBF\x70\x2D\x4C\x83\xCF\x75\x5A"],