diff --git a/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php b/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php index afc49ed575bf1..5f161358cf9c6 100644 --- a/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php +++ b/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php @@ -28,10 +28,8 @@ final class TestRepositoryFactory implements RepositoryFactory /** * {@inheritdoc} - * - * @return ObjectRepository */ - public function getRepository(EntityManagerInterface $entityManager, $entityName) + public function getRepository(EntityManagerInterface $entityManager, $entityName): ObjectRepository { $repositoryHash = $this->getRepositoryHash($entityManager, $entityName); diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php index 1efdf31abf097..0c1a67967d118 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php @@ -257,10 +257,7 @@ protected function invokeLoadCacheDriver(array $objectManager, ContainerBuilder $method->invokeArgs($this->extension, [$objectManager, $container, $cacheName]); } - /** - * @return \Symfony\Component\DependencyInjection\ContainerBuilder - */ - protected function createContainer(array $data = []) + protected function createContainer(array $data = []): ContainerBuilder { return new ContainerBuilder(new ParameterBag(array_merge([ 'kernel.bundles' => ['FrameworkBundle' => 'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle'], diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/BaseUser.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/BaseUser.php index 50b5845581ce4..49c13e0d310e3 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/BaseUser.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/BaseUser.php @@ -24,9 +24,6 @@ class BaseUser /** * BaseUser constructor. - * - * @param int $id - * @param string $username */ public function __construct(int $id, string $username) { @@ -42,10 +39,7 @@ public function getId() return $this->id; } - /** - * @return string - */ - public function getUsername() + public function getUsername(): string { return $this->username; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeObjectNoToStringIdEntity.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeObjectNoToStringIdEntity.php index ac97367094bd5..82811b89ed8c0 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeObjectNoToStringIdEntity.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeObjectNoToStringIdEntity.php @@ -35,18 +35,12 @@ public function __construct(SingleIntIdNoToStringEntity $objectOne, SingleIntIdN $this->objectTwo = $objectTwo; } - /** - * @return SingleIntIdNoToStringEntity - */ - public function getObjectOne() + public function getObjectOne(): SingleIntIdNoToStringEntity { return $this->objectOne; } - /** - * @return SingleIntIdNoToStringEntity - */ - public function getObjectTwo() + public function getObjectTwo(): SingleIntIdNoToStringEntity { return $this->objectTwo; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapper.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapper.php index d46798aa84bb4..941ab3ed48ee8 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapper.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapper.php @@ -20,10 +20,7 @@ public function __construct(string $string = null) $this->string = $string; } - /** - * @return string - */ - public function getString() + public function getString(): string { return $this->string; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapperType.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapperType.php index 9e1cd621fe2a1..d3c93d195688c 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapperType.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapperType.php @@ -34,10 +34,8 @@ public function convertToPHPValue($value, AbstractPlatform $platform) /** * {@inheritdoc} - * - * @return string */ - public function getName() + public function getName(): string { return 'string_wrapper'; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/User.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/User.php index c2ad425b61eac..c5cbc662fc1d1 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/User.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/User.php @@ -35,19 +35,19 @@ public function __construct($id1, $id2, $name) $this->name = $name; } - public function getRoles() + public function getRoles(): array { } - public function getPassword() + public function getPassword(): ?string { } - public function getSalt() + public function getSalt(): ?string { } - public function getUsername() + public function getUsername(): string { return $this->name; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php b/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php index 624e5a5a34692..81f197f93c53e 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php @@ -51,7 +51,7 @@ public function setTestContainer($container) $this->container = $container; } - public function getAliasNamespace($alias) + public function getAliasNamespace($alias): string { return 'Foo'; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php index 1249bd5193e08..a66339649313c 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php +++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php @@ -27,20 +27,16 @@ class DoctrineFooType extends Type /** * {@inheritdoc} - * - * @return string */ - public function getName() + public function getName(): string { return self::NAME; } /** * {@inheritdoc} - * - * @return string */ - public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) + public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string { return $platform->getClobTypeDeclarationSQL([]); } @@ -80,10 +76,8 @@ public function convertToPHPValue($value, AbstractPlatform $platform) /** * {@inheritdoc} - * - * @return bool */ - public function requiresSQLCommentHint(AbstractPlatform $platform) + public function requiresSQLCommentHint(AbstractPlatform $platform): bool { return true; } diff --git a/src/Symfony/Bridge/Monolog/Tests/Formatter/ConsoleFormatterTest.php b/src/Symfony/Bridge/Monolog/Tests/Formatter/ConsoleFormatterTest.php index c09597e916cfc..89d5bee454548 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Formatter/ConsoleFormatterTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Formatter/ConsoleFormatterTest.php @@ -26,10 +26,7 @@ public function testFormat(array $record, $expectedMessage) self::assertSame($expectedMessage, $formatter->format($record)); } - /** - * @return array - */ - public function providerFormatTests() + public function providerFormatTests(): array { $currentDateTime = new \DateTime(); diff --git a/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php index 143200f6c5718..be4781d67f90c 100644 --- a/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php @@ -148,9 +148,9 @@ public function testInheritedClassCallCountErrorsWithoutArgument() class ClassThatInheritLogger extends Logger { - public function getLogs() + public function getLogs(): array { - parent::getLogs(); + return parent::getLogs(); } public function countErrors() diff --git a/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php b/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php index 9aceb9337e403..ef859df0cdc21 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php @@ -99,9 +99,9 @@ private function getRecord($level = Logger::WARNING, $message = 'test') class ClassThatInheritDebugProcessor extends DebugProcessor { - public function getLogs() + public function getLogs(): array { - parent::getLogs(); + return parent::getLogs(); } public function countErrors() diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php index da653a7b4d850..33ea1cdcecde0 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php @@ -173,10 +173,7 @@ protected function createProxy(\$class, \Closure \$factory) $this->assertSame(123, @$foo->dynamicProp); } - /** - * @return array - */ - public function getProxyCandidates() + public function getProxyCandidates(): array { $definitions = [ [new Definition(__CLASS__), true], diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/StubTranslator.php b/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/StubTranslator.php index 9abd707b40e0e..2c8c7db10d861 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/StubTranslator.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/StubTranslator.php @@ -15,7 +15,7 @@ class StubTranslator implements TranslatorInterface { - public function trans($id, array $parameters = [], $domain = null, $locale = null) + public function trans($id, array $parameters = [], $domain = null, $locale = null): string { return '[trans]'.strtr($id, $parameters).'[/trans]'; } diff --git a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php index 80d93c0581090..5cbf43688bdc6 100644 --- a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php @@ -123,10 +123,7 @@ public function testExtractSyntaxError($resources) } } - /** - * @return array - */ - public function resourcesWithSyntaxErrorsProvider() + public function resourcesWithSyntaxErrorsProvider(): array { return [ [__DIR__.'/../Fixtures'], @@ -157,10 +154,7 @@ public function testExtractWithFiles($resource) $this->assertEquals('Hi!', $catalogue->get('Hi!', 'messages')); } - /** - * @return array - */ - public function resourceProvider() + public function resourceProvider(): array { $directory = __DIR__.'/../Fixtures/extractor/'; diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php b/src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php index f0fcb38ee1842..ee97ad0a695ca 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php @@ -97,6 +97,8 @@ public function has($id): bool /** * {@inheritdoc} + * + * @return object|null */ public function get($id, $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERENCE */ 1) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php index cf9ca2f7e5aab..678d573586f3a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php @@ -19,14 +19,14 @@ class TestAppKernel extends Kernel { - public function registerBundles() + public function registerBundles(): iterable { return [ new FrameworkBundle(), ]; } - public function getProjectDir() + public function getProjectDir(): string { return __DIR__.'/test'; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php index d5491e8e345cd..2b8bb343172d8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php @@ -202,7 +202,7 @@ public static function staticMethod() class RouteStub extends Route { - public function compile() + public function compile(): CompiledRoute { return new CompiledRoute('', '#PATH_REGEX#', [], [], '#HOST_REGEX#'); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php index d78e0c24924e8..138a0e4bbc27a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php @@ -108,7 +108,7 @@ public function getNotImplementingTranslatorBagInterfaceTranslatorClassNames() class TranslatorWithTranslatorBag implements TranslatorInterface { - public function trans($id, array $parameters = [], $domain = null, $locale = null) + public function trans($id, array $parameters = [], $domain = null, $locale = null): string { } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/CustomPathBundle/src/CustomPathBundle.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/CustomPathBundle/src/CustomPathBundle.php index 166b606a459e2..ad7194de97b0e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/CustomPathBundle/src/CustomPathBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/CustomPathBundle/src/CustomPathBundle.php @@ -15,7 +15,7 @@ class CustomPathBundle extends Bundle { - public function getPath() + public function getPath(): string { return __DIR__.'/..'; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php index 7e8b50f36739d..0b1cc7e65fd56 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php @@ -13,6 +13,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\HttpKernel\KernelInterface; abstract class AbstractWebTestCase extends BaseWebTestCase { @@ -42,14 +43,14 @@ protected static function deleteTmpDir() $fs->remove($dir); } - protected static function getKernelClass() + protected static function getKernelClass(): string { require_once __DIR__.'/app/AppKernel.php'; return 'Symfony\Bundle\FrameworkBundle\Tests\Functional\app\AppKernel'; } - protected static function createKernel(array $options = []) + protected static function createKernel(array $options = []): KernelInterface { $class = self::getKernelClass(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php index e0bf9e34dfeac..f6149ea874f8d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AutowiringTypesTest.php @@ -17,6 +17,7 @@ use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher; +use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Templating\EngineInterface as ComponentEngineInterface; class AutowiringTypesTest extends AbstractWebTestCase @@ -70,7 +71,7 @@ public function testCacheAutowiring() $this->assertInstanceOf(FilesystemAdapter::class, $autowiredServices->getCachePool()); } - protected static function createKernel(array $options = []) + protected static function createKernel(array $options = []): KernelInterface { return parent::createKernel(['test_case' => 'AutowiringTypes'] + $options); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/Configuration.php index 9022bc24c26de..fb70137ff7b22 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/Configuration.php @@ -23,7 +23,7 @@ public function __construct($customConfig = null) $this->customConfig = $customConfig; } - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('test'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php index 59670fdd19a24..b9b22e90b41e5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection; +use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; @@ -42,7 +43,7 @@ public function prepend(ContainerBuilder $container) /** * {@inheritdoc} */ - public function getConfiguration(array $config, ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface { return new Configuration($this->customConfig); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransSubscriberService.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransSubscriberService.php index 449b35f5e9450..5738ab094b34c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransSubscriberService.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TransDebug/TransSubscriberService.php @@ -24,7 +24,7 @@ public function __construct(ContainerInterface $container) $this->container = $container; } - public static function getSubscribedServices() + public static function getSubscribedServices(): array { return ['translator' => TranslatorInterface::class]; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php index ea1ce9f3266d4..2adf5b1dd56e5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php @@ -15,6 +15,7 @@ use Symfony\Component\Cache\Adapter\RedisAdapter; use Symfony\Component\Cache\Adapter\TagAwareAdapter; use Symfony\Component\Cache\Exception\InvalidArgumentException; +use Symfony\Component\HttpKernel\KernelInterface; class CachePoolsTest extends AbstractWebTestCase { @@ -116,7 +117,7 @@ private function doTestCachePools($options, $adapterClass) $this->assertNotInstanceof(TagAwareAdapter::class, $pool7); } - protected static function createKernel(array $options = []) + protected static function createKernel(array $options = []): KernelInterface { return parent::createKernel(['test_case' => 'CachePools'] + $options); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php index 0c4d03bfc11af..0ea364b196940 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php @@ -45,7 +45,7 @@ public function __construct($varDir, $testCase, $rootConfig, $environment, $debu parent::__construct($environment, $debug); } - public function registerBundles() + public function registerBundles(): iterable { if (!file_exists($filename = $this->getProjectDir().'/'.$this->testCase.'/bundles.php')) { throw new \RuntimeException(sprintf('The bundles file "%s" does not exist.', $filename)); @@ -54,17 +54,17 @@ public function registerBundles() return include $filename; } - public function getProjectDir() + public function getProjectDir(): string { return __DIR__; } - public function getCacheDir() + public function getCacheDir(): string { return sys_get_temp_dir().'/'.$this->varDir.'/'.$this->testCase.'/cache/'.$this->environment; } - public function getLogDir() + public function getLogDir(): string { return sys_get_temp_dir().'/'.$this->varDir.'/'.$this->testCase.'/logs'; } @@ -89,7 +89,7 @@ public function __wakeup() $this->__construct($this->varDir, $this->testCase, $this->rootConfig, $this->environment, $this->debug); } - protected function getKernelParameters() + protected function getKernelParameters(): array { $parameters = parent::getKernelParameters(); $parameters['kernel.test_case'] = $this->testCase; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php index e765c6c23b3c7..7e6bb3481064c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php @@ -47,19 +47,19 @@ public function dangerousAction() throw new Danger(); } - public function registerBundles() + public function registerBundles(): iterable { return [ new FrameworkBundle(), ]; } - public function getCacheDir() + public function getCacheDir(): string { return $this->cacheDir = sys_get_temp_dir().'/sf_micro_kernel'; } - public function getLogDir() + public function getLogDir(): string { return $this->cacheDir; } @@ -100,7 +100,7 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::EXCEPTION => 'onKernelException', diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Fixtures/StubTemplateNameParser.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Fixtures/StubTemplateNameParser.php index 9835bc2a228ea..e6b8105806c71 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Fixtures/StubTemplateNameParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Fixtures/StubTemplateNameParser.php @@ -13,6 +13,7 @@ use Symfony\Component\Templating\TemplateNameParserInterface; use Symfony\Component\Templating\TemplateReference; +use Symfony\Component\Templating\TemplateReferenceInterface; class StubTemplateNameParser implements TemplateNameParserInterface { @@ -26,7 +27,7 @@ public function __construct($root, $rootTheme) $this->rootTheme = $rootTheme; } - public function parse($name) + public function parse($name): TemplateReferenceInterface { list($bundle, $controller, $template) = explode(':', $name, 3); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Fixtures/StubTranslator.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Fixtures/StubTranslator.php index 402b3a886c74b..2f051f035e548 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Fixtures/StubTranslator.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Fixtures/StubTranslator.php @@ -15,7 +15,7 @@ class StubTranslator implements TranslatorInterface { - public function trans($id, array $parameters = [], $domain = null, $locale = null) + public function trans($id, array $parameters = [], $domain = null, $locale = null): string { return '[trans]'.strtr($id, $parameters).'[/trans]'; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php index 62062018ca818..77cbeb59980b4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php @@ -58,10 +58,8 @@ public function testGetInvalidHelper() /** * Creates a Container with a Session-containing Request service. - * - * @return Container */ - protected function getContainer() + protected function getContainer(): Container { $container = new Container(); $session = new Session(new MockArraySessionStorage()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php index 10265acd5ed5b..0c243222ae05d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php @@ -410,7 +410,7 @@ class TranslatorWithInvalidLocale extends Translator /** * {@inheritdoc} */ - public function getLocale() + public function getLocale(): string { return 'invalid locale'; } diff --git a/src/Symfony/Bundle/SecurityBundle/SecurityUserValueResolver.php b/src/Symfony/Bundle/SecurityBundle/SecurityUserValueResolver.php index 476e24ee4e456..25a9244f2fc35 100644 --- a/src/Symfony/Bundle/SecurityBundle/SecurityUserValueResolver.php +++ b/src/Symfony/Bundle/SecurityBundle/SecurityUserValueResolver.php @@ -37,7 +37,7 @@ public function __construct(TokenStorageInterface $tokenStorage) $this->tokenStorage = $tokenStorage; } - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { // only security user implementations are supported if (UserInterface::class !== $argument->getType()) { @@ -55,7 +55,7 @@ public function supports(Request $request, ArgumentMetadata $argument) return $user instanceof UserInterface; } - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { yield $this->tokenStorage->getToken()->getUser(); } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php index 61d0081200b72..010b6219d8f9e 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php @@ -13,6 +13,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\HttpKernel\KernelInterface; abstract class AbstractWebTestCase extends BaseWebTestCase { @@ -42,14 +43,14 @@ protected static function deleteTmpDir() $fs->remove($dir); } - protected static function getKernelClass() + protected static function getKernelClass(): string { require_once __DIR__.'/app/AppKernel.php'; return 'Symfony\Bundle\SecurityBundle\Tests\Functional\app\AppKernel'; } - protected static function createKernel(array $options = []) + protected static function createKernel(array $options = []): KernelInterface { $class = self::getKernelClass(); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php index d0a6e0674802c..9d17b13a10b6f 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional; +use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Security\Core\Authorization\AccessDecisionManager; use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager; @@ -29,7 +30,7 @@ public function testAccessDecisionManagerAutowiring() $this->assertInstanceOf(TraceableAccessDecisionManager::class, $autowiredServices->getAccessDecisionManager(), 'The debug.security.access.decision_manager service should be injected in non-debug mode'); } - protected static function createKernel(array $options = []) + protected static function createKernel(array $options = []): KernelInterface { return parent::createKernel(['test_case' => 'AutowiringTypes'] + $options); } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Security/EntryPointStub.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Security/EntryPointStub.php index e1d3280570d88..816457bdc8044 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Security/EntryPointStub.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Security/EntryPointStub.php @@ -20,7 +20,7 @@ class EntryPointStub implements AuthenticationEntryPointInterface { const RESPONSE_TEXT = '2be8e651259189d841a19eecdf37e771e2431741'; - public function start(Request $request, AuthenticationException $authException = null) + public function start(Request $request, AuthenticationException $authException = null): Response { return new Response(self::RESPONSE_TEXT); } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Security/LocalizedFormFailureHandler.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Security/LocalizedFormFailureHandler.php index f8f1c450d3963..afb4648d36c69 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Security/LocalizedFormFailureHandler.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Security/LocalizedFormFailureHandler.php @@ -13,6 +13,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\RouterInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; @@ -27,7 +28,7 @@ public function __construct(RouterInterface $router) $this->router = $router; } - public function onAuthenticationFailure(Request $request, AuthenticationException $exception) + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response { return new RedirectResponse($this->router->generate('localized_login_path', [], UrlGeneratorInterface::ABSOLUTE_URL)); } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/JsonLoginBundle/Security/Http/JsonAuthenticationFailureHandler.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/JsonLoginBundle/Security/Http/JsonAuthenticationFailureHandler.php index 737c5a5abec00..26ba36e3d3dd7 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/JsonLoginBundle/Security/Http/JsonAuthenticationFailureHandler.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/JsonLoginBundle/Security/Http/JsonAuthenticationFailureHandler.php @@ -13,12 +13,13 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface; class JsonAuthenticationFailureHandler implements AuthenticationFailureHandlerInterface { - public function onAuthenticationFailure(Request $request, AuthenticationException $exception) + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response { return new JsonResponse(['message' => 'Something went wrong'], 500); } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/JsonLoginBundle/Security/Http/JsonAuthenticationSuccessHandler.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/JsonLoginBundle/Security/Http/JsonAuthenticationSuccessHandler.php index 0390eb8e35eba..a0300d4d78387 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/JsonLoginBundle/Security/Http/JsonAuthenticationSuccessHandler.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/JsonLoginBundle/Security/Http/JsonAuthenticationSuccessHandler.php @@ -13,12 +13,13 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; class JsonAuthenticationSuccessHandler implements AuthenticationSuccessHandlerInterface { - public function onAuthenticationSuccess(Request $request, TokenInterface $token) + public function onAuthenticationSuccess(Request $request, TokenInterface $token): Response { return new JsonResponse(['message' => sprintf('Good game @%s!', $token->getUsername())]); } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php index f5b85e0c059e2..8e622282c2c1d 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php @@ -46,12 +46,12 @@ public function __construct($varDir, $testCase, $rootConfig, $environment, $debu /** * {@inheritdoc} */ - public function getContainerClass() + public function getContainerClass(): string { return parent::getContainerClass().substr(md5($this->rootConfig), -16); } - public function registerBundles() + public function registerBundles(): iterable { if (!is_file($filename = $this->getProjectDir().'/'.$this->testCase.'/bundles.php')) { throw new \RuntimeException(sprintf('The bundles file "%s" does not exist.', $filename)); @@ -60,17 +60,17 @@ public function registerBundles() return include $filename; } - public function getProjectDir() + public function getProjectDir(): string { return __DIR__; } - public function getCacheDir() + public function getCacheDir(): string { return sys_get_temp_dir().'/'.$this->varDir.'/'.$this->testCase.'/cache/'.$this->environment; } - public function getLogDir() + public function getLogDir(): string { return sys_get_temp_dir().'/'.$this->varDir.'/'.$this->testCase.'/logs'; } @@ -91,7 +91,7 @@ public function unserialize($str) $this->__construct($a[0], $a[1], $a[2], $a[3], $a[4]); } - protected function getKernelParameters() + protected function getKernelParameters(): array { $parameters = parent::getKernelParameters(); $parameters['kernel.test_case'] = $this->testCase; diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php index 6ecc0c3b89b4e..b397d3abace14 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php @@ -79,12 +79,12 @@ public function __construct($withTemplating) parent::__construct(($withTemplating ? 'with' : 'without').'_templating', true); } - public function getName() + public function getName(): string { return 'CacheWarming'; } - public function registerBundles() + public function registerBundles(): iterable { return [new FrameworkBundle(), new TwigBundle()]; } @@ -116,17 +116,17 @@ public function registerContainerConfiguration(LoaderInterface $loader) } } - public function getProjectDir() + public function getProjectDir(): string { return __DIR__; } - public function getCacheDir() + public function getCacheDir(): string { return sys_get_temp_dir().'/'.Kernel::VERSION.'/CacheWarmingKernel/cache/'.$this->environment; } - public function getLogDir() + public function getLogDir(): string { return sys_get_temp_dir().'/'.Kernel::VERSION.'/CacheWarmingKernel/logs'; } diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/EmptyAppTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/EmptyAppTest.php index d2a3ab68f9d70..e9063f94652cf 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/EmptyAppTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/EmptyAppTest.php @@ -32,7 +32,7 @@ public function testBootEmptyApp() class EmptyAppKernel extends Kernel { - public function registerBundles() + public function registerBundles(): iterable { return [new TwigBundle()]; } @@ -49,12 +49,12 @@ public function registerContainerConfiguration(LoaderInterface $loader) }); } - public function getCacheDir() + public function getCacheDir(): string { return sys_get_temp_dir().'/'.Kernel::VERSION.'/EmptyAppKernel/cache/'.$this->environment; } - public function getLogDir() + public function getLogDir(): string { return sys_get_temp_dir().'/'.Kernel::VERSION.'/EmptyAppKernel/logs'; } diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php index 25dc8c8736aba..75bc4297b1cb2 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php @@ -53,7 +53,7 @@ protected function deleteTempDir() class NoTemplatingEntryKernel extends Kernel { - public function registerBundles() + public function registerBundles(): iterable { return [new FrameworkBundle(), new TwigBundle()]; } @@ -75,12 +75,12 @@ public function registerContainerConfiguration(LoaderInterface $loader) }); } - public function getCacheDir() + public function getCacheDir(): string { return sys_get_temp_dir().'/'.Kernel::VERSION.'/NoTemplatingEntryKernel/cache/'.$this->environment; } - public function getLogDir() + public function getLogDir(): string { return sys_get_temp_dir().'/'.Kernel::VERSION.'/NoTemplatingEntryKernel/logs'; } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php index 2c39dc73e8438..5cdc50224c1c7 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Profiler/TemplateManagerTest.php @@ -130,7 +130,7 @@ public function __construct() parent::__construct('token'); } - public function hasCollector($name) + public function hasCollector($name): bool { switch ($name) { case 'foo': diff --git a/src/Symfony/Component/BrowserKit/HttpBrowser.php b/src/Symfony/Component/BrowserKit/HttpBrowser.php index 7492e58907cb7..47f3de907e569 100644 --- a/src/Symfony/Component/BrowserKit/HttpBrowser.php +++ b/src/Symfony/Component/BrowserKit/HttpBrowser.php @@ -41,6 +41,9 @@ public function __construct(HttpClientInterface $client = null, History $history parent::__construct([], $history, $cookieJar); } + /** + * @return Response + */ protected function doRequest($request) { $headers = $this->getHeaders($request); diff --git a/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php b/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php index 0d492e92344de..518ff37af6ac9 100644 --- a/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php @@ -17,6 +17,7 @@ use Symfony\Component\BrowserKit\CookieJar; use Symfony\Component\BrowserKit\History; use Symfony\Component\BrowserKit\Response; +use Symfony\Component\DomCrawler\Crawler; use Symfony\Component\DomCrawler\Form as DomCrawlerForm; class SpecialResponse extends Response @@ -38,7 +39,7 @@ public function setNextScript($script) $this->nextScript = $script; } - protected function doRequest($request) + protected function doRequest($request): Response { if (null === $this->nextResponse) { return new Response(); @@ -50,7 +51,7 @@ protected function doRequest($request) return $response; } - protected function filterResponse($response) + protected function filterResponse($response): Response { if ($response instanceof SpecialResponse) { return new Response($response->getContent(), $response->getStatusCode(), $response->getHeaders()); @@ -934,7 +935,7 @@ public function setNextResponse(Response $response) $this->nextResponse = $response; } - protected function doRequest($request) + protected function doRequest($request): Response { if (null === $this->nextResponse) { return new Response(); @@ -946,7 +947,7 @@ protected function doRequest($request) return $response; } - public function submit(DomCrawlerForm $form, array $values = []) + public function submit(DomCrawlerForm $form, array $values = []): Crawler { return parent::submit($form, $values); } diff --git a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php index ae9f143cad2b5..3d9db8e31bdc7 100644 --- a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php @@ -58,7 +58,7 @@ public function setNextScript($script) $this->nextScript = $script; } - protected function filterResponse($response) + protected function filterResponse($response): Response { if ($response instanceof SpecialHttpResponse) { return new Response($response->getContent(), $response->getStatusCode(), $response->getHeaders()); @@ -67,7 +67,7 @@ protected function filterResponse($response) return $response; } - protected function doRequest($request) + protected function doRequest($request): Response { $response = parent::doRequest($request); diff --git a/src/Symfony/Component/Cache/CacheItem.php b/src/Symfony/Component/Cache/CacheItem.php index 0c761fd1fac0c..fe7d717fca75b 100644 --- a/src/Symfony/Component/Cache/CacheItem.php +++ b/src/Symfony/Component/Cache/CacheItem.php @@ -36,10 +36,8 @@ final class CacheItem implements ItemInterface /** * {@inheritdoc} - * - * @return string */ - public function getKey() + public function getKey(): string { return $this->key; } @@ -54,10 +52,8 @@ public function get() /** * {@inheritdoc} - * - * @return bool */ - public function isHit() + public function isHit(): bool { return $this->isHit; } @@ -153,11 +149,9 @@ public function getMetadata(): array /** * Returns the list of tags bound to the value coming from the pool storage if any. * - * @return array - * * @deprecated since Symfony 4.2, use the "getMetadata()" method instead. */ - public function getPreviousTags() + public function getPreviousTags(): array { @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the "getMetadata()" method instead.', __METHOD__), E_USER_DEPRECATED); @@ -169,11 +163,9 @@ public function getPreviousTags() * * @param string $key The key to validate * - * @return string - * * @throws InvalidArgumentException When $key is not valid */ - public static function validateKey($key) + public static function validateKey($key): string { if (!\is_string($key)) { throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given', \is_object($key) ? \get_class($key) : \gettype($key))); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTest.php index 2d1024069de50..9b77e926d495a 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\RedisAdapter; abstract class AbstractRedisAdapterTest extends AdapterTestCase @@ -23,7 +24,7 @@ abstract class AbstractRedisAdapterTest extends AdapterTestCase protected static $redis; - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { return new RedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php index 5cca73f56189d..a4673f12a21b2 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Psr\Log\NullLogger; use Symfony\Component\Cache\Adapter\ApcuAdapter; @@ -22,7 +23,7 @@ class ApcuAdapterTest extends AdapterTestCase 'testDefaultLifeTime' => 'Testing expiration slows down the test suite', ]; - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { if (!\function_exists('apcu_fetch') || !filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN)) { $this->markTestSkipped('APCu extension is required.'); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ArrayAdapterTest.php index 5c72dc6e0bc34..81f8e1470202b 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/ArrayAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/ArrayAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\ArrayAdapter; /** @@ -24,7 +25,7 @@ class ArrayAdapterTest extends AdapterTestCase 'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayAdapter is not.', ]; - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { return new ArrayAdapter($defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php index ac92006404520..02fe61480abe4 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; use PHPUnit\Framework\MockObject\MockObject; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\AdapterInterface; use Symfony\Component\Cache\Adapter\ArrayAdapter; use Symfony\Component\Cache\Adapter\ChainAdapter; @@ -25,7 +26,7 @@ */ class ChainAdapterTest extends AdapterTestCase { - public function createCachePool($defaultLifetime = 0, $testMethod = null) + public function createCachePool($defaultLifetime = 0, $testMethod = null): CacheItemPoolInterface { if ('testGetMetadata' === $testMethod) { return new ChainAdapter([new FilesystemAdapter('', $defaultLifetime)], $defaultLifetime); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/DoctrineAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/DoctrineAdapterTest.php index b5644cbc84b95..dda3019c69ffc 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/DoctrineAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/DoctrineAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\DoctrineAdapter; use Symfony\Component\Cache\Tests\Fixtures\ArrayCache; @@ -26,7 +27,7 @@ class DoctrineAdapterTest extends AdapterTestCase 'testClearPrefix' => 'Doctrine cannot clear by prefix', ]; - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { return new DoctrineAdapter(new ArrayCache($defaultLifetime), '', $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php index b7a69cb4472a2..5dbedcd444d8a 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/FilesystemAdapterTest.php @@ -19,7 +19,7 @@ */ class FilesystemAdapterTest extends AdapterTestCase { - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { return new FilesystemAdapter('', $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/FilesystemTagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/FilesystemTagAwareAdapterTest.php index 83a7ea52ddad4..76c9a5817c4c6 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/FilesystemTagAwareAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/FilesystemTagAwareAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\FilesystemTagAwareAdapter; use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait; @@ -21,7 +22,7 @@ class FilesystemTagAwareAdapterTest extends FilesystemAdapterTest { use TagAwareTestTrait; - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { return new FilesystemTagAwareAdapter('', $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php index 0aebb0e162179..8238eaea056c8 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\AbstractAdapter; use Symfony\Component\Cache\Adapter\MemcachedAdapter; @@ -38,7 +39,7 @@ public static function setUpBeforeClass(): void } } - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { $client = $defaultLifetime ? AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST')) : self::$client; diff --git a/src/Symfony/Component/Cache/Tests/Adapter/NamespacedProxyAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/NamespacedProxyAdapterTest.php index f1ffcbb823fb7..460ca0bc82162 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/NamespacedProxyAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/NamespacedProxyAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\ArrayAdapter; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\ProxyAdapter; @@ -20,7 +21,7 @@ */ class NamespacedProxyAdapterTest extends ProxyAdapterTest { - public function createCachePool($defaultLifetime = 0, $testMethod = null) + public function createCachePool($defaultLifetime = 0, $testMethod = null): CacheItemPoolInterface { if ('testGetMetadata' === $testMethod) { return new ProxyAdapter(new FilesystemAdapter(), 'foo', $defaultLifetime); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php index cd4b95cf0e2fe..4a09e851797c6 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\PdoAdapter; use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait; @@ -40,7 +41,7 @@ public static function tearDownAfterClass(): void @unlink(self::$dbFile); } - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { return new PdoAdapter('sqlite:'.self::$dbFile, 'ns', $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php index 573a1b1d01394..d4fa558411b32 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; use Doctrine\DBAL\DriverManager; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\PdoAdapter; use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait; @@ -40,7 +41,7 @@ public static function tearDownAfterClass(): void @unlink(self::$dbFile); } - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { return new PdoAdapter(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile]), '', $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php index b6d5c29881a3c..ed5023b0786fc 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; use Psr\Cache\CacheItemInterface; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\NullAdapter; use Symfony\Component\Cache\Adapter\PhpArrayAdapter; @@ -70,7 +71,7 @@ protected function tearDown(): void } } - public function createCachePool($defaultLifetime = 0, $testMethod = null) + public function createCachePool($defaultLifetime = 0, $testMethod = null): CacheItemPoolInterface { if ('testGetMetadata' === $testMethod || 'testClearPrefix' === $testMethod) { return new PhpArrayAdapter(self::$file, new FilesystemAdapter()); @@ -145,7 +146,7 @@ class PhpArrayAdapterWrapper extends PhpArrayAdapter { protected $data = []; - public function save(CacheItemInterface $item) + public function save(CacheItemInterface $item): bool { (\Closure::bind(function () use ($item) { $key = $item->getKey(); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php index d8e20179883d2..32f52bae9bccc 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\PhpArrayAdapter; @@ -42,7 +43,7 @@ protected function tearDown(): void } } - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { return new PhpArrayAdapter(self::$file, new FilesystemAdapter('php-array-fallback', $defaultLifetime)); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php index dec63a62a0dc8..3e636174473d6 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PhpFilesAdapterTest.php @@ -23,7 +23,7 @@ class PhpFilesAdapterTest extends AdapterTestCase 'testDefaultLifeTime' => 'PhpFilesAdapter does not allow configuring a default lifetime.', ]; - public function createCachePool() + public function createCachePool(): CacheItemPoolInterface { return new PhpFilesAdapter('sf-cache'); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareAdapterTest.php index e685d76083884..390a73da5f78e 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter; use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait; @@ -24,7 +25,7 @@ protected function setUp(): void $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; } - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { $this->assertInstanceOf(\Predis\Client::class, self::$redis); $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php index 8c604c1ca6bf3..8339367593d06 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter; use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait; @@ -24,7 +25,7 @@ protected function setUp(): void $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; } - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { $this->assertInstanceOf(\Predis\Client::class, self::$redis); $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareRedisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareRedisClusterAdapterTest.php index e8d2ea654f314..813d52471587e 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareRedisClusterAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareRedisClusterAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter; use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait; @@ -24,7 +25,7 @@ protected function setUp(): void $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; } - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { $this->assertInstanceOf(\Predis\Client::class, self::$redis); $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php index 13e5aedad044a..6436428e7424a 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php @@ -29,10 +29,7 @@ class ProxyAdapterTest extends AdapterTestCase 'testPrune' => 'ProxyAdapter just proxies', ]; - /** - * @return CacheItemPoolInterface - */ - public function createCachePool($defaultLifetime = 0, $testMethod = null) + public function createCachePool($defaultLifetime = 0, $testMethod = null): CacheItemPoolInterface { if ('testGetMetadata' === $testMethod) { return new ProxyAdapter(new FilesystemAdapter(), '', $defaultLifetime); @@ -64,12 +61,12 @@ public function __construct(CacheItemInterface $item) $this->item = $item; } - public function getItem($key) + public function getItem($key): CacheItem { return $this->item; } - public function save(CacheItemInterface $item) + public function save(CacheItemInterface $item): bool { if ($item === $this->item) { throw new \Exception('OK '.$item->get()); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/Psr16AdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/Psr16AdapterTest.php index 1647a6d4cb9b5..7d5f2423989b6 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/Psr16AdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/Psr16AdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\ArrayAdapter; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\Psr16Adapter; @@ -26,7 +27,7 @@ class Psr16AdapterTest extends AdapterTestCase 'testClearPrefix' => 'SimpleCache cannot clear by prefix', ]; - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { return new Psr16Adapter(new Psr16Cache(new FilesystemAdapter()), '', $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php index b039289cdcd11..216d1373dbd0a 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\AbstractAdapter; use Symfony\Component\Cache\Adapter\RedisAdapter; use Symfony\Component\Cache\Traits\RedisProxy; @@ -23,7 +24,7 @@ public static function setUpBeforeClass(): void self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST'), ['lazy' => true]); } - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { $adapter = parent::createCachePool($defaultLifetime); $this->assertInstanceOf(RedisProxy::class, self::$redis); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php index 34dfae19de368..821259b78fdcf 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\AbstractAdapter; use Symfony\Component\Cache\Adapter\RedisAdapter; use Symfony\Component\Cache\Traits\RedisClusterProxy; @@ -29,7 +30,7 @@ public static function setUpBeforeClass(): void self::$redis = AbstractAdapter::createConnection('redis:?host['.str_replace(' ', ']&host[', $hosts).']', ['lazy' => true, 'redis_cluster' => true]); } - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { $this->assertInstanceOf(RedisClusterProxy::class, self::$redis); $adapter = new RedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareAdapterTest.php index ef140818575d9..b88af7b7335e9 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter; use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait; use Symfony\Component\Cache\Traits\RedisProxy; @@ -25,7 +26,7 @@ protected function setUp(): void $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; } - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { $this->assertInstanceOf(RedisProxy::class, self::$redis); $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php index 7c98020408647..5fcf781cd9f8c 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter; use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait; @@ -24,7 +25,7 @@ protected function setUp(): void $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; } - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { $this->assertInstanceOf(\RedisArray::class, self::$redis); $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php index 7b7d6801940fc..3deb0c264a85f 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\RedisTagAwareAdapter; use Symfony\Component\Cache\Tests\Traits\TagAwareTestTrait; use Symfony\Component\Cache\Traits\RedisClusterProxy; @@ -25,7 +26,7 @@ protected function setUp(): void $this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite'; } - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { $this->assertInstanceOf(RedisClusterProxy::class, self::$redis); $adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/SimpleCacheAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/SimpleCacheAdapterTest.php index c4ec9bf62e8e4..626ba4733141c 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/SimpleCacheAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/SimpleCacheAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\SimpleCacheAdapter; use Symfony\Component\Cache\Simple\ArrayCache; use Symfony\Component\Cache\Simple\FilesystemCache; @@ -26,7 +27,7 @@ class SimpleCacheAdapterTest extends AdapterTestCase 'testClearPrefix' => 'SimpleCache cannot clear by prefix', ]; - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { return new SimpleCacheAdapter(new FilesystemCache(), '', $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php index 490e50339a32a..27731deb2bea8 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; use PHPUnit\Framework\MockObject\MockObject; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\AdapterInterface; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\TagAwareAdapter; @@ -24,7 +25,7 @@ class TagAwareAdapterTest extends AdapterTestCase { use TagAwareTestTrait; - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { return new TagAwareAdapter(new FilesystemAdapter('', $defaultLifetime)); } diff --git a/src/Symfony/Component/Cache/Tests/Adapter/TraceableAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/TraceableAdapterTest.php index 35eba7d77bec6..3d531f5caf162 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/TraceableAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/TraceableAdapterTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\TraceableAdapter; @@ -23,7 +24,7 @@ class TraceableAdapterTest extends AdapterTestCase 'testPrune' => 'TraceableAdapter just proxies', ]; - public function createCachePool($defaultLifetime = 0) + public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface { return new TraceableAdapter(new FilesystemAdapter('', $defaultLifetime)); } diff --git a/src/Symfony/Component/Cache/Tests/Fixtures/ArrayCache.php b/src/Symfony/Component/Cache/Tests/Fixtures/ArrayCache.php index c00a3aef05ae2..724e605e58d39 100644 --- a/src/Symfony/Component/Cache/Tests/Fixtures/ArrayCache.php +++ b/src/Symfony/Component/Cache/Tests/Fixtures/ArrayCache.php @@ -13,10 +13,7 @@ protected function doFetch($id) return $this->doContains($id) ? $this->data[$id][0] : false; } - /** - * @return bool - */ - protected function doContains($id) + protected function doContains($id): bool { if (!isset($this->data[$id])) { return false; @@ -27,40 +24,28 @@ protected function doContains($id) return !$expiry || microtime(true) < $expiry || !$this->doDelete($id); } - /** - * @return bool - */ - protected function doSave($id, $data, $lifeTime = 0) + protected function doSave($id, $data, $lifeTime = 0): bool { $this->data[$id] = [$data, $lifeTime ? microtime(true) + $lifeTime : false]; return true; } - /** - * @return bool - */ - protected function doDelete($id) + protected function doDelete($id): bool { unset($this->data[$id]); return true; } - /** - * @return bool - */ - protected function doFlush() + protected function doFlush(): bool { $this->data = []; return true; } - /** - * @return array|null - */ - protected function doGetStats() + protected function doGetStats(): ?array { return null; } diff --git a/src/Symfony/Component/Cache/Tests/Fixtures/ExternalAdapter.php b/src/Symfony/Component/Cache/Tests/Fixtures/ExternalAdapter.php index 0481b16bcd858..2d2a4b1593a38 100644 --- a/src/Symfony/Component/Cache/Tests/Fixtures/ExternalAdapter.php +++ b/src/Symfony/Component/Cache/Tests/Fixtures/ExternalAdapter.php @@ -29,74 +29,47 @@ public function __construct(int $defaultLifetime = 0) $this->cache = new ArrayAdapter($defaultLifetime); } - /** - * @return CacheItemInterface - */ - public function getItem($key) + public function getItem($key): CacheItemInterface { return $this->cache->getItem($key); } - /** - * @return iterable - */ - public function getItems(array $keys = []) + public function getItems(array $keys = []): iterable { return $this->cache->getItems($keys); } - /** - * @return bool - */ - public function hasItem($key) + public function hasItem($key): bool { return $this->cache->hasItem($key); } - /** - * @return bool - */ - public function clear() + public function clear(): bool { return $this->cache->clear(); } - /** - * @return bool - */ - public function deleteItem($key) + public function deleteItem($key): bool { return $this->cache->deleteItem($key); } - /** - * @return bool - */ - public function deleteItems(array $keys) + public function deleteItems(array $keys): bool { return $this->cache->deleteItems($keys); } - /** - * @return bool - */ - public function save(CacheItemInterface $item) + public function save(CacheItemInterface $item): bool { return $this->cache->save($item); } - /** - * @return bool - */ - public function saveDeferred(CacheItemInterface $item) + public function saveDeferred(CacheItemInterface $item): bool { return $this->cache->saveDeferred($item); } - /** - * @return bool - */ - public function commit() + public function commit(): bool { return $this->cache->commit(); } diff --git a/src/Symfony/Component/Cache/Tests/Psr16CacheTest.php b/src/Symfony/Component/Cache/Tests/Psr16CacheTest.php index 7774e1ddd588f..f3a027cbfbe88 100644 --- a/src/Symfony/Component/Cache/Tests/Psr16CacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Psr16CacheTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Cache\Tests; use Cache\IntegrationTests\SimpleCacheTest; +use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\PruneableInterface; use Symfony\Component\Cache\Psr16Cache; @@ -39,12 +40,12 @@ protected function setUp(): void } } - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { return new Psr16Cache(new FilesystemAdapter('', $defaultLifetime)); } - public static function validKeys() + public static function validKeys(): array { return array_merge(parent::validKeys(), [["a\0b"]]); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php index 81718970c419a..b9bc266ab5389 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/AbstractRedisCacheTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Simple; +use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Simple\RedisCache; /** @@ -26,7 +27,7 @@ abstract class AbstractRedisCacheTest extends CacheTestCase protected static $redis; - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { return new RedisCache(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/ApcuCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/ApcuCacheTest.php index b3220946038cd..03e3f262a6de3 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/ApcuCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/ApcuCacheTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Simple; +use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Simple\ApcuCache; /** @@ -24,7 +25,7 @@ class ApcuCacheTest extends CacheTestCase 'testDefaultLifeTime' => 'Testing expiration slows down the test suite', ]; - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { if (!\function_exists('apcu_fetch') || !filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) || ('cli' === \PHP_SAPI && !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN))) { $this->markTestSkipped('APCu extension is required.'); diff --git a/src/Symfony/Component/Cache/Tests/Simple/ArrayCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/ArrayCacheTest.php index 587304a5db1c4..15fb83975dbc9 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/ArrayCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/ArrayCacheTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Simple; +use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Simple\ArrayCache; /** @@ -19,7 +20,7 @@ */ class ArrayCacheTest extends CacheTestCase { - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { return new ArrayCache($defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/CacheTestCase.php b/src/Symfony/Component/Cache/Tests/Simple/CacheTestCase.php index 5cad7858be854..5d7e30f27afb4 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/CacheTestCase.php +++ b/src/Symfony/Component/Cache/Tests/Simple/CacheTestCase.php @@ -26,10 +26,7 @@ protected function setUp(): void } } - /** - * @return array - */ - public static function validKeys() + public static function validKeys(): array { return array_merge(parent::validKeys(), [["a\0b"]]); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php index 3ec828c1506cf..38b4bb8dd4713 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/ChainCacheTest.php @@ -24,7 +24,7 @@ */ class ChainCacheTest extends CacheTestCase { - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { return new ChainCache([new ArrayCache($defaultLifetime), new FilesystemCache('', $defaultLifetime)], $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/DoctrineCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/DoctrineCacheTest.php index 5d78c00cac841..150c1f6abb080 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/DoctrineCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/DoctrineCacheTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Simple; +use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Simple\DoctrineCache; use Symfony\Component\Cache\Tests\Fixtures\ArrayCache; @@ -25,7 +26,7 @@ class DoctrineCacheTest extends CacheTestCase 'testNotUnserializable' => 'ArrayCache does not use serialize/unserialize', ]; - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { return new DoctrineCache(new ArrayCache($defaultLifetime), '', $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/FilesystemCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/FilesystemCacheTest.php index 9f423ba641c93..31eacdbdb4e11 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/FilesystemCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/FilesystemCacheTest.php @@ -20,7 +20,7 @@ */ class FilesystemCacheTest extends CacheTestCase { - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { return new FilesystemCache('', $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php index 3a7b27b6c08f2..c07f9f10ff087 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Simple; +use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Adapter\AbstractAdapter; use Symfony\Component\Cache\Simple\MemcachedCache; @@ -41,7 +42,7 @@ public static function setUpBeforeClass(): void } } - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { $client = $defaultLifetime ? AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST'), ['binary_protocol' => false]) : self::$client; diff --git a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTextModeTest.php b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTextModeTest.php index d68131a1db7bd..1e749ba72e80e 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTextModeTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/MemcachedCacheTextModeTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Simple; +use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Adapter\AbstractAdapter; use Symfony\Component\Cache\Simple\MemcachedCache; @@ -19,7 +20,7 @@ */ class MemcachedCacheTextModeTest extends MemcachedCacheTest { - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { $client = AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST'), ['binary_protocol' => false]); diff --git a/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php index c326d387d5418..cac5373c9edb0 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/PdoCacheTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Simple; +use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Simple\PdoCache; use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait; @@ -41,7 +42,7 @@ public static function tearDownAfterClass(): void @unlink(self::$dbFile); } - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { return new PdoCache('sqlite:'.self::$dbFile, 'ns', $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php index 2893fee99615d..80c868b5cabb8 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/PdoDbalCacheTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Cache\Tests\Simple; use Doctrine\DBAL\DriverManager; +use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Simple\PdoCache; use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait; @@ -42,7 +43,7 @@ public static function tearDownAfterClass(): void @unlink(self::$dbFile); } - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { return new PdoCache(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile]), '', $defaultLifetime); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php index c1d4ab2d7705d..36dd116dcd2c0 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Simple; +use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Simple\NullCache; use Symfony\Component\Cache\Simple\PhpArrayCache; use Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest; @@ -62,7 +63,7 @@ protected function tearDown(): void } } - public function createSimpleCache() + public function createSimpleCache(): CacheInterface { return new PhpArrayCacheWrapper(self::$file, new NullCache()); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php index 7ae814a98a0d2..08a8459c62c4b 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Simple; +use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Simple\FilesystemCache; use Symfony\Component\Cache\Simple\PhpArrayCache; use Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest; @@ -49,7 +50,7 @@ protected function tearDown(): void } } - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { return new PhpArrayCache(self::$file, new FilesystemCache('php-array-fallback', $defaultLifetime)); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWrapper.php b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWrapper.php index 1e102fe1ff2e3..4dfb2236d5c3d 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWrapper.php +++ b/src/Symfony/Component/Cache/Tests/Simple/PhpArrayCacheWrapper.php @@ -17,7 +17,7 @@ class PhpArrayCacheWrapper extends PhpArrayCache { protected $data = []; - public function set($key, $value, $ttl = null) + public function set($key, $value, $ttl = null): bool { (\Closure::bind(function () use ($key, $value) { $this->data[$key] = $value; @@ -28,7 +28,7 @@ public function set($key, $value, $ttl = null) return true; } - public function setMultiple($values, $ttl = null) + public function setMultiple($values, $ttl = null): bool { if (!\is_array($values) && !$values instanceof \Traversable) { return parent::setMultiple($values, $ttl); diff --git a/src/Symfony/Component/Cache/Tests/Simple/PhpFilesCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/PhpFilesCacheTest.php index 7e40df7de5fbd..2ee25a536ea48 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/PhpFilesCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/PhpFilesCacheTest.php @@ -24,7 +24,7 @@ class PhpFilesCacheTest extends CacheTestCase 'testDefaultLifeTime' => 'PhpFilesCache does not allow configuring a default lifetime.', ]; - public function createSimpleCache() + public function createSimpleCache(): CacheInterface { return new PhpFilesCache('sf-cache'); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/Psr6CacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/Psr6CacheTest.php index 9fff36e402dee..365147d1d390b 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/Psr6CacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/Psr6CacheTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Simple; +use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Simple\Psr6Cache; /** @@ -22,7 +23,7 @@ abstract class Psr6CacheTest extends CacheTestCase 'testPrune' => 'Psr6Cache just proxies', ]; - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { return new Psr6Cache($this->createCacheItemPool($defaultLifetime)); } diff --git a/src/Symfony/Component/Cache/Tests/Simple/TraceableCacheTest.php b/src/Symfony/Component/Cache/Tests/Simple/TraceableCacheTest.php index c2e8a477b4771..21bd1eadbb186 100644 --- a/src/Symfony/Component/Cache/Tests/Simple/TraceableCacheTest.php +++ b/src/Symfony/Component/Cache/Tests/Simple/TraceableCacheTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Cache\Tests\Simple; +use Psr\SimpleCache\CacheInterface; use Symfony\Component\Cache\Simple\FilesystemCache; use Symfony\Component\Cache\Simple\TraceableCache; @@ -24,7 +25,7 @@ class TraceableCacheTest extends CacheTestCase 'testPrune' => 'TraceableCache just proxies', ]; - public function createSimpleCache($defaultLifetime = 0) + public function createSimpleCache($defaultLifetime = 0): CacheInterface { return new TraceableCache(new FilesystemCache('', $defaultLifetime)); } diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php index c4921f6c2834a..311c41ec66b68 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Config\Tests\Definition\Builder; use PHPUnit\Framework\TestCase; +use Symfony\Component\Config\Definition\Builder\ExprBuilder; use Symfony\Component\Config\Definition\Builder\TreeBuilder; class ExprBuilderTest extends TestCase @@ -201,10 +202,8 @@ public function testEndThenPartNotSpecified() /** * Create a test treebuilder with a variable node, and init the validation. - * - * @return TreeBuilder */ - protected function getTestBuilder() + protected function getTestBuilder(): ExprBuilder { $builder = new TreeBuilder('test'); @@ -225,7 +224,7 @@ protected function getTestBuilder() * * @return array The finalized config values */ - protected function finalizeTestBuilder($testBuilder, $config = null) + protected function finalizeTestBuilder($testBuilder, $config = null): array { return $testBuilder ->end() @@ -240,10 +239,8 @@ protected function finalizeTestBuilder($testBuilder, $config = null) * Return a closure that will return the given value. * * @param mixed $val The value that the closure must return - * - * @return \Closure */ - protected function returnClosure($val) + protected function returnClosure($val): \Closure { return function ($v) use ($val) { return $val; diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php b/src/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php index b9c62e53771c2..03d7ceba921a8 100644 --- a/src/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php +++ b/src/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php @@ -12,11 +12,12 @@ namespace Symfony\Component\Config\Tests\Fixtures\Builder; use Symfony\Component\Config\Definition\Builder\NodeDefinition; +use Symfony\Component\Config\Definition\NodeInterface; use Symfony\Component\Config\Tests\Fixtures\BarNode; class BarNodeDefinition extends NodeDefinition { - protected function createNode() + protected function createNode(): NodeInterface { return new BarNode($this->name); } diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php b/src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php index 22b8b32fb6de5..26323e9805d64 100644 --- a/src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php +++ b/src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php @@ -20,7 +20,7 @@ public function barNode($name) return $this->node($name, 'bar'); } - protected function getNodeClass($type) + protected function getNodeClass($type): string { switch ($type) { case 'variable': diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php b/src/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php index bfa43d964d18d..21b2345ea01af 100644 --- a/src/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php +++ b/src/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php @@ -16,7 +16,7 @@ class ExampleConfiguration implements ConfigurationInterface { - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('acme_root'); diff --git a/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php index 0b2e3fb6b9a51..f2f88184204cd 100644 --- a/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php +++ b/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php @@ -103,7 +103,7 @@ public function load($resource, $type = null) return $resource; } - public function supports($resource, $type = null) + public function supports($resource, $type = null): bool { return $this->supports; } diff --git a/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php index b26796b278b9b..6c582ca8d5755 100644 --- a/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php +++ b/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php @@ -105,7 +105,7 @@ public function load($resource, $type = null) { } - public function supports($resource, $type = null) + public function supports($resource, $type = null): bool { return \is_string($resource) && 'foo' === pathinfo($resource, PATHINFO_EXTENSION); } diff --git a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php index 5dc9634f04f60..6ffb461a457bb 100644 --- a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php @@ -204,7 +204,7 @@ class TestEventSubscriber implements EventSubscriberInterface { public static $subscribedEvents = []; - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return self::$subscribedEvents; } @@ -228,7 +228,7 @@ class TestServiceSubscriber implements ServiceSubscriberInterface { public static $subscribedServices = []; - public static function getSubscribedServices() + public static function getSubscribedServices(): array { return self::$subscribedServices; } diff --git a/src/Symfony/Component/Config/Tests/Resource/ResourceStub.php b/src/Symfony/Component/Config/Tests/Resource/ResourceStub.php index b01729cbff853..959b00290ed6d 100644 --- a/src/Symfony/Component/Config/Tests/Resource/ResourceStub.php +++ b/src/Symfony/Component/Config/Tests/Resource/ResourceStub.php @@ -22,12 +22,12 @@ public function setFresh($isFresh) $this->fresh = $isFresh; } - public function __toString() + public function __toString(): string { return 'stub'; } - public function isFresh($timestamp) + public function isFresh($timestamp): bool { return $this->fresh; } diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index ad08aa2e34609..19b3c34b8c32c 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -1758,7 +1758,7 @@ class CustomApplication extends Application * * @return InputDefinition An InputDefinition instance */ - protected function getDefaultInputDefinition() + protected function getDefaultInputDefinition(): InputDefinition { return new InputDefinition([new InputOption('--custom', '-c', InputOption::VALUE_NONE, 'Set the custom input definition.')]); } @@ -1768,7 +1768,7 @@ protected function getDefaultInputDefinition() * * @return HelperSet A HelperSet instance */ - protected function getDefaultHelperSet() + protected function getDefaultHelperSet(): HelperSet { return new HelperSet([new FormatterHelper()]); } @@ -1799,7 +1799,7 @@ public function execute(InputInterface $input, OutputInterface $output) class DisabledCommand extends Command { - public function isEnabled() + public function isEnabled(): bool { return false; } diff --git a/src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php b/src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php index 39766db3d8059..68b4b3a3e1654 100644 --- a/src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php +++ b/src/Symfony/Component/Console/Tests/EventListener/ErrorListenerTest.php @@ -138,11 +138,11 @@ private function getOutput() class NonStringInput extends Input { - public function getFirstArgument() + public function getFirstArgument(): ?string { } - public function hasParameterOption($values, $onlyParams = false) + public function hasParameterOption($values, $onlyParams = false): bool { } diff --git a/src/Symfony/Component/Console/Tests/Fixtures/DummyOutput.php b/src/Symfony/Component/Console/Tests/Fixtures/DummyOutput.php index e9cf6ce7dae8b..96de7e7189d61 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/DummyOutput.php +++ b/src/Symfony/Component/Console/Tests/Fixtures/DummyOutput.php @@ -20,10 +20,7 @@ */ class DummyOutput extends BufferedOutput { - /** - * @return array - */ - public function getLogs() + public function getLogs(): array { $logs = []; foreach (explode(PHP_EOL, trim($this->fetch())) as $message) { diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php index d007a5782ce1d..877b1dfd197b5 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProgressBarTest.php @@ -867,10 +867,8 @@ public function testFormatsWithoutMax($format) /** * Provides each defined format. - * - * @return array */ - public function provideFormat() + public function provideFormat(): array { return [ ['normal'], diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php index 6d803fc251efe..d51d9f72b4626 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProgressIndicatorTest.php @@ -148,10 +148,8 @@ public function testFormats($format) /** * Provides each defined format. - * - * @return array */ - public function provideFormat() + public function provideFormat(): array { return [ ['normal'], diff --git a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php index f1bbb61c5ff91..ef115767efccb 100644 --- a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php +++ b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php @@ -32,10 +32,7 @@ class ConsoleLoggerTest extends TestCase */ protected $output; - /** - * @return LoggerInterface - */ - public function getLogger() + public function getLogger(): LoggerInterface { $this->output = new DummyOutput(OutputInterface::VERBOSITY_VERBOSE); @@ -56,7 +53,7 @@ public function getLogger() * * @return string[] */ - public function getLogs() + public function getLogs(): array { return $this->output->getLogs(); } diff --git a/src/Symfony/Component/Debug/Tests/Fixtures/FinalClasses.php b/src/Symfony/Component/Debug/Tests/Fixtures/FinalClasses.php index 4c2b0aaf351f3..e85c36a1ec0e2 100644 --- a/src/Symfony/Component/Debug/Tests/Fixtures/FinalClasses.php +++ b/src/Symfony/Component/Debug/Tests/Fixtures/FinalClasses.php @@ -41,7 +41,6 @@ class FinalClass4 /** * @author John Doe * - * * @final multiline * comment */ diff --git a/src/Symfony/Component/Debug/Tests/Fixtures/LoggerThatSetAnErrorHandler.php b/src/Symfony/Component/Debug/Tests/Fixtures/LoggerThatSetAnErrorHandler.php index dd8563627a1f4..068e8208d9e99 100644 --- a/src/Symfony/Component/Debug/Tests/Fixtures/LoggerThatSetAnErrorHandler.php +++ b/src/Symfony/Component/Debug/Tests/Fixtures/LoggerThatSetAnErrorHandler.php @@ -6,7 +6,7 @@ class LoggerThatSetAnErrorHandler extends BufferingLogger { - public function log($level, $message, array $context = []) + public function log($level, $message, array $context = []): void { set_error_handler('is_string'); parent::log($level, $message, $context); diff --git a/src/Symfony/Component/DependencyInjection/Argument/BoundArgument.php b/src/Symfony/Component/DependencyInjection/Argument/BoundArgument.php index 4a0054e20bff7..60059267beea4 100644 --- a/src/Symfony/Component/DependencyInjection/Argument/BoundArgument.php +++ b/src/Symfony/Component/DependencyInjection/Argument/BoundArgument.php @@ -43,7 +43,7 @@ public function __construct($value, bool $trackUsage = true, int $type = 0, stri /** * {@inheritdoc} */ - public function getValues() + public function getValues(): array { return [$this->value, $this->identifier, $this->used, $this->type, $this->file]; } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php index 96d4bbe0f4a5f..dea70174b8841 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php @@ -89,10 +89,8 @@ protected function processValue($value, $isRoot = false) /** * @param Reference[] $refMap * @param string|null $callerId - * - * @return Reference */ - public static function register(ContainerBuilder $container, array $refMap, $callerId = null) + public static function register(ContainerBuilder $container, array $refMap, $callerId = null): Reference { foreach ($refMap as $id => $ref) { if (!$ref instanceof Reference) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php index 034841e8036fb..fb23f570162c6 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php @@ -61,7 +61,7 @@ public function __construct($alias) $this->alias = $alias; } - public function getAlias() + public function getAlias(): string { return $this->alias; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php index 83d3e23d3ba5a..73c284f806a1d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php @@ -406,7 +406,7 @@ public function testTaggedServiceLocatorWithDefaultIndex() class ServiceSubscriberStub implements ServiceSubscriberInterface { - public static function getSubscribedServices() + public static function getSubscribedServices(): array { return []; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php index c98275144e740..d5db48cc30645 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php @@ -132,7 +132,7 @@ public function testThrowingExtensionsGetMergedBag() class FooConfiguration implements ConfigurationInterface { - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('foo'); $treeBuilder->getRootNode() @@ -147,12 +147,12 @@ public function getConfigTreeBuilder() class FooExtension extends Extension { - public function getAlias() + public function getAlias(): string { return 'foo'; } - public function getConfiguration(array $config, ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface { return new FooConfiguration(); } @@ -179,12 +179,12 @@ public function load(array $configs, ContainerBuilder $container) class ThrowingExtension extends Extension { - public function getAlias() + public function getAlias(): string { return 'throwing'; } - public function getConfiguration(array $config, ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface { return new FooConfiguration(); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php index 49832451e5786..4686f483a7d61 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RegisterEnvVarProcessorsPassTest.php @@ -78,7 +78,7 @@ public function getEnv($prefix, $name, \Closure $getEnv) return $getEnv($name); } - public static function getProvidedTypes() + public static function getProvidedTypes(): array { return ['foo' => 'string']; } @@ -86,7 +86,7 @@ public static function getProvidedTypes() class BadProcessor extends SimpleProcessor { - public static function getProvidedTypes() + public static function getProvidedTypes(): array { return ['foo' => 'string|foo']; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php index 1c1fbdb764f33..3a89b11c8c8ae 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php @@ -313,7 +313,7 @@ private function doProcess(ContainerBuilder $container): void class EnvConfiguration implements ConfigurationInterface { - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('env_extension'); $treeBuilder->getRootNode() @@ -376,7 +376,7 @@ public function getConfigTreeBuilder() class EnvConfigurationWithoutRootNode implements ConfigurationInterface { - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { return new TreeBuilder(); } @@ -384,7 +384,7 @@ public function getConfigTreeBuilder() class ConfigurationWithArrayNodeRequiringOneElement implements ConfigurationInterface { - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('env_extension'); $treeBuilder->getRootNode() @@ -410,12 +410,12 @@ public function __construct(ConfigurationInterface $configuration = null) $this->configuration = $configuration ?? new EnvConfiguration(); } - public function getAlias() + public function getAlias(): string { return 'env_extension'; } - public function getConfiguration(array $config, ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface { return $this->configuration; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index d6b20071be5d7..9460e27bbdf96 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -1328,7 +1328,7 @@ public function getEnv($prefix, $name, \Closure $getEnv) return str_rot13($getEnv($name)); } - public static function getProvidedTypes() + public static function getProvidedTypes(): array { return ['rot13' => 'string']; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php b/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php index 9f35b4a4193de..16a1d39e2940f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php @@ -50,7 +50,7 @@ public function load(array $configs, ContainerBuilder $container) { } - public function isConfigEnabled(ContainerBuilder $container, array $config) + public function isConfigEnabled(ContainerBuilder $container, array $config): bool { return parent::isConfigEnabled($container, $config); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/BarFactory.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/BarFactory.php index 305b206c88b85..6c2c0f099664e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/BarFactory.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/BarFactory.php @@ -11,7 +11,7 @@ class BarFactory public function __construct(iterable $bars) { - $this->bars = \iterator_to_array($bars); + $this->bars = iterator_to_array($bars); } public function getDefaultBar(): BarInterface diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ScalarFactory.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ScalarFactory.php index 72f6f918075aa..393e241394586 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ScalarFactory.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ScalarFactory.php @@ -4,9 +4,6 @@ final class ScalarFactory { - /** - * @return string - */ public static function getSomeValue(): string { return 'some value'; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/TestServiceSubscriber.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/TestServiceSubscriber.php index 7fc3842af3a49..968ff85f04440 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/TestServiceSubscriber.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/TestServiceSubscriber.php @@ -10,7 +10,7 @@ public function __construct($container) { } - public static function getSubscribedServices() + public static function getSubscribedServices(): array { return [ __CLASS__, diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/TestServiceSubscriberChild.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/TestServiceSubscriberChild.php index efd89e3285ef0..c585a6643be32 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/TestServiceSubscriberChild.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/TestServiceSubscriberChild.php @@ -6,7 +6,8 @@ class TestServiceSubscriberChild extends TestServiceSubscriberParent { - use ServiceSubscriberTrait, TestServiceSubscriberTrait; + use ServiceSubscriberTrait; + use TestServiceSubscriberTrait; private function testDefinition2(): TestDefinition2 { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/services9.php index 04f5858e6b546..7c070ef64f450 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/services9.php @@ -4,8 +4,8 @@ use Bar\FooClass; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Parameter; +use Symfony\Component\DependencyInjection\Reference; require_once __DIR__.'/../includes/classes.php'; require_once __DIR__.'/../includes/foo.php'; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php index 520f235b2236a..6ae7f7161ab7f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php @@ -5,10 +5,10 @@ use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument; -use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Parameter; +use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\ExpressionLanguage\Expression; $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php index b5a6911254d48..4e70a0814cded 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php @@ -248,7 +248,7 @@ public function load($resource, $type = null) return $resource; } - public function supports($resource, $type = null) + public function supports($resource, $type = null): bool { return false; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php b/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php index e5ff2841261e0..025691d74aa70 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php @@ -104,7 +104,7 @@ public function getFoo() return $this->container->get('foo'); } - public static function getSubscribedServices() + public static function getSubscribedServices(): array { return ['bar' => 'stdClass']; } diff --git a/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php index 7a8196b9f1ac5..c17ac333f3cb9 100644 --- a/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php @@ -1241,6 +1241,9 @@ protected function createNodeList() class ClassThatInheritCrawler extends Crawler { + /** + * @return static + */ public function children() { parent::children(); diff --git a/src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php b/src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php index afa3e988d0057..a3efdf31c6f08 100644 --- a/src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php +++ b/src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php @@ -50,6 +50,8 @@ public static function decorate(?ContractsEventDispatcherInterface $dispatcher): * {@inheritdoc} * * @param string|null $eventName + * + * @return Event */ public function dispatch($event/*, string $eventName = null*/) { @@ -114,7 +116,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber) /** * {@inheritdoc} */ - public function getListeners($eventName = null) + public function getListeners($eventName = null): array { return $this->dispatcher->getListeners($eventName); } @@ -130,7 +132,7 @@ public function getListenerPriority($eventName, $listener) /** * {@inheritdoc} */ - public function hasListeners($eventName = null) + public function hasListeners($eventName = null): bool { return $this->dispatcher->hasListeners($eventName); } diff --git a/src/Symfony/Component/EventDispatcher/LegacyEventProxy.php b/src/Symfony/Component/EventDispatcher/LegacyEventProxy.php index cad8cfaedb724..45ee251d6a98d 100644 --- a/src/Symfony/Component/EventDispatcher/LegacyEventProxy.php +++ b/src/Symfony/Component/EventDispatcher/LegacyEventProxy.php @@ -37,7 +37,7 @@ public function getEvent() return $this->event; } - public function isPropagationStopped() + public function isPropagationStopped(): bool { if (!$this->event instanceof ContractsEvent && !$this->event instanceof StoppableEventInterface) { return false; diff --git a/src/Symfony/Component/EventDispatcher/Tests/Debug/TraceableEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/Debug/TraceableEventDispatcherTest.php index ea476eee04c8e..6a208a6662512 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/Debug/TraceableEventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/Debug/TraceableEventDispatcherTest.php @@ -312,7 +312,7 @@ public function testClearOrphanedEvents() class EventSubscriber implements EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return ['foo' => 'call']; } diff --git a/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php b/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php index 2e238bc5ef9ed..1cc54a40b9c63 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php @@ -179,7 +179,7 @@ public function testInvokableEventListener() class SubscriberService implements \Symfony\Component\EventDispatcher\EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ 'event' => 'onEvent', diff --git a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php index 83d10a89be744..bc2287303d633 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php @@ -482,7 +482,7 @@ public function foo($e, $name, $dispatcher) class TestEventSubscriber implements EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return ['pre.foo' => 'preFoo', 'post.foo' => 'postFoo']; } @@ -490,7 +490,7 @@ public static function getSubscribedEvents() class TestEventSubscriberWithPriorities implements EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ 'pre.foo' => ['preFoo', 10], @@ -501,7 +501,7 @@ public static function getSubscribedEvents() class TestEventSubscriberWithMultipleListeners implements EventSubscriberInterface { - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return ['pre.foo' => [ ['preFoo1'], diff --git a/src/Symfony/Component/EventDispatcher/Tests/LegacyEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/LegacyEventDispatcherTest.php index 30bd0c33463bd..f510609d72fd8 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/LegacyEventDispatcherTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/LegacyEventDispatcherTest.php @@ -56,7 +56,7 @@ protected function createEventDispatcher() class TestLegacyEventDispatcher extends EventDispatcher { - public function dispatch($eventName, Event $event = null) + public function dispatch($eventName, Event $event = null): Event { return parent::dispatch($event, $eventName); } diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/Fixtures/TestProvider.php b/src/Symfony/Component/ExpressionLanguage/Tests/Fixtures/TestProvider.php index 8405d4f97585b..6f7c32d7a417a 100644 --- a/src/Symfony/Component/ExpressionLanguage/Tests/Fixtures/TestProvider.php +++ b/src/Symfony/Component/ExpressionLanguage/Tests/Fixtures/TestProvider.php @@ -17,7 +17,7 @@ class TestProvider implements ExpressionFunctionProviderInterface { - public function getFunctions() + public function getFunctions(): array { return [ new ExpressionFunction('identity', function ($input) { diff --git a/src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php b/src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php index 3d80a90582ce8..a1d410b1987be 100644 --- a/src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php +++ b/src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php @@ -25,10 +25,8 @@ class MockStream * @param int $options Holds additional flags set by the streams API * @param string $opened_path If the path is opened successfully, and STREAM_USE_PATH is set in options, * opened_path should be set to the full path of the file/resource that was actually opened - * - * @return bool */ - public function stream_open($path, $mode, $options, &$opened_path) + public function stream_open($path, $mode, $options, &$opened_path): bool { return true; } @@ -39,7 +37,7 @@ public function stream_open($path, $mode, $options, &$opened_path) * * @return array File stats */ - public function url_stat($path, $flags) + public function url_stat($path, $flags): array { return []; } diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php index 19b1909e8791f..48ef921a866a3 100644 --- a/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -1438,6 +1438,9 @@ protected function buildFinder() class ClassThatInheritFinder extends Finder { + /** + * @return $this + */ public function sortByName() { parent::sortByName(); diff --git a/src/Symfony/Component/Finder/Tests/GitignoreTest.php b/src/Symfony/Component/Finder/Tests/GitignoreTest.php index ad0ce0b50700b..c043df8c0be6b 100644 --- a/src/Symfony/Component/Finder/Tests/GitignoreTest.php +++ b/src/Symfony/Component/Finder/Tests/GitignoreTest.php @@ -41,7 +41,7 @@ public function testCases(string $patterns, array $matchingCases, array $nonMatc * ], * ] */ - public function provider() + public function provider(): array { return [ [ diff --git a/src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php index 955677695ba0d..15e069b9f81c1 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php @@ -59,12 +59,12 @@ public function accept() throw new \BadFunctionCallException('Not implemented'); } - public function isRegex($str) + public function isRegex($str): bool { return parent::isRegex($str); } - public function toRegex($str) + public function toRegex($str): string { throw new \BadFunctionCallException('Not implemented'); } diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php index b0737393e4e3f..ce23fbde42f73 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php @@ -30,7 +30,7 @@ final class DateTimeImmutableToDateTimeTransformer implements DataTransformerInt * * @throws TransformationFailedException If the given value is not a \DateTimeImmutable */ - public function transform($value) + public function transform($value): ?\DateTime { if (null === $value) { return null; @@ -52,7 +52,7 @@ public function transform($value) * * @throws TransformationFailedException If the given value is not a \DateTime */ - public function reverseTransform($value) + public function reverseTransform($value): ?\DateTimeImmutable { if (null === $value) { return null; diff --git a/src/Symfony/Component/Form/Tests/AbstractExtensionTest.php b/src/Symfony/Component/Form/Tests/AbstractExtensionTest.php index c3fa1b6cf9f3f..ce3e63416e3cd 100644 --- a/src/Symfony/Component/Form/Tests/AbstractExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractExtensionTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Form\AbstractExtension; +use Symfony\Component\Form\FormTypeGuesserInterface; use Symfony\Component\Form\Tests\Fixtures\FooType; class AbstractExtensionTest extends TestCase @@ -33,12 +34,12 @@ public function testGetType() class ConcreteExtension extends AbstractExtension { - protected function loadTypes() + protected function loadTypes(): array { return [new FooType()]; } - protected function loadTypeGuesser() + protected function loadTypeGuesser(): ?FormTypeGuesserInterface { } } diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php index ea615b559a68d..8dcbd2e64f138 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php @@ -218,10 +218,7 @@ public function testGetChoicesForValuesWithNull() $this->assertNotEmpty($this->list->getChoicesForValues($values)); } - /** - * @return \Symfony\Component\Form\ChoiceList\ChoiceListInterface - */ - abstract protected function createChoiceList(); + abstract protected function createChoiceList(): \Symfony\Component\Form\ChoiceList\ChoiceListInterface; abstract protected function getChoices(); diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php index d9c4ea16a27b4..ce5f2e933f00d 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Form\Tests\ChoiceList; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; /** * @author Bernhard Schussek @@ -27,7 +28,7 @@ protected function setUp(): void parent::setUp(); } - protected function createChoiceList() + protected function createChoiceList(): ChoiceListInterface { return new ArrayChoiceList($this->getChoices()); } diff --git a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php index 7988bb986b459..15fdd85ff6657 100644 --- a/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php +++ b/src/Symfony/Component/Form/Tests/DependencyInjection/FormPassTest.php @@ -238,10 +238,7 @@ public function testAddLegacyTaggedTypeExtensions(array $extensions, array $expe $this->assertEquals($expectedRegisteredExtensions, $extDefinition->getArgument(1)); } - /** - * @return array - */ - public function addLegacyTaggedTypeExtensionsDataProvider() + public function addLegacyTaggedTypeExtensionsDataProvider(): array { return [ [ diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php index ffabfadb74b37..5890ebb8f4744 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php @@ -333,7 +333,7 @@ public function provideDate() class SubmittedForm extends Form { - public function isSubmitted() + public function isSubmitted(): bool { return true; } @@ -341,7 +341,7 @@ public function isSubmitted() class NotSynchronizedForm extends Form { - public function isSynchronized() + public function isSynchronized(): bool { return false; } diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php index de3eb2717f022..f8fbabd92a019 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php @@ -27,8 +27,11 @@ use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\Validator\ConstraintViolationInterface; use Symfony\Component\Validator\ConstraintViolationList; +use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; +use Symfony\Component\Validator\Mapping\MetadataInterface; use Symfony\Component\Validator\Validation; +use Symfony\Component\Validator\Validator\ContextualValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; class ValidationListenerTest extends TestCase @@ -137,12 +140,12 @@ public function testValidateWithEmptyViolationList() class SubmittedNotSynchronizedForm extends Form { - public function isSubmitted() + public function isSubmitted(): bool { return true; } - public function isSynchronized() + public function isSynchronized(): bool { return false; } @@ -157,32 +160,32 @@ public function __construct(ConstraintViolationInterface $violation) $this->violation = $violation; } - public function getMetadataFor($value) + public function getMetadataFor($value): MetadataInterface { } - public function hasMetadataFor($value) + public function hasMetadataFor($value): bool { } - public function validate($value, $constraints = null, $groups = null) + public function validate($value, $constraints = null, $groups = null): ConstraintViolationListInterface { return new ConstraintViolationList([$this->violation]); } - public function validateProperty($object, $propertyName, $groups = null) + public function validateProperty($object, $propertyName, $groups = null): ConstraintViolationListInterface { } - public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) + public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null): ConstraintViolationListInterface { } - public function startContext() + public function startContext(): ContextualValidatorInterface { } - public function inContext(ExecutionContextInterface $context) + public function inContext(ExecutionContextInterface $context): ContextualValidatorInterface { } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/UploadValidatorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/UploadValidatorExtensionTest.php index 34ff556d15300..d1af4d7d21783 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/UploadValidatorExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/UploadValidatorExtensionTest.php @@ -40,7 +40,7 @@ public function testPostMaxSizeTranslation() class DummyTranslator implements TranslatorInterface { - public function trans($id, array $parameters = [], $domain = null, $locale = null) + public function trans($id, array $parameters = [], $domain = null, $locale = null): string { return 'translated max {{ max }}!'; } diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php index 049876246c507..8d3b5f6fa00ff 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php @@ -79,7 +79,7 @@ public function __construct($size) $this->size = $size; } - public function getNormalizedIniPostMaxSize() + public function getNormalizedIniPostMaxSize(): string { return $this->size; } diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php index bcd9ea420eda9..be875fb322b2e 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php @@ -93,18 +93,13 @@ function () { throw new TransformationFailedException(); } /** * @param $propertyPath - * - * @return ConstraintViolation */ - protected function getConstraintViolation($propertyPath) + protected function getConstraintViolation($propertyPath): ConstraintViolation { return new ConstraintViolation($this->message, $this->messageTemplate, $this->params, null, $propertyPath, null); } - /** - * @return FormError - */ - protected function getFormError(ConstraintViolationInterface $violation, FormInterface $form) + protected function getFormError(ConstraintViolationInterface $violation, FormInterface $form): FormError { $error = new FormError($this->message, $this->messageTemplate, $this->params, null, $violation); $error->setOrigin($form); diff --git a/src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php b/src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php index 580e21570869f..ceb25f5559e9e 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/ChoiceSubType.php @@ -36,7 +36,7 @@ public function configureOptions(OptionsResolver $resolver) /** * {@inheritdoc} */ - public function getParent() + public function getParent(): ?string { return 'Symfony\Component\Form\Extension\Core\Type\ChoiceType'; } diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FixedFilterListener.php b/src/Symfony/Component/Form/Tests/Fixtures/FixedFilterListener.php index 7ca0187c643a3..ece653e87b878 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/FixedFilterListener.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/FixedFilterListener.php @@ -55,7 +55,7 @@ public function preSetData(FormEvent $event) } } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ FormEvents::PRE_SUBMIT => 'preSubmit', diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FooSubType.php b/src/Symfony/Component/Form/Tests/Fixtures/FooSubType.php index e4a4f3612e19d..9ce8b5e66e5f5 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/FooSubType.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/FooSubType.php @@ -15,7 +15,7 @@ class FooSubType extends AbstractType { - public function getParent() + public function getParent(): ?string { return __NAMESPACE__.'\FooType'; } diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FooType.php b/src/Symfony/Component/Form/Tests/Fixtures/FooType.php index 3a95172285326..c5ca46597f59d 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/FooType.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/FooType.php @@ -15,7 +15,7 @@ class FooType extends AbstractType { - public function getParent() + public function getParent(): ?string { return null; } diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FormWithSameParentType.php b/src/Symfony/Component/Form/Tests/Fixtures/FormWithSameParentType.php index 098f9a2a2b708..79544d4c0983c 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/FormWithSameParentType.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/FormWithSameParentType.php @@ -15,7 +15,7 @@ class FormWithSameParentType extends AbstractType { - public function getParent() + public function getParent(): ?string { return self::class; } diff --git a/src/Symfony/Component/Form/Tests/Fixtures/RecursiveFormTypeBar.php b/src/Symfony/Component/Form/Tests/Fixtures/RecursiveFormTypeBar.php index a7b0d4df35b00..7836a5399737d 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/RecursiveFormTypeBar.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/RecursiveFormTypeBar.php @@ -15,7 +15,7 @@ class RecursiveFormTypeBar extends AbstractType { - public function getParent() + public function getParent(): ?string { return RecursiveFormTypeBaz::class; } diff --git a/src/Symfony/Component/Form/Tests/Fixtures/RecursiveFormTypeBaz.php b/src/Symfony/Component/Form/Tests/Fixtures/RecursiveFormTypeBaz.php index 63f62e757f93e..dda34803f67c2 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/RecursiveFormTypeBaz.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/RecursiveFormTypeBaz.php @@ -15,7 +15,7 @@ class RecursiveFormTypeBaz extends AbstractType { - public function getParent() + public function getParent(): ?string { return RecursiveFormTypeFoo::class; } diff --git a/src/Symfony/Component/Form/Tests/Fixtures/RecursiveFormTypeFoo.php b/src/Symfony/Component/Form/Tests/Fixtures/RecursiveFormTypeFoo.php index a41f63ee0b9cb..00ac0e70a846a 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/RecursiveFormTypeFoo.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/RecursiveFormTypeFoo.php @@ -15,7 +15,7 @@ class RecursiveFormTypeFoo extends AbstractType { - public function getParent() + public function getParent(): ?string { return RecursiveFormTypeBar::class; } diff --git a/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php b/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php index 578db1242c5d9..335e5c4c7e046 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php @@ -34,12 +34,12 @@ public function addType(FormTypeInterface $type) $this->types[\get_class($type)] = $type; } - public function getType($name) + public function getType($name): FormTypeInterface { return isset($this->types[$name]) ? $this->types[$name] : null; } - public function hasType($name) + public function hasType($name): bool { return isset($this->types[$name]); } @@ -55,17 +55,17 @@ public function addTypeExtension(FormTypeExtensionInterface $extension) } } - public function getTypeExtensions($name) + public function getTypeExtensions($name): array { return isset($this->extensions[$name]) ? $this->extensions[$name] : []; } - public function hasTypeExtensions($name) + public function hasTypeExtensions($name): bool { return isset($this->extensions[$name]); } - public function getTypeGuesser() + public function getTypeGuesser(): ?FormTypeGuesserInterface { return $this->guesser; } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 17f46bef5e1a1..b04e0611273ec 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -53,10 +53,7 @@ protected function tearDown(): void $this->savePath = null; } - /** - * @return NativeSessionStorage - */ - protected function getStorage(array $options = []) + protected function getStorage(array $options = []): NativeSessionStorage { $storage = new NativeSessionStorage($options); $storage->registerBag(new AttributeBag()); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php index 7d68270798933..206ff48777e95 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php @@ -49,10 +49,7 @@ protected function tearDown(): void $this->savePath = null; } - /** - * @return PhpBridgeSessionStorage - */ - protected function getStorage() + protected function getStorage(): PhpBridgeSessionStorage { $storage = new PhpBridgeSessionStorage(); $storage->registerBag(new AttributeBag()); diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php index 0a5f618de07ff..89154ece716f0 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php @@ -43,7 +43,7 @@ public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFa /** * {@inheritdoc} */ - public function getArguments(Request $request, $controller) + public function getArguments(Request $request, $controller): array { $arguments = []; diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php index e58fd3ab2bed7..32a0e071d6884 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php @@ -25,7 +25,7 @@ final class DefaultValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { return $argument->hasDefaultValue() || (null !== $argument->getType() && $argument->isNullable() && !$argument->isVariadic()); } @@ -33,7 +33,7 @@ public function supports(Request $request, ArgumentMetadata $argument) /** * {@inheritdoc} */ - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { yield $argument->hasDefaultValue() ? $argument->getDefaultValue() : null; } diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php index 7dac296c0c7d0..d4971cc1a5074 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php @@ -34,7 +34,7 @@ public function __construct(ContainerInterface $container) /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { $controller = $request->attributes->get('_controller'); diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php index 05be372d84598..c62d327b65a2c 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php @@ -25,7 +25,7 @@ final class RequestAttributeValueResolver implements ArgumentValueResolverInterf /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { return !$argument->isVariadic() && $request->attributes->has($argument->getName()); } @@ -33,7 +33,7 @@ public function supports(Request $request, ArgumentMetadata $argument) /** * {@inheritdoc} */ - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { yield $request->attributes->get($argument->getName()); } diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php index 2a5060a612681..75cbd97edbbfa 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php @@ -25,7 +25,7 @@ final class RequestValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { return Request::class === $argument->getType() || is_subclass_of($argument->getType(), Request::class); } @@ -33,7 +33,7 @@ public function supports(Request $request, ArgumentMetadata $argument) /** * {@inheritdoc} */ - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { yield $request; } diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php index e7df546b6680b..4ffb8c99eb4b5 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php @@ -34,7 +34,7 @@ public function __construct(ContainerInterface $container) /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { $controller = $request->attributes->get('_controller'); @@ -58,7 +58,7 @@ public function supports(Request $request, ArgumentMetadata $argument) /** * {@inheritdoc} */ - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { if (\is_array($controller = $request->attributes->get('_controller'))) { $controller = $controller[0].'::'.$controller[1]; diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php index 276d65461caa6..a1e6b431595c3 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php @@ -26,7 +26,7 @@ final class SessionValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { if (!$request->hasSession()) { return false; @@ -43,7 +43,7 @@ public function supports(Request $request, ArgumentMetadata $argument) /** * {@inheritdoc} */ - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { yield $request->getSession(); } diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php index a388bd823d448..ed61420e67791 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php @@ -25,7 +25,7 @@ final class VariadicValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { return $argument->isVariadic() && $request->attributes->has($argument->getName()); } @@ -33,7 +33,7 @@ public function supports(Request $request, ArgumentMetadata $argument) /** * {@inheritdoc} */ - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { $values = $request->attributes->get($argument->getName()); diff --git a/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php b/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php index 527a6a8a36466..9370174c253a0 100644 --- a/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php +++ b/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php @@ -21,7 +21,7 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface /** * {@inheritdoc} */ - public function createArgumentMetadata($controller) + public function createArgumentMetadata($controller): array { $arguments = []; diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php index b5acb12618493..8359d99f5fad3 100644 --- a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php @@ -59,7 +59,7 @@ public function warmUp($cacheDir) $this->writeCacheFile($this->file, 'content'); } - public function isOptional() + public function isOptional(): bool { return false; } diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/TraceableValueResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/TraceableValueResolverTest.php index 3c2cc3f70040f..91446c45ab73e 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/TraceableValueResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/TraceableValueResolverTest.php @@ -63,12 +63,12 @@ public function testTimingsInResolve() class ResolverStub implements ArgumentValueResolverInterface { - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { return true; } - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { yield 'first'; yield 'second'; diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php index 18269d28e7339..f698571f2a6f8 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php @@ -62,11 +62,11 @@ public function testLegacy() class KernelForTest extends Kernel { - public function registerBundles() + public function registerBundles(): iterable { } - public function getBundles() + public function getBundles(): array { return []; } diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php index 1d521368e1dfa..49567d40be6ce 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/FragmentRendererPassTest.php @@ -17,6 +17,7 @@ use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\DependencyInjection\FragmentRendererPass; use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface; @@ -59,11 +60,11 @@ public function testValidContentRenderer() class RendererService implements FragmentRendererInterface { - public function render($uri, Request $request = null, array $options = []) + public function render($uri, Request $request = null, array $options = []): Response { } - public function getName() + public function getName(): string { return 'test'; } diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php index b86a7552f85e4..440c3faabc895 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php @@ -66,7 +66,7 @@ public function testConfigure() class MockCloner implements ClonerInterface { - public function cloneVar($var) + public function cloneVar($var): Data { return new Data([[$var.'-']]); } diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php index 2048fdd01cc10..7c2cb9d192ca6 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php @@ -167,7 +167,7 @@ public function countErrors() class TestKernel implements HttpKernelInterface { - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true): Response { return new Response('foo'); } @@ -175,7 +175,7 @@ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = class TestKernelThatThrowsException implements HttpKernelInterface { - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true): Response { throw new \RuntimeException('bar'); } diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php index 4f5de182fd17f..168267b456290 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php @@ -39,7 +39,7 @@ public function getData() return $this->data; } - public function getName() + public function getName(): string { return 'clone_var'; } diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php index f7baaa6325fb2..16cc47ce9b636 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php @@ -12,13 +12,14 @@ namespace Symfony\Component\HttpKernel\Tests\Fixtures; use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Kernel; class KernelForOverrideName extends Kernel { protected $name = 'overridden'; - public function registerBundles() + public function registerBundles(): iterable { } diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTest.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTest.php index 868094a596d56..5ba41ce03827b 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpKernel\Tests\Fixtures; use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Kernel; class KernelForTest extends Kernel @@ -21,7 +22,7 @@ public function getBundleMap() return $this->bundleMap; } - public function registerBundles() + public function registerBundles(): iterable { return []; } @@ -35,12 +36,12 @@ public function isBooted() return $this->booted; } - public function getCacheDir() + public function getCacheDir(): string { return $this->getProjectDir().'/Tests/Fixtures/cache.'.$this->environment; } - public function getLogDir() + public function getLogDir(): string { return $this->getProjectDir().'/Tests/Fixtures/logs'; } diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelWithoutBundles.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelWithoutBundles.php index 2391557362f07..074ccc3276b72 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelWithoutBundles.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelWithoutBundles.php @@ -13,11 +13,12 @@ use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Kernel; class KernelWithoutBundles extends Kernel { - public function registerBundles() + public function registerBundles(): iterable { return []; } @@ -26,7 +27,7 @@ public function registerContainerConfiguration(LoaderInterface $loader) { } - public function getProjectDir() + public function getProjectDir(): string { return __DIR__; } diff --git a/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestClient.php b/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestClient.php index 140cbfbf51f48..b56e725afbea7 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestClient.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestClient.php @@ -15,7 +15,7 @@ class TestClient extends HttpKernelBrowser { - protected function getScript($request) + protected function getScript($request): string { $script = parent::getScript($request); diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php index 1bf66fdc97b26..3ba144958035a 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php @@ -1555,7 +1555,7 @@ public function terminate(Request $request, Response $response) $this->terminateCalled = true; } - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true): Response { } } diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php index 61e6beded5803..ea2d2b7a12c4a 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/SubRequestHandlerTest.php @@ -143,7 +143,7 @@ public function __construct(\Closure $assertCallback) $this->assertCallback = $assertCallback; } - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true): Response { $assertCallback = $this->assertCallback; $assertCallback($request, $type, $catch); diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php index 304ff9d9e43e7..5b204d82698ba 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php @@ -54,7 +54,7 @@ public function assert(\Closure $callback) } } - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false) + public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false): Response { $this->catch = $catch; $this->backendRequest = [Request::getTrustedProxies(), Request::getTrustedHeaderSet(), $request]; @@ -72,7 +72,7 @@ public function getController(Request $request) return [$this, 'callController']; } - public function getArguments(Request $request, $controller) + public function getArguments(Request $request, $controller): array { return [$request]; } diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php index 010bee86895a7..8ce3cfb8bb2b7 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php @@ -43,7 +43,7 @@ public function getBackendRequest() return $this->backendRequest; } - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false) + public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false): Response { $this->backendRequest = $request; @@ -55,7 +55,7 @@ public function getController(Request $request) return [$this, 'callController']; } - public function getArguments(Request $request, $controller) + public function getArguments(Request $request, $controller): array { return [$request]; } diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 12827c33d9a6a..35304bc982ef1 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -21,6 +21,7 @@ use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\DependencyInjection\ResettableServicePass; use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter; +use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForOverrideName; @@ -620,10 +621,8 @@ public function testKernelStartTimeIsResetWhileBootingAlreadyBootedKernel() /** * Returns a mock for the BundleInterface. - * - * @return BundleInterface */ - protected function getBundle($dir = null, $parent = null, $className = null, $bundleName = null) + protected function getBundle($dir = null, $parent = null, $className = null, $bundleName = null): BundleInterface { $bundle = $this ->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface') @@ -669,10 +668,8 @@ protected function getBundle($dir = null, $parent = null, $className = null, $bu * * @param array $methods Additional methods to mock (besides the abstract ones) * @param array $bundles Bundles to register - * - * @return Kernel */ - protected function getKernel(array $methods = [], array $bundles = []) + protected function getKernel(array $methods = [], array $bundles = []): Kernel { $methods[] = 'registerBundles'; @@ -716,7 +713,7 @@ public function terminate() $this->terminateCalled = true; } - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true): Response { } } @@ -735,7 +732,7 @@ public function __construct(\Closure $buildContainer = null, HttpKernelInterface $this->httpKernel = $httpKernel; } - public function registerBundles() + public function registerBundles(): iterable { return []; } @@ -744,7 +741,7 @@ public function registerContainerConfiguration(LoaderInterface $loader) { } - public function getProjectDir() + public function getProjectDir(): string { return __DIR__.'/Fixtures'; } @@ -756,7 +753,7 @@ protected function build(ContainerBuilder $container) } } - protected function getHttpKernel() + protected function getHttpKernel(): HttpKernelInterface { return $this->httpKernel; } diff --git a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php index 79b79cc69cb95..c89146aff5c12 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php @@ -57,7 +57,7 @@ public static function assertLogsMatch(array $expected, array $given) * * @return string[] */ - public function getLogs() + public function getLogs(): array { return file($this->tmpFile, FILE_IGNORE_NEW_LINES); } diff --git a/src/Symfony/Component/HttpKernel/Tests/Logger.php b/src/Symfony/Component/HttpKernel/Tests/Logger.php index 1f80e48ae9e79..d15e79a6c0f62 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Logger.php +++ b/src/Symfony/Component/HttpKernel/Tests/Logger.php @@ -41,74 +41,47 @@ public function clear() ]; } - /** - * @return void - */ - public function log($level, $message, array $context = []) + public function log($level, $message, array $context = []): void { $this->logs[$level][] = $message; } - /** - * @return void - */ - public function emergency($message, array $context = []) + public function emergency($message, array $context = []): void { $this->log('emergency', $message, $context); } - /** - * @return void - */ - public function alert($message, array $context = []) + public function alert($message, array $context = []): void { $this->log('alert', $message, $context); } - /** - * @return void - */ - public function critical($message, array $context = []) + public function critical($message, array $context = []): void { $this->log('critical', $message, $context); } - /** - * @return void - */ - public function error($message, array $context = []) + public function error($message, array $context = []): void { $this->log('error', $message, $context); } - /** - * @return void - */ - public function warning($message, array $context = []) + public function warning($message, array $context = []): void { $this->log('warning', $message, $context); } - /** - * @return void - */ - public function notice($message, array $context = []) + public function notice($message, array $context = []): void { $this->log('notice', $message, $context); } - /** - * @return void - */ - public function info($message, array $context = []) + public function info($message, array $context = []): void { $this->log('info', $message, $context); } - /** - * @return void - */ - public function debug($message, array $context = []) + public function debug($message, array $context = []): void { $this->log('debug', $message, $context); } diff --git a/src/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php b/src/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php index 27ba2d6f89499..b01807509d62e 100644 --- a/src/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php +++ b/src/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php @@ -30,7 +30,7 @@ public function getController(Request $request) return [$this, 'callController']; } - public function getArguments(Request $request, $controller) + public function getArguments(Request $request, $controller): array { return [$request]; } diff --git a/src/Symfony/Component/Intl/Intl.php b/src/Symfony/Component/Intl/Intl.php index 5d87df7f9b690..7c885e4e38830 100644 --- a/src/Symfony/Component/Intl/Intl.php +++ b/src/Symfony/Component/Intl/Intl.php @@ -109,7 +109,7 @@ final class Intl * * @return bool Returns true if the intl extension is installed, false otherwise */ - public static function isExtensionLoaded() + public static function isExtensionLoaded(): bool { return class_exists('\ResourceBundle'); } @@ -121,7 +121,7 @@ public static function isExtensionLoaded() * * @deprecated since Symfony 4.3, to be removed in 5.0. Use {@see Currencies} instead. */ - public static function getCurrencyBundle() + public static function getCurrencyBundle(): CurrencyBundleInterface { @trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" instead.', __METHOD__, Currencies::class), E_USER_DEPRECATED); @@ -143,7 +143,7 @@ public static function getCurrencyBundle() * * @deprecated since Symfony 4.3, to be removed in 5.0. Use {@see Languages} or {@see Scripts} instead. */ - public static function getLanguageBundle() + public static function getLanguageBundle(): LanguageBundleInterface { @trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" or "%s" instead.', __METHOD__, Languages::class, Scripts::class), E_USER_DEPRECATED); @@ -169,7 +169,7 @@ public static function getLanguageBundle() * * @deprecated since Symfony 4.3, to be removed in 5.0. Use {@see Locales} instead. */ - public static function getLocaleBundle() + public static function getLocaleBundle(): LocaleBundleInterface { @trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" instead.', __METHOD__, Locales::class), E_USER_DEPRECATED); @@ -190,7 +190,7 @@ public static function getLocaleBundle() * * @deprecated since Symfony 4.3, to be removed in 5.0. Use {@see Countries} instead. */ - public static function getRegionBundle() + public static function getRegionBundle(): RegionBundleInterface { @trigger_error(sprintf('The method "%s()" is deprecated since Symfony 4.3, use "%s" instead.', __METHOD__, Countries::class), E_USER_DEPRECATED); @@ -210,7 +210,7 @@ public static function getRegionBundle() * * @return string|null The ICU version or NULL if it could not be determined */ - public static function getIcuVersion() + public static function getIcuVersion(): ?string { if (false === self::$icuVersion) { if (!self::isExtensionLoaded()) { @@ -240,7 +240,7 @@ public static function getIcuVersion() * * @return string The version of the installed ICU data */ - public static function getIcuDataVersion() + public static function getIcuDataVersion(): string { if (false === self::$icuDataVersion) { self::$icuDataVersion = trim(file_get_contents(self::getDataDirectory().'/version.txt')); @@ -254,7 +254,7 @@ public static function getIcuDataVersion() * * @return string The ICU version of the stub classes */ - public static function getIcuStubVersion() + public static function getIcuStubVersion(): string { return '64.2'; } @@ -264,7 +264,7 @@ public static function getIcuStubVersion() * * @return string The absolute path to the data directory */ - public static function getDataDirectory() + public static function getDataDirectory(): string { return __DIR__.'/Resources/data'; } diff --git a/src/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php b/src/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php index 28eb37d7cc057..b2931f65e111d 100644 --- a/src/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php +++ b/src/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php @@ -54,9 +54,7 @@ public function asortProvider() } /** - * @param string $locale - * - * @return \Collator + * @return Collator|\Collator */ - abstract protected function getCollator($locale); + abstract protected function getCollator(string $locale); } diff --git a/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php b/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php index 21349088fa864..0964e31e34c1e 100644 --- a/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php +++ b/src/Symfony/Component/Intl/Tests/Collator/CollatorTest.php @@ -95,7 +95,7 @@ public function testStaticCreate() $this->assertInstanceOf('\Symfony\Component\Intl\Collator\Collator', $collator); } - protected function getCollator($locale) + protected function getCollator(?string $locale): Collator { return new class($locale) extends Collator { }; diff --git a/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php b/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php index 3f06b2c25f108..bb376e504e130 100644 --- a/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php +++ b/src/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php @@ -29,7 +29,7 @@ protected function setUp(): void parent::setUp(); } - protected function getCollator($locale) + protected function getCollator(?string $locale): \Collator { return new \Collator($locale); } diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractDataProviderTest.php index eed2db8c7572a..6e9071fbaa782 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractDataProviderTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractDataProviderTest.php @@ -756,10 +756,7 @@ protected function getRootLocales() return self::$rootLocales; } - /** - * @return BundleEntryReader - */ - protected function createEntryReader() + protected function createEntryReader(): BundleEntryReader { $entryReader = new BundleEntryReader($this->createBundleReader()); $entryReader->setLocaleAliases($this->getLocaleAliases()); @@ -767,8 +764,5 @@ protected function createEntryReader() return $entryReader; } - /** - * @return BundleReaderInterface - */ - abstract protected function createBundleReader(); + abstract protected function createBundleReader(): BundleReaderInterface; } diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonCurrencyDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonCurrencyDataProviderTest.php index ff12edb44126b..b770f8b0cfd64 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonCurrencyDataProviderTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonCurrencyDataProviderTest.php @@ -28,10 +28,7 @@ protected function getDataDirectory() return Intl::getDataDirectory(); } - /** - * @return BundleReaderInterface - */ - protected function createBundleReader() + protected function createBundleReader(): BundleReaderInterface { return new JsonBundleReader(); } diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonLanguageDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonLanguageDataProviderTest.php index 74049ab53e13f..0626872a3bd81 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonLanguageDataProviderTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonLanguageDataProviderTest.php @@ -28,10 +28,7 @@ protected function getDataDirectory() return Intl::getDataDirectory(); } - /** - * @return BundleReaderInterface - */ - protected function createBundleReader() + protected function createBundleReader(): BundleReaderInterface { return new JsonBundleReader(); } diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonLocaleDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonLocaleDataProviderTest.php index ba00439bdcea0..2a1b53bf59f8b 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonLocaleDataProviderTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonLocaleDataProviderTest.php @@ -28,10 +28,7 @@ protected function getDataDirectory() return Intl::getDataDirectory(); } - /** - * @return BundleReaderInterface - */ - protected function createBundleReader() + protected function createBundleReader(): BundleReaderInterface { return new JsonBundleReader(); } diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonRegionDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonRegionDataProviderTest.php index 9bb3bba48917d..f5f5266e388da 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonRegionDataProviderTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonRegionDataProviderTest.php @@ -28,10 +28,7 @@ protected function getDataDirectory() return Intl::getDataDirectory(); } - /** - * @return BundleReaderInterface - */ - protected function createBundleReader() + protected function createBundleReader(): BundleReaderInterface { return new JsonBundleReader(); } diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonScriptDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonScriptDataProviderTest.php index 9648cbaca306f..c9888047771bf 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonScriptDataProviderTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Provider/Json/JsonScriptDataProviderTest.php @@ -28,10 +28,7 @@ protected function getDataDirectory() return Intl::getDataDirectory(); } - /** - * @return BundleReaderInterface - */ - protected function createBundleReader() + protected function createBundleReader(): BundleReaderInterface { return new JsonBundleReader(); } diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php index b8f4b5eebe68f..cf7a563b2590c 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php @@ -965,10 +965,7 @@ protected function assertIsIntlSuccess($formatter, $errorMessage, $errorCode) */ abstract protected function getDateFormatter($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null); - /** - * @return string - */ - abstract protected function getIntlErrorMessage(); + abstract protected function getIntlErrorMessage(): string; /** * @return int @@ -977,8 +974,6 @@ abstract protected function getIntlErrorCode(); /** * @param int $errorCode - * - * @return bool */ - abstract protected function isIntlFailure($errorCode); + abstract protected function isIntlFailure($errorCode): bool; } diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php index 5b5adca6a5817..2c043e235fdc3 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php @@ -183,7 +183,7 @@ protected function getDateFormatter($locale, $datetype, $timetype, $timezone = n }; } - protected function getIntlErrorMessage() + protected function getIntlErrorMessage(): string { return IntlGlobals::getErrorMessage(); } @@ -193,7 +193,7 @@ protected function getIntlErrorCode() return IntlGlobals::getErrorCode(); } - protected function isIntlFailure($errorCode) + protected function isIntlFailure($errorCode): bool { return IntlGlobals::isFailure($errorCode); } diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php index 863d3409c878d..a993ace5cb100 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php @@ -68,7 +68,7 @@ protected function getDateFormatter($locale, $datetype, $timetype, $timezone = n return $formatter; } - protected function getIntlErrorMessage() + protected function getIntlErrorMessage(): string { return intl_get_error_message(); } @@ -78,7 +78,7 @@ protected function getIntlErrorCode() return intl_get_error_code(); } - protected function isIntlFailure($errorCode) + protected function isIntlFailure($errorCode): bool { return intl_is_failure($errorCode); } diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php index f64131a61b8c1..6a6e4ef628d87 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php @@ -836,18 +836,11 @@ public function testParseWithNotNullPositionValue() } /** - * @param string $locale - * @param null $style - * @param null $pattern - * - * @return \NumberFormatter + * @return NumberFormatter|\NumberFormatter */ - abstract protected function getNumberFormatter($locale = 'en', $style = null, $pattern = null); + abstract protected function getNumberFormatter(string $locale = 'en', string $style = null, string $pattern = null); - /** - * @return string - */ - abstract protected function getIntlErrorMessage(); + abstract protected function getIntlErrorMessage(): string; /** * @return int @@ -856,8 +849,6 @@ abstract protected function getIntlErrorCode(); /** * @param int $errorCode - * - * @return bool */ - abstract protected function isIntlFailure($errorCode); + abstract protected function isIntlFailure($errorCode): bool; } diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php index 1f002aa77bc46..8faca56818b86 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php @@ -167,13 +167,13 @@ public function testSetTextAttribute() $formatter->setTextAttribute(null, null); } - protected function getNumberFormatter($locale = 'en', $style = null, $pattern = null) + protected function getNumberFormatter(?string $locale = 'en', string $style = null, string $pattern = null): NumberFormatter { return new class($locale, $style, $pattern) extends NumberFormatter { }; } - protected function getIntlErrorMessage() + protected function getIntlErrorMessage(): string { return IntlGlobals::getErrorMessage(); } @@ -183,7 +183,7 @@ protected function getIntlErrorCode() return IntlGlobals::getErrorCode(); } - protected function isIntlFailure($errorCode) + protected function isIntlFailure($errorCode): bool { return IntlGlobals::isFailure($errorCode); } diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php index 106e666967a1b..1209180e89636 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php @@ -39,12 +39,12 @@ public function testGetTextAttribute() parent::testGetTextAttribute(); } - protected function getNumberFormatter($locale = 'en', $style = null, $pattern = null) + protected function getNumberFormatter(?string $locale = 'en', string $style = null, string $pattern = null): \NumberFormatter { return new \NumberFormatter($locale, $style, $pattern); } - protected function getIntlErrorMessage() + protected function getIntlErrorMessage(): string { return intl_get_error_message(); } @@ -54,7 +54,7 @@ protected function getIntlErrorCode() return intl_get_error_code(); } - protected function isIntlFailure($errorCode) + protected function isIntlFailure($errorCode): bool { return intl_is_failure($errorCode); } diff --git a/src/Symfony/Component/Ldap/Ldap.php b/src/Symfony/Component/Ldap/Ldap.php index 615dbcfda383b..dc7d3ae304aef 100644 --- a/src/Symfony/Component/Ldap/Ldap.php +++ b/src/Symfony/Component/Ldap/Ldap.php @@ -12,6 +12,8 @@ namespace Symfony\Component\Ldap; use Symfony\Component\Ldap\Adapter\AdapterInterface; +use Symfony\Component\Ldap\Adapter\EntryManagerInterface; +use Symfony\Component\Ldap\Adapter\QueryInterface; use Symfony\Component\Ldap\Exception\DriverNotFoundException; /** @@ -41,7 +43,7 @@ public function bind($dn = null, $password = null) /** * {@inheritdoc} */ - public function query($dn, $query, array $options = []) + public function query($dn, $query, array $options = []): QueryInterface { return $this->adapter->createQuery($dn, $query, $options); } @@ -49,7 +51,7 @@ public function query($dn, $query, array $options = []) /** * {@inheritdoc} */ - public function getEntryManager() + public function getEntryManager(): EntryManagerInterface { return $this->adapter->getEntryManager(); } @@ -57,7 +59,7 @@ public function getEntryManager() /** * {@inheritdoc} */ - public function escape($subject, $ignore = '', $flags = 0) + public function escape($subject, $ignore = '', $flags = 0): string { return $this->adapter->escape($subject, $ignore, $flags); } diff --git a/src/Symfony/Component/Ldap/Tests/LdapTest.php b/src/Symfony/Component/Ldap/Tests/LdapTest.php index 09975378fc465..68e9da2451131 100644 --- a/src/Symfony/Component/Ldap/Tests/LdapTest.php +++ b/src/Symfony/Component/Ldap/Tests/LdapTest.php @@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Ldap\Adapter\AdapterInterface; use Symfony\Component\Ldap\Adapter\ConnectionInterface; +use Symfony\Component\Ldap\Adapter\QueryInterface; use Symfony\Component\Ldap\Exception\DriverNotFoundException; use Symfony\Component\Ldap\Ldap; @@ -54,6 +55,7 @@ public function testLdapEscape() ->expects($this->once()) ->method('escape') ->with('foo', 'bar', 'baz') + ->willReturn(''); ; $this->ldap->escape('foo', 'bar', 'baz'); } @@ -64,6 +66,7 @@ public function testLdapQuery() ->expects($this->once()) ->method('createQuery') ->with('foo', 'bar', ['baz']) + ->willReturn($this->createMock(QueryInterface::class)) ; $this->ldap->query('foo', 'bar', ['baz']); } diff --git a/src/Symfony/Component/Lock/Key.php b/src/Symfony/Component/Lock/Key.php index e20fbd9c80582..798e571d008da 100644 --- a/src/Symfony/Component/Lock/Key.php +++ b/src/Symfony/Component/Lock/Key.php @@ -74,15 +74,12 @@ public function reduceLifetime($ttl) * * @return float|null Remaining lifetime in seconds. Null when the key won't expire. */ - public function getRemainingLifetime() + public function getRemainingLifetime(): ?float { return null === $this->expiringTime ? null : $this->expiringTime - microtime(true); } - /** - * @return bool - */ - public function isExpired() + public function isExpired(): bool { return null !== $this->expiringTime && $this->expiringTime <= microtime(true); } diff --git a/src/Symfony/Component/Lock/Lock.php b/src/Symfony/Component/Lock/Lock.php index 8a61bf6f7b8e8..41af54727a6c8 100644 --- a/src/Symfony/Component/Lock/Lock.php +++ b/src/Symfony/Component/Lock/Lock.php @@ -65,7 +65,7 @@ public function __destruct() /** * {@inheritdoc} */ - public function acquire($blocking = false) + public function acquire($blocking = false): bool { try { if ($blocking) { @@ -149,7 +149,7 @@ public function refresh($ttl = null) /** * {@inheritdoc} */ - public function isAcquired() + public function isAcquired(): bool { return $this->dirty = $this->store->exists($this->key); } @@ -181,7 +181,7 @@ public function release() /** * {@inheritdoc} */ - public function isExpired() + public function isExpired(): bool { return $this->key->isExpired(); } @@ -189,7 +189,7 @@ public function isExpired() /** * {@inheritdoc} */ - public function getRemainingLifetime() + public function getRemainingLifetime(): ?float { return $this->key->getRemainingLifetime(); } diff --git a/src/Symfony/Component/Lock/Tests/LockTest.php b/src/Symfony/Component/Lock/Tests/LockTest.php index aae7a7671d480..d31a6d58aaf6d 100644 --- a/src/Symfony/Component/Lock/Tests/LockTest.php +++ b/src/Symfony/Component/Lock/Tests/LockTest.php @@ -34,6 +34,9 @@ public function testAcquireNoBlocking() $store ->expects($this->once()) ->method('save'); + $store + ->method('exists') + ->willReturnOnConsecutiveCalls(true, false); $this->assertTrue($lock->acquire(false)); } @@ -47,6 +50,9 @@ public function testAcquireNoBlockingStoreInterface() $store ->expects($this->once()) ->method('save'); + $store + ->method('exists') + ->willReturnOnConsecutiveCalls(true, false); $this->assertTrue($lock->acquire(false)); } @@ -63,6 +69,9 @@ public function testPassingOldStoreInterface() $store ->expects($this->once()) ->method('save'); + $store + ->method('exists') + ->willReturnOnConsecutiveCalls(true, false); $this->assertTrue($lock->acquire(false)); } @@ -77,6 +86,9 @@ public function testAcquireReturnsFalse() ->expects($this->once()) ->method('save') ->willThrowException(new LockConflictedException()); + $store + ->method('exists') + ->willReturnOnConsecutiveCalls(true, false); $this->assertFalse($lock->acquire(false)); } @@ -91,6 +103,9 @@ public function testAcquireReturnsFalseStoreInterface() ->expects($this->once()) ->method('save') ->willThrowException(new LockConflictedException()); + $store + ->method('exists') + ->willReturnOnConsecutiveCalls(true, false); $this->assertFalse($lock->acquire(false)); } @@ -107,6 +122,9 @@ public function testAcquireBlocking() $store ->expects($this->once()) ->method('waitAndSave'); + $store + ->method('exists') + ->willReturnOnConsecutiveCalls(true, false); $this->assertTrue($lock->acquire(true)); } @@ -124,6 +142,9 @@ public function testAcquireSetsTtl() ->expects($this->once()) ->method('putOffExpiration') ->with($key, 10); + $store + ->method('exists') + ->willReturnOnConsecutiveCalls(true, false); $lock->acquire(); } @@ -138,6 +159,9 @@ public function testRefresh() ->expects($this->once()) ->method('putOffExpiration') ->with($key, 10); + $store + ->method('exists') + ->willReturnOnConsecutiveCalls(true, false); $lock->refresh(); } @@ -152,6 +176,9 @@ public function testRefreshCustom() ->expects($this->once()) ->method('putOffExpiration') ->with($key, 20); + $store + ->method('exists') + ->willReturnOnConsecutiveCalls(true, false); $lock->refresh(20); } @@ -163,10 +190,9 @@ public function testIsAquired() $lock = new Lock($key, $store, 10); $store - ->expects($this->any()) ->method('exists') ->with($key) - ->will($this->onConsecutiveCalls(true, false)); + ->willReturnOnConsecutiveCalls(true, false); $this->assertTrue($lock->isAcquired()); } @@ -219,7 +245,7 @@ public function testReleaseOnDestruction() $store ->method('exists') - ->willReturnOnConsecutiveCalls([true, false]) + ->willReturnOnConsecutiveCalls(true, false) ; $store ->expects($this->once()) @@ -238,7 +264,7 @@ public function testNoAutoReleaseWhenNotConfigured() $store ->method('exists') - ->willReturnOnConsecutiveCalls([true, false]) + ->willReturnOnConsecutiveCalls(true, false) ; $store ->expects($this->never()) diff --git a/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTest.php index 4b9c81bd8e8c2..e05b7d4c3ffcf 100644 --- a/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/AbstractRedisStoreTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Lock\Tests\Store; +use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\Store\RedisStore; /** @@ -38,7 +39,7 @@ abstract protected function getRedisConnection(); /** * {@inheritdoc} */ - public function getStore() + public function getStore(): PersistingStoreInterface { return new RedisStore($this->getRedisConnection()); } diff --git a/src/Symfony/Component/Lock/Tests/Store/AbstractStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/AbstractStoreTest.php index 8159cd7f760e3..2868e6032ec74 100644 --- a/src/Symfony/Component/Lock/Tests/Store/AbstractStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/AbstractStoreTest.php @@ -21,10 +21,7 @@ */ abstract class AbstractStoreTest extends TestCase { - /** - * @return PersistingStoreInterface - */ - abstract protected function getStore(); + abstract protected function getStore(): PersistingStoreInterface; public function testSave() { diff --git a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php index 35e2110396bed..c8da617fae61d 100644 --- a/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/CombinedStoreTest.php @@ -39,7 +39,7 @@ protected function getClockDelay() /** * {@inheritdoc} */ - public function getStore() + public function getStore(): PersistingStoreInterface { $redis = new \Predis\Client('tcp://'.getenv('REDIS_HOST').':6379'); try { diff --git a/src/Symfony/Component/Lock/Tests/Store/FlockStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/FlockStoreTest.php index 769082ddf9332..1b1b498358717 100644 --- a/src/Symfony/Component/Lock/Tests/Store/FlockStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/FlockStoreTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Lock\Tests\Store; use Symfony\Component\Lock\Key; +use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\Store\FlockStore; /** @@ -24,7 +25,7 @@ class FlockStoreTest extends AbstractStoreTest /** * {@inheritdoc} */ - protected function getStore() + protected function getStore(): PersistingStoreInterface { return new FlockStore(); } diff --git a/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php index c13f6723daa6d..64fac49237706 100644 --- a/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/MemcachedStoreTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Lock\Tests\Store; use Symfony\Component\Lock\Key; +use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\Store\MemcachedStore; /** @@ -46,7 +47,7 @@ protected function getClockDelay() /** * {@inheritdoc} */ - public function getStore() + public function getStore(): PersistingStoreInterface { $memcached = new \Memcached(); $memcached->addServer(getenv('MEMCACHED_HOST'), 11211); diff --git a/src/Symfony/Component/Lock/Tests/Store/PdoDbalStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/PdoDbalStoreTest.php index 2a8ec082a1130..264c99829c98f 100644 --- a/src/Symfony/Component/Lock/Tests/Store/PdoDbalStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/PdoDbalStoreTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Lock\Tests\Store; use Doctrine\DBAL\DriverManager; +use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\Store\PdoStore; /** @@ -49,7 +50,7 @@ protected function getClockDelay() /** * {@inheritdoc} */ - public function getStore() + public function getStore(): PersistingStoreInterface { return new PdoStore(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile])); } diff --git a/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php index 27a458c99b15d..eb24cb1de4a89 100644 --- a/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Lock\Tests\Store; use Symfony\Component\Lock\Key; +use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\Store\PdoStore; /** @@ -49,7 +50,7 @@ protected function getClockDelay() /** * {@inheritdoc} */ - public function getStore() + public function getStore(): PersistingStoreInterface { return new PdoStore('sqlite:'.self::$dbFile); } diff --git a/src/Symfony/Component/Lock/Tests/Store/RetryTillSaveStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/RetryTillSaveStoreTest.php index febd48f279fc5..12d7d7a1494fa 100644 --- a/src/Symfony/Component/Lock/Tests/Store/RetryTillSaveStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/RetryTillSaveStoreTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Lock\Tests\Store; +use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\Store\RedisStore; use Symfony\Component\Lock\Store\RetryTillSaveStore; @@ -21,7 +22,7 @@ class RetryTillSaveStoreTest extends AbstractStoreTest { use BlockingStoreTestTrait; - public function getStore() + public function getStore(): PersistingStoreInterface { $redis = new \Predis\Client('tcp://'.getenv('REDIS_HOST').':6379'); try { diff --git a/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php index 6c265b98bdb42..8ea1e717c6ee5 100644 --- a/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Lock\Tests\Store; use Symfony\Component\Lock\Key; +use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\Store\SemaphoreStore; /** @@ -26,7 +27,7 @@ class SemaphoreStoreTest extends AbstractStoreTest /** * {@inheritdoc} */ - protected function getStore() + protected function getStore(): PersistingStoreInterface { return new SemaphoreStore(); } diff --git a/src/Symfony/Component/Lock/Tests/Store/ZookeeperStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/ZookeeperStoreTest.php index 0ba6d73b9f37b..981b62c6a0d72 100644 --- a/src/Symfony/Component/Lock/Tests/Store/ZookeeperStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/ZookeeperStoreTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Lock\Tests\Store; use Symfony\Component\Lock\Key; +use Symfony\Component\Lock\PersistingStoreInterface; use Symfony\Component\Lock\Store\StoreFactory; use Symfony\Component\Lock\Store\ZookeeperStore; @@ -22,7 +23,10 @@ */ class ZookeeperStoreTest extends AbstractStoreTest { - public function getStore(): ZookeeperStore + /** + * @return ZookeeperStore + */ + public function getStore(): PersistingStoreInterface { $zookeeper_server = getenv('ZOOKEEPER_HOST').':2181'; diff --git a/src/Symfony/Component/Mime/Header/DateHeader.php b/src/Symfony/Component/Mime/Header/DateHeader.php index fdc146447430d..a7385d4ce21a2 100644 --- a/src/Symfony/Component/Mime/Header/DateHeader.php +++ b/src/Symfony/Component/Mime/Header/DateHeader.php @@ -35,10 +35,7 @@ public function setBody($body) $this->setDateTime($body); } - /** - * @return \DateTimeImmutable - */ - public function getBody() + public function getBody(): \DateTimeImmutable { return $this->getDateTime(); } diff --git a/src/Symfony/Component/Mime/Header/IdentificationHeader.php b/src/Symfony/Component/Mime/Header/IdentificationHeader.php index 91facf72d5aff..8a94574e5c64a 100644 --- a/src/Symfony/Component/Mime/Header/IdentificationHeader.php +++ b/src/Symfony/Component/Mime/Header/IdentificationHeader.php @@ -44,10 +44,7 @@ public function setBody($body) $this->setId($body); } - /** - * @return array - */ - public function getBody() + public function getBody(): array { return $this->getIds(); } diff --git a/src/Symfony/Component/Mime/Header/MailboxHeader.php b/src/Symfony/Component/Mime/Header/MailboxHeader.php index 25dea2b169774..b58c8252fd7c3 100644 --- a/src/Symfony/Component/Mime/Header/MailboxHeader.php +++ b/src/Symfony/Component/Mime/Header/MailboxHeader.php @@ -42,10 +42,8 @@ public function setBody($body) /** * @throws RfcComplianceException - * - * @return Address */ - public function getBody() + public function getBody(): Address { return $this->getAddress(); } diff --git a/src/Symfony/Component/Mime/Header/MailboxListHeader.php b/src/Symfony/Component/Mime/Header/MailboxListHeader.php index e58d9d4f0b4a0..1d00fdb12c3da 100644 --- a/src/Symfony/Component/Mime/Header/MailboxListHeader.php +++ b/src/Symfony/Component/Mime/Header/MailboxListHeader.php @@ -48,7 +48,7 @@ public function setBody($body) * * @return Address[] */ - public function getBody() + public function getBody(): array { return $this->getAddresses(); } diff --git a/src/Symfony/Component/Mime/Header/PathHeader.php b/src/Symfony/Component/Mime/Header/PathHeader.php index cc450d6dd5053..5101ad0f9f410 100644 --- a/src/Symfony/Component/Mime/Header/PathHeader.php +++ b/src/Symfony/Component/Mime/Header/PathHeader.php @@ -40,10 +40,7 @@ public function setBody($body) $this->setAddress($body); } - /** - * @return Address - */ - public function getBody() + public function getBody(): Address { return $this->getAddress(); } diff --git a/src/Symfony/Component/Process/Pipes/AbstractPipes.php b/src/Symfony/Component/Process/Pipes/AbstractPipes.php index 69b0b3bb50e2d..54a6221382871 100644 --- a/src/Symfony/Component/Process/Pipes/AbstractPipes.php +++ b/src/Symfony/Component/Process/Pipes/AbstractPipes.php @@ -86,8 +86,6 @@ protected function unblock() /** * Writes input to stdin. * - * @return array|null - * * @throws InvalidArgumentException When an input iterator yields a non supported value */ protected function write(): ?array diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index c268a8dd571e3..d0c2e084c5b26 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -955,7 +955,7 @@ public function addErrorOutput(string $line) } /** - * Gets the last output time in seconds + * Gets the last output time in seconds. * * @return float|null The last output time in seconds or null if it isn't started */ diff --git a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestSingularAndPluralProps.php b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestSingularAndPluralProps.php index d8a8c76483147..128ba33cb6058 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestSingularAndPluralProps.php +++ b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestSingularAndPluralProps.php @@ -23,10 +23,7 @@ class TestSingularAndPluralProps /** @var array */ private $emails = []; - /** - * @return string|null - */ - public function getEmail() + public function getEmail(): ?string { return $this->email; } @@ -39,10 +36,7 @@ public function setEmail($email) $this->email = $email; } - /** - * @return array - */ - public function getEmails() + public function getEmails(): array { return $this->emails; } diff --git a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TypeHinted.php b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TypeHinted.php index ce0f3d89aaa30..c9a83c45e44fd 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TypeHinted.php +++ b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TypeHinted.php @@ -33,17 +33,11 @@ public function getDate() return $this->date; } - /** - * @return \Countable - */ - public function getCountable() + public function getCountable(): \Countable { return $this->countable; } - /** - * @param \Countable $countable - */ public function setCountable(\Countable $countable) { $this->countable = $countable; diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/CustomRouteCompiler.php b/src/Symfony/Component/Routing/Tests/Fixtures/CustomRouteCompiler.php index 22b942d7bc871..57c07c3140f75 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/CustomRouteCompiler.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/CustomRouteCompiler.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Routing\Tests\Fixtures; +use Symfony\Component\Routing\CompiledRoute; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCompiler; @@ -19,7 +20,7 @@ class CustomRouteCompiler extends RouteCompiler /** * {@inheritdoc} */ - public static function compile(Route $route) + public static function compile(Route $route): CompiledRoute { return new CustomCompiledRoute('', '', [], []); } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/CustomXmlFileLoader.php b/src/Symfony/Component/Routing/Tests/Fixtures/CustomXmlFileLoader.php index b7a02b60b0ae1..8757e0c3532c6 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/CustomXmlFileLoader.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/CustomXmlFileLoader.php @@ -19,7 +19,7 @@ */ class CustomXmlFileLoader extends XmlFileLoader { - protected function loadFile($file) + protected function loadFile($file): \DOMDocument { return XmlUtils::loadFile($file, function () { return true; }); } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/RedirectableUrlMatcher.php b/src/Symfony/Component/Routing/Tests/Fixtures/RedirectableUrlMatcher.php index 79ae1cce54ca9..c2a5ba3c2a877 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/RedirectableUrlMatcher.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/RedirectableUrlMatcher.php @@ -19,7 +19,7 @@ */ class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface { - public function redirect($path, $route, $scheme = null) + public function redirect($path, $route, $scheme = null): array { return [ '_controller' => 'Some controller reference...', diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/TestObjectRouteLoader.php b/src/Symfony/Component/Routing/Tests/Fixtures/TestObjectRouteLoader.php index d272196dd6f10..fd9a6cda958eb 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/TestObjectRouteLoader.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/TestObjectRouteLoader.php @@ -17,6 +17,9 @@ class TestObjectRouteLoader extends ObjectRouteLoader { public $loaderMap = []; + /** + * @return object + */ protected function getServiceObject($id) { return $this->loaderMap[$id] ?? null; diff --git a/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php index bf94ef34ae3a2..6c93facefe69c 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php @@ -98,11 +98,14 @@ class TestObjectLoader extends ObjectLoader { public $loaderMap = []; - public function supports($resource, $type = null) + public function supports($resource, $type = null): bool { return 'service'; } + /** + * @return object + */ protected function getObject(string $id) { return $this->loaderMap[$id] ?? null; diff --git a/src/Symfony/Component/Routing/Tests/Matcher/CompiledRedirectableUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/CompiledRedirectableUrlMatcherTest.php index 7fb7dfef9e97b..30773fa59499e 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/CompiledRedirectableUrlMatcherTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/CompiledRedirectableUrlMatcherTest.php @@ -33,7 +33,7 @@ protected function getUrlMatcher(RouteCollection $routes, RequestContext $contex class TestCompiledRedirectableUrlMatcher extends CompiledUrlMatcher implements RedirectableUrlMatcherInterface { - public function redirect($path, $route, $scheme = null) + public function redirect($path, $route, $scheme = null): array { return []; } diff --git a/src/Symfony/Component/Routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php index aed006f710c05..3b35ac4de5ffc 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php @@ -39,7 +39,7 @@ protected function getUrlMatcher(RouteCollection $routes, RequestContext $contex class TestDumpedRedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface { - public function redirect($path, $route, $scheme = null) + public function redirect($path, $route, $scheme = null): array { return []; } diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php index 744229b3ef9a7..4581fa89f197f 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/CompiledUrlMatcherDumperTest.php @@ -487,7 +487,7 @@ public function testGenerateDumperMatcherWithObject() class TestCompiledUrlMatcher extends CompiledUrlMatcher implements RedirectableUrlMatcherInterface { - public function redirect($path, $route, $scheme = null) + public function redirect($path, $route, $scheme = null): array { return []; } diff --git a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php index 4c15451209b0e..6f7a610324b6e 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php @@ -505,7 +505,7 @@ public function testGenerateDumperMatcherWithObject() abstract class RedirectableUrlMatcherStub extends UrlMatcher implements RedirectableUrlMatcherInterface { - public function redirect($path, $route, $scheme = null) + public function redirect($path, $route, $scheme = null): array { } } diff --git a/src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php b/src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php index 1115f9dddbf91..7690b3e2264bc 100644 --- a/src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php +++ b/src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php @@ -83,9 +83,6 @@ public function addVoterVote(VoterInterface $voter, array $attributes, int $vote ]; } - /** - * @return string - */ public function getStrategy(): string { // The $strategy property is misleading because it stores the name of its @@ -102,9 +99,6 @@ public function getVoters(): iterable return $this->voters; } - /** - * @return array - */ public function getDecisionLog(): array { return $this->decisionLog; diff --git a/src/Symfony/Component/Security/Core/Encoder/MigratingPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/MigratingPasswordEncoder.php index 77e6726808f9b..2c8a6f72ce9af 100644 --- a/src/Symfony/Component/Security/Core/Encoder/MigratingPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/MigratingPasswordEncoder.php @@ -34,7 +34,7 @@ public function __construct(PasswordEncoderInterface $bestEncoder, PasswordEncod /** * {@inheritdoc} */ - public function encodePassword($raw, $salt) + public function encodePassword($raw, $salt): string { return $this->bestEncoder->encodePassword($raw, $salt); } @@ -42,7 +42,7 @@ public function encodePassword($raw, $salt) /** * {@inheritdoc} */ - public function isPasswordValid($encoded, $raw, $salt) + public function isPasswordValid($encoded, $raw, $salt): bool { if ($this->bestEncoder->isPasswordValid($encoded, $raw, $salt)) { return true; diff --git a/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php index 351943764d3bd..bc900427afac1 100644 --- a/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php @@ -78,7 +78,7 @@ public function encodePassword($raw, $salt): string /** * {@inheritdoc} */ - public function isPasswordValid($encoded, $raw, $salt) + public function isPasswordValid($encoded, $raw, $salt): bool { if (72 < \strlen($raw) && 0 === strpos($encoded, '$2')) { // BCrypt encodes only the first 72 chars diff --git a/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php index 98e9110dca4dc..616e502b5a61e 100644 --- a/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php @@ -54,7 +54,7 @@ public static function isSupported(): bool /** * {@inheritdoc} */ - public function encodePassword($raw, $salt) + public function encodePassword($raw, $salt): string { if (\strlen($raw) > self::MAX_PASSWORD_LENGTH) { throw new BadCredentialsException('Invalid password.'); @@ -74,7 +74,7 @@ public function encodePassword($raw, $salt) /** * {@inheritdoc} */ - public function isPasswordValid($encoded, $raw, $salt) + public function isPasswordValid($encoded, $raw, $salt): bool { if (\strlen($raw) > self::MAX_PASSWORD_LENGTH) { return false; diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php index 940dcaffaa958..3556f4afeafcc 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php @@ -164,11 +164,11 @@ public function unserialize($serialized) { } - public function __toString() + public function __toString(): string { } - public function getRoles() + public function getRoles(): array { } @@ -184,11 +184,11 @@ public function setUser($user) { } - public function getUsername() + public function getUsername(): string { } - public function isAuthenticated() + public function isAuthenticated(): bool { } @@ -200,7 +200,7 @@ public function eraseCredentials() { } - public function getAttributes() + public function getAttributes(): array { } @@ -208,7 +208,7 @@ public function setAttributes(array $attributes) { } - public function hasAttribute($name) + public function hasAttribute($name): bool { } diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php index 25d22975eb3d3..63d4fb8b83778 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authorization/Voter/VoterTest.php @@ -59,12 +59,12 @@ public function testVote(array $attributes, $expectedVote, $object, $message) class VoterTest_Voter extends Voter { - protected function voteOnAttribute($attribute, $object, TokenInterface $token) + protected function voteOnAttribute($attribute, $object, TokenInterface $token): bool { return 'EDIT' === $attribute; } - protected function supports($attribute, $object) + protected function supports($attribute, $object): bool { return $object instanceof \stdClass && \in_array($attribute, ['EDIT', 'CREATE']); } diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php index c808d05522677..22d1881d6588a 100644 --- a/src/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Encoder/BasePasswordEncoderTest.php @@ -16,11 +16,11 @@ class PasswordEncoder extends BasePasswordEncoder { - public function encodePassword($raw, $salt) + public function encodePassword($raw, $salt): string { } - public function isPasswordValid($encoded, $raw, $salt) + public function isPasswordValid($encoded, $raw, $salt): bool { } } diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php index 0b2c36c72de4a..f2ad94e88478f 100644 --- a/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Encoder/EncoderFactoryTest.php @@ -135,19 +135,19 @@ public function testGetEncoderForEncoderAwareWithClassName() class SomeUser implements UserInterface { - public function getRoles() + public function getRoles(): array { } - public function getPassword() + public function getPassword(): ?string { } - public function getSalt() + public function getSalt(): ?string { } - public function getUsername() + public function getUsername(): string { } @@ -164,7 +164,7 @@ class EncAwareUser extends SomeUser implements EncoderAwareInterface { public $encoderName = 'encoder_name'; - public function getEncoderName() + public function getEncoderName(): ?string { return $this->encoderName; } diff --git a/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php index ce697e4ae933c..bec73072341a9 100644 --- a/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/User/InMemoryUserProviderTest.php @@ -40,10 +40,7 @@ public function testRefresh() $this->assertFalse($refreshedUser->isCredentialsNonExpired()); } - /** - * @return InMemoryUserProvider - */ - protected function createProvider() + protected function createProvider(): InMemoryUserProvider { return new InMemoryUserProvider([ 'fabien' => [ diff --git a/src/Symfony/Component/Security/Core/User/User.php b/src/Symfony/Component/Security/Core/User/User.php index 0233faf131029..cd763821c8391 100644 --- a/src/Symfony/Component/Security/Core/User/User.php +++ b/src/Symfony/Component/Security/Core/User/User.php @@ -61,7 +61,7 @@ public function getRoles() /** * {@inheritdoc} */ - public function getPassword() + public function getPassword(): ?string { return $this->password; } @@ -69,7 +69,7 @@ public function getPassword() /** * {@inheritdoc} */ - public function getSalt() + public function getSalt(): ?string { return null; } @@ -77,7 +77,7 @@ public function getSalt() /** * {@inheritdoc} */ - public function getUsername() + public function getUsername(): string { return $this->username; } @@ -85,7 +85,7 @@ public function getUsername() /** * {@inheritdoc} */ - public function isAccountNonExpired() + public function isAccountNonExpired(): bool { return $this->accountNonExpired; } @@ -93,7 +93,7 @@ public function isAccountNonExpired() /** * {@inheritdoc} */ - public function isAccountNonLocked() + public function isAccountNonLocked(): bool { return $this->accountNonLocked; } @@ -101,7 +101,7 @@ public function isAccountNonLocked() /** * {@inheritdoc} */ - public function isCredentialsNonExpired() + public function isCredentialsNonExpired(): bool { return $this->credentialsNonExpired; } @@ -109,7 +109,7 @@ public function isCredentialsNonExpired() /** * {@inheritdoc} */ - public function isEnabled() + public function isEnabled(): bool { return $this->enabled; } @@ -129,7 +129,7 @@ public function getExtraFields(): array /** * {@inheritdoc} */ - public function isEqualTo(UserInterface $user) + public function isEqualTo(UserInterface $user): bool { if (!$user instanceof self) { return false; diff --git a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php index cb889617b15cf..56ee7f39197b5 100644 --- a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php +++ b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\User\UserInterface; @@ -98,21 +99,19 @@ class TestFormLoginAuthenticator extends AbstractFormLoginAuthenticator private $loginUrl; private $defaultSuccessRedirectUrl; - public function supports(Request $request) + public function supports(Request $request): bool { return true; } - public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) + public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey): ?Response { } /** * @param mixed $defaultSuccessRedirectUrl - * - * @return TestFormLoginAuthenticator */ - public function setDefaultSuccessRedirectUrl($defaultSuccessRedirectUrl) + public function setDefaultSuccessRedirectUrl($defaultSuccessRedirectUrl): TestFormLoginAuthenticator { $this->defaultSuccessRedirectUrl = $defaultSuccessRedirectUrl; @@ -121,10 +120,8 @@ public function setDefaultSuccessRedirectUrl($defaultSuccessRedirectUrl) /** * @param mixed $loginUrl - * - * @return TestFormLoginAuthenticator */ - public function setLoginUrl($loginUrl) + public function setLoginUrl($loginUrl): TestFormLoginAuthenticator { $this->loginUrl = $loginUrl; @@ -134,7 +131,7 @@ public function setLoginUrl($loginUrl) /** * {@inheritdoc} */ - protected function getLoginUrl() + protected function getLoginUrl(): string { return $this->loginUrl; } @@ -158,7 +155,7 @@ public function getCredentials(Request $request) /** * {@inheritdoc} */ - public function getUser($credentials, UserProviderInterface $userProvider) + public function getUser($credentials, UserProviderInterface $userProvider): ?UserInterface { return $userProvider->loadUserByUsername($credentials); } @@ -166,7 +163,7 @@ public function getUser($credentials, UserProviderInterface $userProvider) /** * {@inheritdoc} */ - public function checkCredentials($credentials, UserInterface $user) + public function checkCredentials($credentials, UserInterface $user): bool { return true; } diff --git a/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php b/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php index 221d8d8eada5c..7774e7b4a2554 100644 --- a/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php +++ b/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php @@ -32,7 +32,7 @@ public function __construct(TokenStorageInterface $tokenStorage) $this->tokenStorage = $tokenStorage; } - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { // only security user implementations are supported if (UserInterface::class !== $argument->getType()) { @@ -50,7 +50,7 @@ public function supports(Request $request, ArgumentMetadata $argument) return $user instanceof UserInterface; } - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { yield $this->tokenStorage->getToken()->getUser(); } diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php index 07626cdad8e02..6801f951b9dd8 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ContextListenerTest.php @@ -380,17 +380,17 @@ private function handleEventWithPreviousSession(TokenStorageInterface $tokenStor class NotSupportingUserProvider implements UserProviderInterface { - public function loadUserByUsername($username) + public function loadUserByUsername($username): UserInterface { throw new UsernameNotFoundException(); } - public function refreshUser(UserInterface $user) + public function refreshUser(UserInterface $user): UserInterface { throw new UnsupportedUserException(); } - public function supportsClass($class) + public function supportsClass($class): bool { return false; } @@ -405,11 +405,11 @@ public function __construct(User $refreshedUser = null) $this->refreshedUser = $refreshedUser; } - public function loadUserByUsername($username) + public function loadUserByUsername($username): UserInterface { } - public function refreshUser(UserInterface $user) + public function refreshUser(UserInterface $user): UserInterface { if (!$user instanceof User) { throw new UnsupportedUserException(); @@ -422,7 +422,7 @@ public function refreshUser(UserInterface $user) return $this->refreshedUser; } - public function supportsClass($class) + public function supportsClass($class): bool { return 'Symfony\Component\Security\Core\User\User' === $class; } diff --git a/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php b/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php index a94bf70b58fd3..3565106f951a3 100644 --- a/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php +++ b/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php @@ -40,7 +40,7 @@ public function __construct(ClassMetadataFactoryInterface $metadataFactory, Name /** * {@inheritdoc} */ - public function normalize($propertyName, string $class = null, string $format = null, array $context = []) + public function normalize($propertyName, string $class = null, string $format = null, array $context = []): string { if (null === $class) { return $this->normalizeFallback($propertyName, $class, $format, $context); @@ -56,7 +56,7 @@ public function normalize($propertyName, string $class = null, string $format = /** * {@inheritdoc} */ - public function denormalize($propertyName, string $class = null, string $format = null, array $context = []) + public function denormalize($propertyName, string $class = null, string $format = null, array $context = []): string { if (null === $class) { return $this->denormalizeFallback($propertyName, $class, $format, $context); diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index 5f165b56ac774..0711f180004d0 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -544,11 +544,9 @@ protected function denormalizeParameter(\ReflectionClass $class, \ReflectionPara /** * @param string $attribute Attribute name * - * @return array - * * @internal */ - protected function createChildContext(array $parentContext, $attribute/*, ?string $format */) + protected function createChildContext(array $parentContext, $attribute/*, ?string $format */): array { if (\func_num_args() < 3) { @trigger_error(sprintf('Method "%s::%s()" will have a third "?string $format" argument in version 5.0; not defining it is deprecated since Symfony 4.3.', \get_class($this), __FUNCTION__), E_USER_DEPRECATED); diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index a0da6b9e55f73..a04da80f7d94c 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -567,7 +567,7 @@ private function isMaxDepthReached(array $attributesMetadata, string $class, str * * @internal */ - protected function createChildContext(array $parentContext, $attribute/*, ?string $format */) + protected function createChildContext(array $parentContext, $attribute/*, ?string $format */): array { if (\func_num_args() >= 3) { $format = func_get_arg(2); diff --git a/src/Symfony/Component/Serializer/Tests/DeserializeNestedArrayOfObjectsTest.php b/src/Symfony/Component/Serializer/Tests/DeserializeNestedArrayOfObjectsTest.php index ffdae811bb512..654a6c6e90717 100644 --- a/src/Symfony/Component/Serializer/Tests/DeserializeNestedArrayOfObjectsTest.php +++ b/src/Symfony/Component/Serializer/Tests/DeserializeNestedArrayOfObjectsTest.php @@ -64,7 +64,7 @@ class Zoo /** * @return Animal[] */ - public function getAnimals() + public function getAnimals(): array { return $this->animals; } @@ -94,7 +94,7 @@ public function __construct(array $animals = []) /** * @return Animal[] */ - public function getAnimals() + public function getAnimals(): array { return $this->animals; } @@ -110,10 +110,7 @@ public function __construct() echo ''; } - /** - * @return string|null - */ - public function getName() + public function getName(): ?string { return $this->name; } diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php index 2294b2afec512..4b97fdf534915 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php @@ -124,7 +124,7 @@ class ChainNormalizationAwareEncoder extends ChainEncoder implements Normalizati class NormalizationAwareEncoder implements EncoderInterface, NormalizationAwareInterface { - public function supportsEncoding($format) + public function supportsEncoding($format): bool { return true; } diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractNormalizerDummy.php b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractNormalizerDummy.php index 94a5e895c6c41..617c4e52fcfdf 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractNormalizerDummy.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractNormalizerDummy.php @@ -38,7 +38,7 @@ public function normalize($object, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = null) + public function supportsNormalization($data, $format = null): bool { return true; } @@ -53,7 +53,7 @@ public function denormalize($data, $type, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null) + public function supportsDenormalization($data, $type, $format = null): bool { return true; } diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/StaticConstructorNormalizer.php b/src/Symfony/Component/Serializer/Tests/Fixtures/StaticConstructorNormalizer.php index 67304831f8922..1b660b5337ae3 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/StaticConstructorNormalizer.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/StaticConstructorNormalizer.php @@ -21,7 +21,7 @@ class StaticConstructorNormalizer extends ObjectNormalizer /** * {@inheritdoc} */ - protected function getConstructor(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes) + protected function getConstructor(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes): ?\ReflectionMethod { if (is_a($class, StaticConstructorDummy::class, true)) { return new \ReflectionMethod($class, 'create'); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php index 68b912e42f08e..f6ad1a39558ec 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php @@ -214,7 +214,7 @@ public function testNormalizeEmptyObject() class AbstractObjectNormalizerDummy extends AbstractObjectNormalizer { - protected function extractAttributes($object, $format = null, array $context = []) + protected function extractAttributes($object, $format = null, array $context = []): array { return []; } @@ -228,11 +228,14 @@ protected function setAttributeValue($object, $attribute, $value, $format = null $object->$attribute = $value; } - protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) + protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []): bool { return \in_array($attribute, ['foo', 'baz', 'quux', 'value']); } + /** + * @return object + */ public function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, string $format = null) { return parent::instantiateObject($data, $class, $context, $reflectionClass, $allowedAttributes, $format); @@ -257,7 +260,7 @@ public function __construct() parent::__construct(new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()))); } - protected function extractAttributes($object, $format = null, array $context = []) + protected function extractAttributes($object, $format = null, array $context = []): array { } @@ -294,7 +297,7 @@ public function __construct($normalizers) $this->normalizers = $normalizers; } - public function serialize($data, $format, array $context = []) + public function serialize($data, $format, array $context = []): string { } @@ -313,7 +316,7 @@ public function denormalize($data, $type, $format = null, array $context = []) return null; } - public function supportsDenormalization($data, $type, $format = null) + public function supportsDenormalization($data, $type, $format = null): bool { return true; } @@ -321,7 +324,7 @@ public function supportsDenormalization($data, $type, $format = null) class AbstractObjectNormalizerCollectionDummy extends AbstractObjectNormalizer { - protected function extractAttributes($object, $format = null, array $context = []) + protected function extractAttributes($object, $format = null, array $context = []): array { } @@ -334,11 +337,14 @@ protected function setAttributeValue($object, $attribute, $value, $format = null $object->$attribute = $value; } - protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) + protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []): bool { return true; } + /** + * @return object + */ public function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, string $format = null) { return parent::instantiateObject($data, $class, $context, $reflectionClass, $allowedAttributes, $format); @@ -380,7 +386,7 @@ public function denormalize($data, $type, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null, array $context = []) + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return '[]' === substr($type, -2) && $this->serializer->supportsDenormalization($data, substr($type, 0, -2), $format, $context); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php index 577db7086f1df..3ef803db8e345 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php @@ -1004,7 +1004,7 @@ class ObjectInner class FormatAndContextAwareNormalizer extends ObjectNormalizer { - protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) + protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []): bool { if (\in_array($attribute, ['foo', 'bar']) && 'foo_and_bar_included' === $format) { return true; diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/TestDenormalizer.php b/src/Symfony/Component/Serializer/Tests/Normalizer/TestDenormalizer.php index eefef12d45188..abf1bcc3076db 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/TestDenormalizer.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/TestDenormalizer.php @@ -30,7 +30,7 @@ public function denormalize($data, $type, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null) + public function supportsDenormalization($data, $type, $format = null): bool { return true; } diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/TestNormalizer.php b/src/Symfony/Component/Serializer/Tests/Normalizer/TestNormalizer.php index ea57d2dfff541..5d1d102a247c3 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/TestNormalizer.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/TestNormalizer.php @@ -30,7 +30,7 @@ public function normalize($object, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = null) + public function supportsNormalization($data, $format = null): bool { return true; } diff --git a/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php b/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php index 30e6795a9b4aa..862b0f04d4b1c 100644 --- a/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php +++ b/src/Symfony/Component/Templating/Tests/DelegatingEngineTest.php @@ -150,15 +150,15 @@ interface MyStreamingEngine extends StreamingEngineInterface, EngineInterface class TestEngine implements EngineInterface { - public function render($name, array $parameters = []) + public function render($name, array $parameters = []): string { } - public function exists($name) + public function exists($name): bool { } - public function supports($name) + public function supports($name): bool { return true; } diff --git a/src/Symfony/Component/Templating/Tests/Fixtures/SimpleHelper.php b/src/Symfony/Component/Templating/Tests/Fixtures/SimpleHelper.php index 06efe71b27408..9538fcc313b54 100644 --- a/src/Symfony/Component/Templating/Tests/Fixtures/SimpleHelper.php +++ b/src/Symfony/Component/Templating/Tests/Fixtures/SimpleHelper.php @@ -27,7 +27,7 @@ public function __toString() return $this->value; } - public function getName() + public function getName(): string { return 'foo'; } diff --git a/src/Symfony/Component/Templating/Tests/Helper/HelperTest.php b/src/Symfony/Component/Templating/Tests/Helper/HelperTest.php index dec9082efc30f..e60ffc5e82619 100644 --- a/src/Symfony/Component/Templating/Tests/Helper/HelperTest.php +++ b/src/Symfony/Component/Templating/Tests/Helper/HelperTest.php @@ -26,7 +26,7 @@ public function testGetSetCharset() class ProjectTemplateHelper extends Helper { - public function getName() + public function getName(): string { return 'foo'; } diff --git a/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php index e66d62398a893..651c8e3b63d68 100644 --- a/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php +++ b/src/Symfony/Component/Templating/Tests/Loader/CacheLoaderTest.php @@ -87,7 +87,7 @@ public function load(TemplateReferenceInterface $template) return false; } - public function isFresh(TemplateReferenceInterface $template, $time) + public function isFresh(TemplateReferenceInterface $template, $time): bool { return false; } diff --git a/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php index 36a63bce3b679..1511156c0478c 100644 --- a/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php +++ b/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php @@ -79,7 +79,7 @@ public function getTemplatePathPatterns() return $this->templatePathPatterns; } - public static function isAbsolutePath($path) + public static function isAbsolutePath($path): bool { return parent::isAbsolutePath($path); } diff --git a/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php b/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php index da8c04caa4c97..4bebc5dce88bb 100644 --- a/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php +++ b/src/Symfony/Component/Templating/Tests/Loader/LoaderTest.php @@ -42,7 +42,7 @@ public function getDebugger() return $this->debugger; } - public function isFresh(TemplateReferenceInterface $template, $time) + public function isFresh(TemplateReferenceInterface $template, $time): bool { return false; } diff --git a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php index fc62a97dc26af..70b8be1689bef 100644 --- a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php +++ b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php @@ -14,6 +14,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Templating\Helper\SlotsHelper; use Symfony\Component\Templating\Loader\Loader; +use Symfony\Component\Templating\Loader\LoaderInterface; use Symfony\Component\Templating\PhpEngine; use Symfony\Component\Templating\Storage\StringStorage; use Symfony\Component\Templating\TemplateNameParser; @@ -194,7 +195,7 @@ public function testGetLoader() class ProjectTemplateEngine extends PhpEngine { - public function getLoader() + public function getLoader(): LoaderInterface { return $this->loader; } @@ -219,7 +220,7 @@ public function load(TemplateReferenceInterface $template) return false; } - public function isFresh(TemplateReferenceInterface $template, $time) + public function isFresh(TemplateReferenceInterface $template, $time): bool { return false; } diff --git a/src/Symfony/Component/Templating/Tests/Storage/StorageTest.php b/src/Symfony/Component/Templating/Tests/Storage/StorageTest.php index 3aac21dd7b665..8734886ac9936 100644 --- a/src/Symfony/Component/Templating/Tests/Storage/StorageTest.php +++ b/src/Symfony/Component/Templating/Tests/Storage/StorageTest.php @@ -25,7 +25,7 @@ public function testMagicToString() class TestStorage extends Storage { - public function getContent() + public function getContent(): string { } } diff --git a/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceSubscriber.php b/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceSubscriber.php index 65b60d6fee608..c7d8820e7cae6 100644 --- a/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceSubscriber.php +++ b/src/Symfony/Component/Translation/Tests/DependencyInjection/fixtures/ServiceSubscriber.php @@ -12,7 +12,7 @@ public function __construct(ContainerInterface $container) { } - public static function getSubscribedServices() + public static function getSubscribedServices(): array { return ['translator' => TranslatorInterface::class]; } diff --git a/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php index 20fa918bd69e7..6e42b1e5683e5 100644 --- a/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php +++ b/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php @@ -78,12 +78,12 @@ public function testDumpCreatesNestedDirectoriesAndFile() class ConcreteFileDumper extends FileDumper { - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []): string { return http_build_query($messages->all($domain), '', '&'); } - protected function getExtension() + protected function getExtension(): string { return 'concrete'; } diff --git a/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php b/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php index 696c92b2dd828..4b8bdffa237b3 100644 --- a/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php +++ b/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php @@ -57,10 +57,8 @@ public function testLangcodes($nplural, $langCodes) * This array should contain all currently known langcodes. * * As it is impossible to have this ever complete we should try as hard as possible to have it almost complete. - * - * @return array */ - public function successLangcodes() + public function successLangcodes(): array { return [ ['1', ['ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky']], @@ -79,7 +77,7 @@ public function successLangcodes() * * @return array with nplural together with langcodes */ - public function failingLangcodes() + public function failingLangcodes(): array { return [ ['1', ['fa']], diff --git a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php index 22f37346c3f9f..149a15fce22d8 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php @@ -300,7 +300,7 @@ private function createFailingLoader(): LoaderInterface class StaleResource implements SelfCheckingResourceInterface { - public function isFresh($timestamp) + public function isFresh($timestamp): bool { return false; } @@ -309,7 +309,7 @@ public function getResource() { } - public function __toString() + public function __toString(): string { return ''; } diff --git a/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php index 7ddd534275294..379210b54bc38 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php @@ -44,7 +44,7 @@ public function __construct(PropertyListExtractorInterface $listExtractor, Prope /** * {@inheritdoc} */ - public function loadClassMetadata(ClassMetadata $metadata) + public function loadClassMetadata(ClassMetadata $metadata): bool { $className = $metadata->getClassName(); if (null !== $this->classValidatorRegexp && !preg_match($this->classValidatorRegexp, $className)) { diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php index 1b92dc8c906a6..486901bfc31c9 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php @@ -114,10 +114,7 @@ public function testValidComparisonToValue($dirtyValue, $comparisonValue) $this->assertNoViolation(); } - /** - * @return array - */ - public function provideAllValidComparisons() + public function provideAllValidComparisons(): array { // The provider runs before setUp(), so we need to manually fix // the default timezone @@ -171,15 +168,9 @@ public function testInvalidValuePath() $this->validator->validate(5, $constraint); } - /** - * @return array - */ - abstract public function provideValidComparisons(); + abstract public function provideValidComparisons(): array; - /** - * @return array - */ - abstract public function provideValidComparisonsToPropertyPath(); + abstract public function provideValidComparisonsToPropertyPath(): array; /** * @dataProvider provideAllInvalidComparisons @@ -233,10 +224,7 @@ public function testInvalidComparisonToPropertyPathAddsPathAsParameter() ->assertRaised(); } - /** - * @return array - */ - public function provideAllInvalidComparisons() + public function provideAllInvalidComparisons(): array { // The provider runs before setUp(), so we need to manually fix // the default timezone @@ -249,22 +237,14 @@ public function provideAllInvalidComparisons() return $comparisons; } - /** - * @return array - */ - abstract public function provideInvalidComparisons(); + abstract public function provideInvalidComparisons(): array; /** * @param array|null $options Options for the constraint - * - * @return Constraint */ - abstract protected function createConstraint(array $options = null); + abstract protected function createConstraint(array $options = null): Constraint; - /** - * @return string|null - */ - protected function getErrorCode() + protected function getErrorCode(): ?string { return null; } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php index 2d42807821bb3..c14c1be6b3264 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php @@ -21,12 +21,12 @@ class ConcreteComposite extends Composite { public $constraints; - protected function getCompositeOption() + protected function getCompositeOption(): string { return 'constraints'; } - public function getDefaultOption() + public function getDefaultOption(): ?string { return 'constraints'; } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/DivisibleByValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/DivisibleByValidatorTest.php index e2d50574a7103..f11fdce97bc3d 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/DivisibleByValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/DivisibleByValidatorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\DivisibleBy; use Symfony\Component\Validator\Constraints\DivisibleByValidator; @@ -24,12 +25,12 @@ protected function createValidator() return new DivisibleByValidator(); } - protected function createConstraint(array $options = null) + protected function createConstraint(array $options = null): Constraint { return new DivisibleBy($options); } - protected function getErrorCode() + protected function getErrorCode(): ?string { return DivisibleBy::NOT_DIVISIBLE_BY; } @@ -37,7 +38,7 @@ protected function getErrorCode() /** * {@inheritdoc} */ - public function provideValidComparisons() + public function provideValidComparisons(): array { return [ [-7, 1], @@ -54,7 +55,7 @@ public function provideValidComparisons() /** * {@inheritdoc} */ - public function provideValidComparisonsToPropertyPath() + public function provideValidComparisonsToPropertyPath(): array { return [ [25], @@ -64,7 +65,7 @@ public function provideValidComparisonsToPropertyPath() /** * {@inheritdoc} */ - public function provideInvalidComparisons() + public function provideInvalidComparisons(): array { return [ [1, '1', 2, '2', 'integer'], diff --git a/src/Symfony/Component/Validator/Tests/Constraints/EqualToValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/EqualToValidatorTest.php index c1eb2f93ad754..6253b3c384224 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/EqualToValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/EqualToValidatorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\EqualTo; use Symfony\Component\Validator\Constraints\EqualToValidator; @@ -24,12 +25,12 @@ protected function createValidator() return new EqualToValidator(); } - protected function createConstraint(array $options = null) + protected function createConstraint(array $options = null): Constraint { return new EqualTo($options); } - protected function getErrorCode() + protected function getErrorCode(): ?string { return EqualTo::NOT_EQUAL_ERROR; } @@ -37,7 +38,7 @@ protected function getErrorCode() /** * {@inheritdoc} */ - public function provideValidComparisons() + public function provideValidComparisons(): array { return [ [3, 3], @@ -54,7 +55,7 @@ public function provideValidComparisons() /** * {@inheritdoc} */ - public function provideValidComparisonsToPropertyPath() + public function provideValidComparisonsToPropertyPath(): array { return [ [5], @@ -64,7 +65,7 @@ public function provideValidComparisonsToPropertyPath() /** * {@inheritdoc} */ - public function provideInvalidComparisons() + public function provideInvalidComparisons(): array { return [ [1, '1', 2, '2', 'integer'], diff --git a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php index d8d8eab8bdeee..8cbfc269e2c93 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\GreaterThanOrEqual; use Symfony\Component\Validator\Constraints\GreaterThanOrEqualValidator; @@ -24,12 +25,12 @@ protected function createValidator() return new GreaterThanOrEqualValidator(); } - protected function createConstraint(array $options = null) + protected function createConstraint(array $options = null): Constraint { return new GreaterThanOrEqual($options); } - protected function getErrorCode() + protected function getErrorCode(): ?string { return GreaterThanOrEqual::TOO_LOW_ERROR; } @@ -37,7 +38,7 @@ protected function getErrorCode() /** * {@inheritdoc} */ - public function provideValidComparisons() + public function provideValidComparisons(): array { return [ [3, 2], @@ -57,7 +58,7 @@ public function provideValidComparisons() /** * {@inheritdoc} */ - public function provideValidComparisonsToPropertyPath() + public function provideValidComparisonsToPropertyPath(): array { return [ [5], @@ -68,7 +69,7 @@ public function provideValidComparisonsToPropertyPath() /** * {@inheritdoc} */ - public function provideInvalidComparisons() + public function provideInvalidComparisons(): array { return [ [1, '1', 2, '2', 'integer'], diff --git a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php index 36ebb4de32764..6eab44d1a0f58 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\PositiveOrZero; /** @@ -18,7 +19,7 @@ */ class GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest extends GreaterThanOrEqualValidatorTest { - protected function createConstraint(array $options = null) + protected function createConstraint(array $options = null): Constraint { return new PositiveOrZero(); } @@ -26,7 +27,7 @@ protected function createConstraint(array $options = null) /** * {@inheritdoc} */ - public function provideValidComparisons() + public function provideValidComparisons(): array { return [ [0, 0], @@ -42,7 +43,7 @@ public function provideValidComparisons() /** * {@inheritdoc} */ - public function provideInvalidComparisons() + public function provideInvalidComparisons(): array { return [ [-1, '-1', 0, '0', 'integer'], diff --git a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorTest.php index e678496c41e68..8259d3a9bd62d 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\GreaterThan; use Symfony\Component\Validator\Constraints\GreaterThanValidator; @@ -24,12 +25,12 @@ protected function createValidator() return new GreaterThanValidator(); } - protected function createConstraint(array $options = null) + protected function createConstraint(array $options = null): Constraint { return new GreaterThan($options); } - protected function getErrorCode() + protected function getErrorCode(): ?string { return GreaterThan::TOO_LOW_ERROR; } @@ -37,7 +38,7 @@ protected function getErrorCode() /** * {@inheritdoc} */ - public function provideValidComparisons() + public function provideValidComparisons(): array { return [ [2, 1], @@ -53,7 +54,7 @@ public function provideValidComparisons() /** * {@inheritdoc} */ - public function provideValidComparisonsToPropertyPath() + public function provideValidComparisonsToPropertyPath(): array { return [ [6], @@ -63,7 +64,7 @@ public function provideValidComparisonsToPropertyPath() /** * {@inheritdoc} */ - public function provideInvalidComparisons() + public function provideInvalidComparisons(): array { return [ [1, '1', 2, '2', 'integer'], diff --git a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php index 639efffd2d561..4ea65a5fc51ad 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\Positive; /** @@ -18,7 +19,7 @@ */ class GreaterThanValidatorWithPositiveConstraintTest extends GreaterThanValidatorTest { - protected function createConstraint(array $options = null) + protected function createConstraint(array $options = null): Constraint { return new Positive(); } @@ -26,7 +27,7 @@ protected function createConstraint(array $options = null) /** * {@inheritdoc} */ - public function provideValidComparisons() + public function provideValidComparisons(): array { return [ [2, 0], @@ -39,7 +40,7 @@ public function provideValidComparisons() /** * {@inheritdoc} */ - public function provideInvalidComparisons() + public function provideInvalidComparisons(): array { return [ [0, '0', 0, '0', 'integer'], diff --git a/src/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php index c96ac16a91930..edcaac3589235 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\IdenticalTo; use Symfony\Component\Validator\Constraints\IdenticalToValidator; @@ -24,17 +25,17 @@ protected function createValidator() return new IdenticalToValidator(); } - protected function createConstraint(array $options = null) + protected function createConstraint(array $options = null): Constraint { return new IdenticalTo($options); } - protected function getErrorCode() + protected function getErrorCode(): ?string { return IdenticalTo::NOT_IDENTICAL_ERROR; } - public function provideAllValidComparisons() + public function provideAllValidComparisons(): array { $this->setDefaultTimezone('UTC'); @@ -50,7 +51,7 @@ public function provideAllValidComparisons() /** * {@inheritdoc} */ - public function provideValidComparisons() + public function provideValidComparisons(): array { $date = new \DateTime('2000-01-01'); $object = new ComparisonTest_Class(2); @@ -72,7 +73,7 @@ public function provideValidComparisons() /** * {@inheritdoc} */ - public function provideValidComparisonsToPropertyPath() + public function provideValidComparisonsToPropertyPath(): array { return [ [5], @@ -82,7 +83,7 @@ public function provideValidComparisonsToPropertyPath() /** * {@inheritdoc} */ - public function provideInvalidComparisons() + public function provideInvalidComparisons(): array { return [ [1, '1', 2, '2', 'integer'], diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorTest.php index b77deff6163d6..625b996931d5d 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\LessThanOrEqual; use Symfony\Component\Validator\Constraints\LessThanOrEqualValidator; @@ -24,12 +25,12 @@ protected function createValidator() return new LessThanOrEqualValidator(); } - protected function createConstraint(array $options = null) + protected function createConstraint(array $options = null): Constraint { return new LessThanOrEqual($options); } - protected function getErrorCode() + protected function getErrorCode(): ?string { return LessThanOrEqual::TOO_HIGH_ERROR; } @@ -37,7 +38,7 @@ protected function getErrorCode() /** * {@inheritdoc} */ - public function provideValidComparisons() + public function provideValidComparisons(): array { return [ [1, 2], @@ -59,7 +60,7 @@ public function provideValidComparisons() /** * {@inheritdoc} */ - public function provideValidComparisonsToPropertyPath() + public function provideValidComparisonsToPropertyPath(): array { return [ [4], @@ -70,7 +71,7 @@ public function provideValidComparisonsToPropertyPath() /** * {@inheritdoc} */ - public function provideInvalidComparisons() + public function provideInvalidComparisons(): array { return [ [2, '2', 1, '1', 'integer'], diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php index 47b9484808a7a..3bb1c6ea243d8 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\NegativeOrZero; /** @@ -18,7 +19,7 @@ */ class LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest extends LessThanOrEqualValidatorTest { - protected function createConstraint(array $options = null) + protected function createConstraint(array $options = null): Constraint { return new NegativeOrZero(); } @@ -26,7 +27,7 @@ protected function createConstraint(array $options = null) /** * {@inheritdoc} */ - public function provideValidComparisons() + public function provideValidComparisons(): array { return [ [0, 0], @@ -40,7 +41,7 @@ public function provideValidComparisons() /** * {@inheritdoc} */ - public function provideInvalidComparisons() + public function provideInvalidComparisons(): array { return [ [2, '2', 0, '0', 'integer'], diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorTest.php index 7d209ed5d4719..747a7dcd79d2f 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\LessThan; use Symfony\Component\Validator\Constraints\LessThanValidator; @@ -24,12 +25,12 @@ protected function createValidator() return new LessThanValidator(); } - protected function createConstraint(array $options = null) + protected function createConstraint(array $options = null): Constraint { return new LessThan($options); } - protected function getErrorCode() + protected function getErrorCode(): ?string { return LessThan::TOO_HIGH_ERROR; } @@ -37,7 +38,7 @@ protected function getErrorCode() /** * {@inheritdoc} */ - public function provideValidComparisons() + public function provideValidComparisons(): array { return [ [1, 2], @@ -53,7 +54,7 @@ public function provideValidComparisons() /** * {@inheritdoc} */ - public function provideValidComparisonsToPropertyPath() + public function provideValidComparisonsToPropertyPath(): array { return [ [4], @@ -63,7 +64,7 @@ public function provideValidComparisonsToPropertyPath() /** * {@inheritdoc} */ - public function provideInvalidComparisons() + public function provideInvalidComparisons(): array { return [ [3, '3', 2, '2', 'integer'], diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php index 8809355c35ba0..3203adabb98c4 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\Negative; /** @@ -18,7 +19,7 @@ */ class LessThanValidatorWithNegativeConstraintTest extends LessThanValidatorTest { - protected function createConstraint(array $options = null) + protected function createConstraint(array $options = null): Constraint { return new Negative(); } @@ -26,7 +27,7 @@ protected function createConstraint(array $options = null) /** * {@inheritdoc} */ - public function provideValidComparisons() + public function provideValidComparisons(): array { return [ [-1, 0], @@ -39,7 +40,7 @@ public function provideValidComparisons() /** * {@inheritdoc} */ - public function provideInvalidComparisons() + public function provideInvalidComparisons(): array { return [ [0, '0', 0, '0', 'integer'], diff --git a/src/Symfony/Component/Validator/Tests/Constraints/NotEqualToValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/NotEqualToValidatorTest.php index 810f7a175f104..e92d22d664aa4 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/NotEqualToValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/NotEqualToValidatorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\NotEqualTo; use Symfony\Component\Validator\Constraints\NotEqualToValidator; @@ -24,12 +25,12 @@ protected function createValidator() return new NotEqualToValidator(); } - protected function createConstraint(array $options = null) + protected function createConstraint(array $options = null): Constraint { return new NotEqualTo($options); } - protected function getErrorCode() + protected function getErrorCode(): ?string { return NotEqualTo::IS_EQUAL_ERROR; } @@ -37,7 +38,7 @@ protected function getErrorCode() /** * {@inheritdoc} */ - public function provideValidComparisons() + public function provideValidComparisons(): array { return [ [1, 2], @@ -53,7 +54,7 @@ public function provideValidComparisons() /** * {@inheritdoc} */ - public function provideValidComparisonsToPropertyPath() + public function provideValidComparisonsToPropertyPath(): array { return [ [0], @@ -63,7 +64,7 @@ public function provideValidComparisonsToPropertyPath() /** * {@inheritdoc} */ - public function provideInvalidComparisons() + public function provideInvalidComparisons(): array { return [ [3, '3', 3, '3', 'integer'], diff --git a/src/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php index 0cb9ec543114c..93befafe85735 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Validator\Tests\Constraints; +use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\NotIdenticalTo; use Symfony\Component\Validator\Constraints\NotIdenticalToValidator; @@ -24,12 +25,12 @@ protected function createValidator() return new NotIdenticalToValidator(); } - protected function createConstraint(array $options = null) + protected function createConstraint(array $options = null): Constraint { return new NotIdenticalTo($options); } - protected function getErrorCode() + protected function getErrorCode(): ?string { return NotIdenticalTo::IS_IDENTICAL_ERROR; } @@ -37,7 +38,7 @@ protected function getErrorCode() /** * {@inheritdoc} */ - public function provideValidComparisons() + public function provideValidComparisons(): array { return [ [1, 2], @@ -56,14 +57,14 @@ public function provideValidComparisons() /** * {@inheritdoc} */ - public function provideValidComparisonsToPropertyPath() + public function provideValidComparisonsToPropertyPath(): array { return [ [0], ]; } - public function provideAllInvalidComparisons() + public function provideAllInvalidComparisons(): array { $this->setDefaultTimezone('UTC'); @@ -79,7 +80,7 @@ public function provideAllInvalidComparisons() /** * {@inheritdoc} */ - public function provideInvalidComparisons() + public function provideInvalidComparisons(): array { $date = new \DateTime('2000-01-01'); $object = new ComparisonTest_Class(2); diff --git a/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php b/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php index adc292b213d88..12176c45a31fc 100644 --- a/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php +++ b/src/Symfony/Component/Validator/Tests/ContainerConstraintValidatorFactoryTest.php @@ -61,7 +61,7 @@ public function testGetInstanceInvalidValidatorClass() class DummyConstraint extends Constraint { - public function validatedBy() + public function validatedBy(): string { return DummyConstraintValidator::class; } diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintA.php b/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintA.php index 17ba03673d5d6..7c2fea8751c24 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintA.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintA.php @@ -19,7 +19,7 @@ class ConstraintA extends Constraint public $property1; public $property2; - public function getDefaultOption() + public function getDefaultOption(): ?string { return 'property2'; } diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintC.php b/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintC.php index 675066ef020f8..14cf65cf25213 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintC.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintC.php @@ -18,7 +18,7 @@ class ConstraintC extends Constraint { public $option1; - public function getRequiredOptions() + public function getRequiredOptions(): array { return ['option1']; } diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValue.php b/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValue.php index b3fbd7083cfda..72c99cc060a05 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValue.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValue.php @@ -19,7 +19,7 @@ class ConstraintWithValue extends Constraint public $property; public $value; - public function getDefaultOption() + public function getDefaultOption(): ?string { return 'property'; } diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValueAsDefault.php b/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValueAsDefault.php index 618cca74df04e..87b685e075ad3 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValueAsDefault.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintWithValueAsDefault.php @@ -19,7 +19,7 @@ class ConstraintWithValueAsDefault extends Constraint public $property; public $value; - public function getDefaultOption() + public function getDefaultOption(): ?string { return 'value'; } diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/FakeMetadataFactory.php b/src/Symfony/Component/Validator/Tests/Fixtures/FakeMetadataFactory.php index 5e34929be35e6..0f8f765b1bfaf 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/FakeMetadataFactory.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/FakeMetadataFactory.php @@ -13,13 +13,13 @@ use Symfony\Component\Validator\Exception\NoSuchMetadataException; use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; -use Symfony\Component\Validator\MetadataInterface; +use Symfony\Component\Validator\Mapping\MetadataInterface; class FakeMetadataFactory implements MetadataFactoryInterface { protected $metadatas = []; - public function getMetadataFor($class) + public function getMetadataFor($class): MetadataInterface { $hash = null; @@ -43,7 +43,7 @@ public function getMetadataFor($class) return $this->metadatas[$class]; } - public function hasMetadataFor($class) + public function hasMetadataFor($class): bool { $hash = null; diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php b/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php index a4d6a6ab474a8..80364acfe0933 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/FilesLoader.php @@ -25,7 +25,7 @@ public function __construct(array $paths, LoaderInterface $loader) parent::__construct($paths); } - protected function getFileLoaderInstance($file) + protected function getFileLoaderInstance($file): LoaderInterface { ++$this->timesCalled; diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php index f3332b8ff9dd2..a4f1385cee886 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php @@ -209,8 +209,10 @@ public function testGroupsFromParent() class TestLoader implements LoaderInterface { - public function loadClassMetadata(ClassMetadata $metadata) + public function loadClassMetadata(ClassMetadata $metadata): bool { $metadata->addConstraint(new ConstraintA()); + + return true; } } diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php index c727e43931d76..4cb354ec4e6dd 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php @@ -38,10 +38,7 @@ abstract class AbstractTest extends AbstractValidatorTest */ protected $validator; - /** - * @return ValidatorInterface - */ - abstract protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = []); + abstract protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = []): ValidatorInterface; protected function setUp(): void { diff --git a/src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php b/src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php index c0c7c3e96d7c6..c2838792421d1 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php @@ -23,10 +23,11 @@ use Symfony\Component\Validator\Tests\Constraints\Fixtures\ChildB; use Symfony\Component\Validator\Tests\Fixtures\Entity; use Symfony\Component\Validator\Validator\RecursiveValidator; +use Symfony\Component\Validator\Validator\ValidatorInterface; class RecursiveValidatorTest extends AbstractTest { - protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = []) + protected function createValidator(MetadataFactoryInterface $metadataFactory, array $objectInitializers = []): ValidatorInterface { $translator = new IdentityTranslator(); $translator->setLocale('en'); diff --git a/src/Symfony/Component/VarDumper/Caster/Caster.php b/src/Symfony/Component/VarDumper/Caster/Caster.php index 884e84de9b89d..2dc71b66b2dae 100644 --- a/src/Symfony/Component/VarDumper/Caster/Caster.php +++ b/src/Symfony/Component/VarDumper/Caster/Caster.php @@ -46,7 +46,7 @@ class Caster * * @return array The array-cast of the object, with prefixed dynamic properties */ - public static function castObject($obj, $class, $hasDebugInfo = false) + public static function castObject($obj, $class, $hasDebugInfo = false): array { $a = $obj instanceof \Closure ? [] : (array) $obj; @@ -110,7 +110,7 @@ public static function castObject($obj, $class, $hasDebugInfo = false) * * @return array The filtered array */ - public static function filter(array $a, $filter, array $listedProperties = [], &$count = 0) + public static function filter(array $a, $filter, array $listedProperties = [], &$count = 0): array { $count = 0; diff --git a/src/Symfony/Component/WebLink/HttpHeaderSerializer.php b/src/Symfony/Component/WebLink/HttpHeaderSerializer.php index 6c7a039326ce1..d80d96ec3b5ce 100644 --- a/src/Symfony/Component/WebLink/HttpHeaderSerializer.php +++ b/src/Symfony/Component/WebLink/HttpHeaderSerializer.php @@ -26,10 +26,8 @@ final class HttpHeaderSerializer * Builds the value of the "Link" HTTP header. * * @param LinkInterface[]|\Traversable $links - * - * @return string|null */ - public function serialize(iterable $links) + public function serialize(iterable $links): ?string { $elements = []; foreach ($links as $link) { diff --git a/src/Symfony/Component/Workflow/Definition.php b/src/Symfony/Component/Workflow/Definition.php index 8a6e94206d49c..dd907948906fd 100644 --- a/src/Symfony/Component/Workflow/Definition.php +++ b/src/Symfony/Component/Workflow/Definition.php @@ -49,10 +49,8 @@ public function __construct(array $places, array $transitions, $initialPlaces = /** * @deprecated since Symfony 4.3. Use getInitialPlaces() instead. - * - * @return string|null */ - public function getInitialPlace() + public function getInitialPlace(): ?string { @trigger_error(sprintf('Calling %s::getInitialPlace() is deprecated since Symfony 4.3. Call getInitialPlaces() instead.', __CLASS__), E_USER_DEPRECATED); diff --git a/src/Symfony/Component/Workflow/MarkingStore/MethodMarkingStore.php b/src/Symfony/Component/Workflow/MarkingStore/MethodMarkingStore.php index a2341aadbd2eb..df1a6a24ab09f 100644 --- a/src/Symfony/Component/Workflow/MarkingStore/MethodMarkingStore.php +++ b/src/Symfony/Component/Workflow/MarkingStore/MethodMarkingStore.php @@ -46,7 +46,7 @@ public function __construct(bool $singleState = false, string $property = 'marki /** * {@inheritdoc} */ - public function getMarking($subject) + public function getMarking($subject): Marking { $method = 'get'.ucfirst($this->property); diff --git a/src/Symfony/Component/Workflow/SupportStrategy/ClassInstanceSupportStrategy.php b/src/Symfony/Component/Workflow/SupportStrategy/ClassInstanceSupportStrategy.php index fb08b2c278339..c50c687fa46e0 100644 --- a/src/Symfony/Component/Workflow/SupportStrategy/ClassInstanceSupportStrategy.php +++ b/src/Symfony/Component/Workflow/SupportStrategy/ClassInstanceSupportStrategy.php @@ -32,15 +32,12 @@ public function __construct(string $className) /** * {@inheritdoc} */ - public function supports(Workflow $workflow, $subject) + public function supports(Workflow $workflow, $subject): bool { return $subject instanceof $this->className; } - /** - * @return string - */ - public function getClassName() + public function getClassName(): string { return $this->className; } diff --git a/src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php b/src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php index 9ebe6f4fb6047..0416e7a9db83c 100644 --- a/src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php +++ b/src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php @@ -44,7 +44,7 @@ class Logger extends AbstractLogger { public $logs = []; - public function log($level, $message, array $context = []) + public function log($level, $message, array $context = []): void { $this->logs[] = $message; } diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php index 1cfb5fc5eb490..26f58a1fa5ca1 100644 --- a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php +++ b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php @@ -574,9 +574,11 @@ class EventDispatcherMock implements \Symfony\Component\EventDispatcher\EventDis { public $dispatchedEvents = []; - public function dispatch($event, string $eventName = null) + public function dispatch($event, string $eventName = null): Event { $this->dispatchedEvents[] = $eventName; + + return $event; } public function addListener($eventName, $listener, $priority = 0) @@ -595,7 +597,7 @@ public function removeSubscriber(\Symfony\Component\EventDispatcher\EventSubscri { } - public function getListeners($eventName = null) + public function getListeners($eventName = null): array { } @@ -603,7 +605,7 @@ public function getListenerPriority($eventName, $listener) { } - public function hasListeners($eventName = null) + public function hasListeners($eventName = null): bool { } } diff --git a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php index b90eef2e9e24f..f18ea3e571de6 100644 --- a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php @@ -110,10 +110,7 @@ private function createFile($content): string return $filename; } - /** - * @return CommandTester - */ - protected function createCommandTester() + protected function createCommandTester(): CommandTester { $application = new Application(); $application->add(new LintCommand()); diff --git a/src/Symfony/Contracts/Tests/Cache/CacheTraitTest.php b/src/Symfony/Contracts/Tests/Cache/CacheTraitTest.php index f77d103c9353c..9d803c34d4fe9 100644 --- a/src/Symfony/Contracts/Tests/Cache/CacheTraitTest.php +++ b/src/Symfony/Contracts/Tests/Cache/CacheTraitTest.php @@ -127,39 +127,39 @@ class TestPool implements CacheItemPoolInterface { use CacheTrait; - public function hasItem($key) + public function hasItem($key): bool { } - public function deleteItem($key) + public function deleteItem($key): bool { } - public function deleteItems(array $keys = []) + public function deleteItems(array $keys = []): bool { } - public function getItem($key) + public function getItem($key): CacheItemInterface { } - public function getItems(array $key = []) + public function getItems(array $key = []): iterable { } - public function saveDeferred(CacheItemInterface $item) + public function saveDeferred(CacheItemInterface $item): bool { } - public function save(CacheItemInterface $item) + public function save(CacheItemInterface $item): bool { } - public function commit() + public function commit(): bool { } - public function clear() + public function clear(): bool { } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy