diff --git a/.github/patch-types.php b/.github/patch-types.php index d5897449138cd..75963bb46e7f3 100644 --- a/.github/patch-types.php +++ b/.github/patch-types.php @@ -31,9 +31,9 @@ case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/BadClasses/MissingParent.php'): case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/'): case false !== strpos($file, '/src/Symfony/Component/ErrorHandler/Tests/Fixtures/'): - case false !== strpos($file, '/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php'): - case false !== strpos($file, '/src/Symfony/Component/PropertyInfo/Tests/Fixtures/ParentDummy.php'): + case false !== strpos($file, '/src/Symfony/Component/PropertyInfo/Tests/Fixtures/'): case false !== strpos($file, '/src/Symfony/Component/Runtime/Internal/ComposerPlugin.php'): + case false !== strpos($file, '/src/Symfony/Component/Serializer/Tests/Fixtures/'): case false !== strpos($file, '/src/Symfony/Component/Serializer/Tests/Normalizer/Features/ObjectOuter.php'): case false !== strpos($file, '/src/Symfony/Component/VarDumper/Tests/Fixtures/NotLoadableClass.php'): case false !== strpos($file, '/src/Symfony/Component/VarDumper/Tests/Fixtures/ReflectionIntersectionTypeFixture.php'): diff --git a/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php b/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php index ff269bcf1ea6b..3a63471c6f630 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php +++ b/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php @@ -165,10 +165,8 @@ public function registerContainerConfiguration(LoaderInterface $loader) /** * @internal - * - * @return RouteCollection */ - public function loadRoutes(LoaderInterface $loader) + public function loadRoutes(LoaderInterface $loader): RouteCollection { $file = (new \ReflectionObject($this))->getFileName(); /* @var RoutingPhpFileLoader $kernelLoader */ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php index 35ce89f63887c..5a3d70717bcca 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php @@ -145,10 +145,7 @@ protected function tearDown(): void $this->fs->remove($this->translationDir); } - /** - * @return CommandTester - */ - private function createCommandTester($extractedMessages = [], $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []) + private function createCommandTester($extractedMessages = [], $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandTester { $translator = $this->createMock(Translator::class); $translator diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php index a666dfc4778fb..c66074b132695 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php @@ -106,7 +106,7 @@ protected function getKernelParameters(): array return $parameters; } - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('foo'); $rootNode = $treeBuilder->getRootNode(); @@ -119,7 +119,7 @@ public function load(array $configs, ContainerBuilder $container) { } - public function getNamespace() + public function getNamespace(): string { return ''; } @@ -129,7 +129,7 @@ public function getXsdValidationBasePath() return false; } - public function getAlias() + public function getAlias(): string { return 'foo'; } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterEntryPointsPassTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterEntryPointsPassTest.php index 53f24a153efc7..b10b8a810bc7a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterEntryPointsPassTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterEntryPointsPassTest.php @@ -93,7 +93,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio ], JsonResponse::HTTP_FORBIDDEN); } - public function start(Request $request, AuthenticationException $authException = null) + public function start(Request $request, AuthenticationException $authException = null): Response { } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php index 14cd5c4271adb..8719112f2484b 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php @@ -36,6 +36,7 @@ use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; use Symfony\Component\Security\Guard\AuthenticatorInterface as GuardAuthenticatorInterface; +use Symfony\Component\Security\Guard\Token\GuardTokenInterface; use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; use Symfony\Component\Security\Http\Authenticator\HttpBasicAuthenticator; use Symfony\Component\Security\Http\Authenticator\Passport\Passport; @@ -865,11 +866,11 @@ public function createToken(Passport $passport, string $firewallName): TokenInte class NullAuthenticator implements GuardAuthenticatorInterface { - public function start(Request $request, AuthenticationException $authException = null) + public function start(Request $request, AuthenticationException $authException = null): Response { } - public function supports(Request $request) + public function supports(Request $request): bool { } @@ -877,27 +878,27 @@ public function getCredentials(Request $request) { } - public function getUser($credentials, UserProviderInterface $userProvider) + public function getUser($credentials, UserProviderInterface $userProvider): ?UserInterface { } - public function checkCredentials($credentials, UserInterface $user) + public function checkCredentials($credentials, UserInterface $user): bool { } - public function createAuthenticatedToken(UserInterface $user, string $providerKey) + public function createAuthenticatedToken(UserInterface $user, string $providerKey): GuardTokenInterface { } - public function onAuthenticationFailure(Request $request, AuthenticationException $exception) + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response { } - public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey) + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey): ?Response { } - public function supportsRememberMe() + public function supportsRememberMe(): bool { } } @@ -922,7 +923,7 @@ public function createListeners(ContainerBuilder $container, string $firewallNam return ['custom_firewall_listener_id']; } - public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint) + public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint): array { $container->register('provider_id', \stdClass::class); $container->register('listener_id', \stdClass::class); @@ -930,12 +931,12 @@ public function create(ContainerBuilder $container, string $id, array $config, s return ['provider_id', 'listener_id', $defaultEntryPoint]; } - public function getPosition() + public function getPosition(): string { return 'form'; } - public function getKey() + public function getKey(): string { return 'custom_listener'; } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AnonymousBundle/AppCustomAuthenticator.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AnonymousBundle/AppCustomAuthenticator.php index 5069fa9cc7fa9..c1d38688ecd25 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AnonymousBundle/AppCustomAuthenticator.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AnonymousBundle/AppCustomAuthenticator.php @@ -21,7 +21,7 @@ class AppCustomAuthenticator extends AbstractGuardAuthenticator { - public function supports(Request $request) + public function supports(Request $request): bool { return false; } @@ -30,28 +30,28 @@ public function getCredentials(Request $request) { } - public function getUser($credentials, UserProviderInterface $userProvider) + public function getUser($credentials, UserProviderInterface $userProvider): ?UserInterface { } - public function checkCredentials($credentials, UserInterface $user) + public function checkCredentials($credentials, UserInterface $user): bool { } - public function onAuthenticationFailure(Request $request, AuthenticationException $exception) + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response { } - public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) + public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey): ?Response { } - public function start(Request $request, AuthenticationException $authException = null) + public function start(Request $request, AuthenticationException $authException = null): Response { return new Response($authException->getMessage(), Response::HTTP_UNAUTHORIZED); } - public function supportsRememberMe() + public function supportsRememberMe(): bool { } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php index f6f7aca9d5ec2..c77b1e204e0db 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php @@ -54,7 +54,7 @@ public function secureAction() /** * {@inheritdoc} */ - public static function getSubscribedServices() + public static function getSubscribedServices(): array { return [ 'form.factory' => FormFactoryInterface::class, diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php index 5904183581517..11d00e257e98a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php @@ -71,7 +71,7 @@ public function homepageAction() /** * {@inheritdoc} */ - public static function getSubscribedServices() + public static function getSubscribedServices(): array { return [ 'twig' => Environment::class, diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php index 99183293fb1e8..db6aacca8cfc2 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php @@ -63,7 +63,7 @@ public function secureAction() /** * {@inheritdoc} */ - public static function getSubscribedServices() + public static function getSubscribedServices(): array { return [ 'twig' => Environment::class, diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/GuardedBundle/AppCustomAuthenticator.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/GuardedBundle/AppCustomAuthenticator.php index 22d378835e4c0..43e439ecfa9bf 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/GuardedBundle/AppCustomAuthenticator.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/GuardedBundle/AppCustomAuthenticator.php @@ -21,7 +21,7 @@ class AppCustomAuthenticator extends AbstractGuardAuthenticator { - public function supports(Request $request) + public function supports(Request $request): bool { return '/manual_login' !== $request->getPathInfo() && '/profile' !== $request->getPathInfo(); } @@ -31,29 +31,29 @@ public function getCredentials(Request $request) throw new AuthenticationException('This should be hit'); } - public function getUser($credentials, UserProviderInterface $userProvider) + public function getUser($credentials, UserProviderInterface $userProvider): ?UserInterface { } - public function checkCredentials($credentials, UserInterface $user) + public function checkCredentials($credentials, UserInterface $user): bool { } - public function onAuthenticationFailure(Request $request, AuthenticationException $exception) + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response { return new Response('', 418); } - public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) + public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey): ?Response { } - public function start(Request $request, AuthenticationException $authException = null) + public function start(Request $request, AuthenticationException $authException = null): Response { return new Response($authException->getMessage(), Response::HTTP_UNAUTHORIZED); } - public function supportsRememberMe() + public function supportsRememberMe(): bool { } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/LoginLink/TestCustomLoginLinkSuccessHandler.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/LoginLink/TestCustomLoginLinkSuccessHandler.php index a20866c8cfd91..0d1501508b58a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/LoginLink/TestCustomLoginLinkSuccessHandler.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/LoginLink/TestCustomLoginLinkSuccessHandler.php @@ -4,12 +4,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 TestCustomLoginLinkSuccessHandler implements AuthenticationSuccessHandlerInterface { - public function onAuthenticationSuccess(Request $request, TokenInterface $token) + public function onAuthenticationSuccess(Request $request, TokenInterface $token): Response { return new JsonResponse(['message' => sprintf('Welcome %s!', $token->getUserIdentifier())]); } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php index 43479ca9cfd4d..a51702eec15b6 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/StaticTokenProvider.php @@ -29,7 +29,7 @@ public function __construct($kernel) } } - public function loadTokenBySeries(string $series) + public function loadTokenBySeries(string $series): PersistentTokenInterface { $token = self::$db[$series] ?? false; if (!$token) { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/UserChangingUserProvider.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/UserChangingUserProvider.php index a5306b6bf1607..f28bfff393693 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/UserChangingUserProvider.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/RememberMeBundle/Security/UserChangingUserProvider.php @@ -26,7 +26,7 @@ public function __construct(InMemoryUserProvider $inner) $this->inner = $inner; } - public function loadUserByUsername($username) + public function loadUserByUsername($username): UserInterface { return $this->inner->loadUserByUsername($username); } @@ -36,7 +36,7 @@ public function loadUserByIdentifier(string $userIdentifier): UserInterface return $this->inner->loadUserByIdentifier($userIdentifier); } - public function refreshUser(UserInterface $user) + public function refreshUser(UserInterface $user): UserInterface { $user = $this->inner->refreshUser($user); @@ -46,7 +46,7 @@ public function refreshUser(UserInterface $user) return $user; } - public function supportsClass($class) + public function supportsClass($class): bool { return $this->inner->supportsClass($class); } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/SecuredPageBundle/Security/Core/User/ArrayUserProvider.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/SecuredPageBundle/Security/Core/User/ArrayUserProvider.php index a5ca99a41b6b7..db9d39e7d6e74 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/SecuredPageBundle/Security/Core/User/ArrayUserProvider.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/SecuredPageBundle/Security/Core/User/ArrayUserProvider.php @@ -29,7 +29,7 @@ public function getUser($username) return $this->users[$username]; } - public function loadUserByUsername($username) + public function loadUserByUsername($username): UserInterface { return $this->loadUserByIdentifier($username); } @@ -48,7 +48,7 @@ public function loadUserByIdentifier(string $identifier): UserInterface return $user; } - public function refreshUser(UserInterface $user) + public function refreshUser(UserInterface $user): UserInterface { if (!$user instanceof UserInterface) { throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_debug_type($user))); @@ -60,7 +60,7 @@ public function refreshUser(UserInterface $user) return new $class($storedUser->getUserIdentifier(), $storedUser->getPassword(), $storedUser->getRoles(), $storedUser->isEnabled()); } - public function supportsClass($class) + public function supportsClass($class): bool { return InMemoryUser::class === $class || UserWithoutEquatable::class === $class; } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php index f435789f6f5f0..418bb55f14454 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php @@ -161,7 +161,7 @@ public function __toString() /** * {@inheritdoc} */ - public function getRoles() + public function getRoles(): array { return $this->roles; } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Functional/WebProfilerBundleKernel.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Functional/WebProfilerBundleKernel.php index 79b66a8fb23ca..28b85d916becd 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Functional/WebProfilerBundleKernel.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Functional/WebProfilerBundleKernel.php @@ -23,7 +23,7 @@ public function __construct() parent::__construct('test', false); } - public function registerBundles() + public function registerBundles(): iterable { return [ new FrameworkBundle(), @@ -59,7 +59,7 @@ public function getCacheDir(): string return sys_get_temp_dir().'/cache-'.spl_object_hash($this); } - public function getLogDir() + public function getLogDir(): string { return sys_get_temp_dir().'/log-'.spl_object_hash($this); } diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Configuration/CustomNodeDefinition.php b/src/Symfony/Component/Config/Tests/Fixtures/Configuration/CustomNodeDefinition.php index 9783947b9a229..d5f933a85f5bb 100644 --- a/src/Symfony/Component/Config/Tests/Fixtures/Configuration/CustomNodeDefinition.php +++ b/src/Symfony/Component/Config/Tests/Fixtures/Configuration/CustomNodeDefinition.php @@ -3,11 +3,12 @@ namespace Symfony\Component\Config\Tests\Fixtures\Configuration; +use Symfony\Component\Config\Definition\NodeInterface; use Symfony\Component\Config\Definition\Builder\NodeDefinition; class CustomNodeDefinition extends NodeDefinition { - protected function createNode() + protected function createNode(): NodeInterface { return new CustomNode(); } diff --git a/src/Symfony/Component/Console/Terminal.php b/src/Symfony/Component/Console/Terminal.php index 5e5a3c2f767db..08c53535b1d35 100644 --- a/src/Symfony/Component/Console/Terminal.php +++ b/src/Symfony/Component/Console/Terminal.php @@ -57,10 +57,8 @@ public function getHeight() /** * @internal - * - * @return bool */ - public static function hasSttyAvailable() + public static function hasSttyAvailable(): bool { if (null !== self::$stty) { return self::$stty; diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 2b63dd1e42704..81dfe7e9a2b5b 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -1947,7 +1947,7 @@ public function handleSignal(int $signal): void $this->signaled = true; } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { for ($i = 0; $i < $this->loop; ++$i) { usleep(100); diff --git a/src/Symfony/Component/Console/Tests/Descriptor/ApplicationDescriptionTest.php b/src/Symfony/Component/Console/Tests/Descriptor/ApplicationDescriptionTest.php index 33d5c3840f3e3..b3ba9d8482b0f 100644 --- a/src/Symfony/Component/Console/Tests/Descriptor/ApplicationDescriptionTest.php +++ b/src/Symfony/Component/Console/Tests/Descriptor/ApplicationDescriptionTest.php @@ -46,7 +46,7 @@ final class TestApplication extends Application /** * {@inheritdoc} */ - protected function getDefaultCommands() + protected function getDefaultCommands(): array { return []; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php index d750ce69583d7..b7ea0f4ac84bb 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php @@ -376,15 +376,15 @@ public function reset() { } - public function supports(ResourceInterface $metadata) + public function supports(ResourceInterface $metadata): bool { } - public function isFresh(ResourceInterface $resource, $timestamp) + public function isFresh(ResourceInterface $resource, $timestamp): bool { } - public static function getSubscribedServices() + public static function getSubscribedServices(): array { } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php b/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php index e03f9fc55585e..d8a3a0006dbc4 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ServiceLocatorTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\DependencyInjection\Tests; +use Psr\Container\ContainerInterface; use Psr\Container\NotFoundExceptionInterface; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; @@ -21,7 +22,7 @@ class ServiceLocatorTest extends BaseServiceLocatorTest { - public function getServiceLocator(array $factories) + public function getServiceLocator(array $factories): ContainerInterface { return new ServiceLocator($factories); } diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/Cache/ChoiceLoader.php b/src/Symfony/Component/Form/ChoiceList/Factory/Cache/ChoiceLoader.php index f0e1067b90710..83b2ca0aa2ab4 100644 --- a/src/Symfony/Component/Form/ChoiceList/Factory/Cache/ChoiceLoader.php +++ b/src/Symfony/Component/Form/ChoiceList/Factory/Cache/ChoiceLoader.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Form\ChoiceList\Factory\Cache; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; use Symfony\Component\Form\FormTypeExtensionInterface; use Symfony\Component\Form\FormTypeInterface; @@ -28,7 +29,7 @@ final class ChoiceLoader extends AbstractStaticOption implements ChoiceLoaderInt /** * {@inheritdoc} */ - public function loadChoiceList(callable $value = null) + public function loadChoiceList(callable $value = null): ChoiceListInterface { return $this->getOption()->loadChoiceList($value); } @@ -36,7 +37,7 @@ public function loadChoiceList(callable $value = null) /** * {@inheritdoc} */ - public function loadChoicesForValues(array $values, callable $value = null) + public function loadChoicesForValues(array $values, callable $value = null): array { return $this->getOption()->loadChoicesForValues($values, $value); } @@ -44,7 +45,7 @@ public function loadChoicesForValues(array $values, callable $value = null) /** * {@inheritdoc} */ - public function loadValuesForChoices(array $choices, callable $value = null) + public function loadValuesForChoices(array $choices, callable $value = null): array { return $this->getOption()->loadValuesForChoices($choices, $value); } diff --git a/src/Symfony/Component/Form/ChoiceList/Loader/AbstractChoiceLoader.php b/src/Symfony/Component/Form/ChoiceList/Loader/AbstractChoiceLoader.php index ea736a52c683f..a30af63b1ab57 100644 --- a/src/Symfony/Component/Form/ChoiceList/Loader/AbstractChoiceLoader.php +++ b/src/Symfony/Component/Form/ChoiceList/Loader/AbstractChoiceLoader.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Form\ChoiceList\Loader; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; /** * @author Jules Pietri @@ -30,7 +31,7 @@ abstract class AbstractChoiceLoader implements ChoiceLoaderInterface * * {@inheritdoc} */ - public function loadChoiceList(callable $value = null) + public function loadChoiceList(callable $value = null): ChoiceListInterface { return $this->choiceList ?? ($this->choiceList = new ArrayChoiceList($this->loadChoices(), $value)); } diff --git a/src/Symfony/Component/Form/Tests/Fixtures/ChoiceList/DeprecatedChoiceListFactory.php b/src/Symfony/Component/Form/Tests/Fixtures/ChoiceList/DeprecatedChoiceListFactory.php index 6361c2eedc33f..89d4ec182ed74 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/ChoiceList/DeprecatedChoiceListFactory.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/ChoiceList/DeprecatedChoiceListFactory.php @@ -5,18 +5,19 @@ use Symfony\Component\Form\ChoiceList\ChoiceListInterface; use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; +use Symfony\Component\Form\ChoiceList\View\ChoiceListView; class DeprecatedChoiceListFactory implements ChoiceListFactoryInterface { - public function createListFromChoices(iterable $choices, callable $value = null) + public function createListFromChoices(iterable $choices, callable $value = null): ChoiceListInterface { } - public function createListFromLoader(ChoiceLoaderInterface $loader, callable $value = null) + public function createListFromLoader(ChoiceLoaderInterface $loader, callable $value = null): ChoiceListInterface { } - public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, callable $index = null, callable $groupBy = null, $attr = null) + public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, callable $index = null, callable $groupBy = null, $attr = null): ChoiceListView { } } diff --git a/src/Symfony/Component/HttpClient/CurlHttpClient.php b/src/Symfony/Component/HttpClient/CurlHttpClient.php index 5ab0040db3be9..e4092005a900f 100644 --- a/src/Symfony/Component/HttpClient/CurlHttpClient.php +++ b/src/Symfony/Component/HttpClient/CurlHttpClient.php @@ -345,10 +345,7 @@ public function reset() $this->multi->reset(); } - /** - * @return array - */ - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } diff --git a/src/Symfony/Component/HttpClient/HttplugClient.php b/src/Symfony/Component/HttpClient/HttplugClient.php index 7be016da9d8e9..df0cca1ce9622 100644 --- a/src/Symfony/Component/HttpClient/HttplugClient.php +++ b/src/Symfony/Component/HttpClient/HttplugClient.php @@ -218,10 +218,7 @@ public function createUri($uri): UriInterface throw new \LogicException(sprintf('You cannot use "%s()" as the "nyholm/psr7" package is not installed. Try running "composer require nyholm/psr7".', __METHOD__)); } - /** - * @return array - */ - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } diff --git a/src/Symfony/Component/HttpClient/Response/AmpResponse.php b/src/Symfony/Component/HttpClient/Response/AmpResponse.php index 27ba36bdf8922..8d5ef3d131ec3 100644 --- a/src/Symfony/Component/HttpClient/Response/AmpResponse.php +++ b/src/Symfony/Component/HttpClient/Response/AmpResponse.php @@ -142,10 +142,7 @@ public function getInfo(string $type = null) return null !== $type ? $this->info[$type] ?? null : $this->info; } - /** - * @return array - */ - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } diff --git a/src/Symfony/Component/HttpClient/Response/CommonResponseTrait.php b/src/Symfony/Component/HttpClient/Response/CommonResponseTrait.php index f3c8e149f77f7..bf947c69d1b32 100644 --- a/src/Symfony/Component/HttpClient/Response/CommonResponseTrait.php +++ b/src/Symfony/Component/HttpClient/Response/CommonResponseTrait.php @@ -127,10 +127,7 @@ public function toStream(bool $throw = true) return $stream; } - /** - * @return array - */ - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } diff --git a/src/Symfony/Component/HttpFoundation/Cookie.php b/src/Symfony/Component/HttpFoundation/Cookie.php index bb42641c594ed..3c4192c522553 100644 --- a/src/Symfony/Component/HttpFoundation/Cookie.php +++ b/src/Symfony/Component/HttpFoundation/Cookie.php @@ -156,10 +156,8 @@ public function withExpires($expire = 0): self * Converts expires formats to a unix timestamp. * * @param int|string|\DateTimeInterface $expire - * - * @return int */ - private static function expiresTimestamp($expire = 0) + private static function expiresTimestamp($expire = 0): int { // convert expiration time to a Unix timestamp if ($expire instanceof \DateTimeInterface) { diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 1b705aa207925..2a9741e89e31a 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -912,7 +912,7 @@ public function getBaseUrl() * * @return string The raw URL (i.e. not urldecoded) */ - private function getBaseUrlReal() + private function getBaseUrlReal(): string { if (null === $this->baseUrl) { $this->baseUrl = $this->prepareBaseUrl(); diff --git a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php index 28b7bdee06cfe..02d07fe1bcce9 100644 --- a/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php @@ -57,7 +57,7 @@ public function __construct(string $file) /** * @return string[] */ - public function warmUp(string $cacheDir) + public function warmUp(string $cacheDir): array { $this->writeCacheFile($this->file, 'content'); diff --git a/src/Symfony/Component/Lock/Lock.php b/src/Symfony/Component/Lock/Lock.php index 98dc10ce23109..166b68681de0d 100644 --- a/src/Symfony/Component/Lock/Lock.php +++ b/src/Symfony/Component/Lock/Lock.php @@ -52,7 +52,7 @@ public function __construct(Key $key, PersistingStoreInterface $store, float $tt /** * @return array */ - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } diff --git a/src/Symfony/Component/Mailer/DataCollector/MessageDataCollector.php b/src/Symfony/Component/Mailer/DataCollector/MessageDataCollector.php index a5b474c2b8aba..2200d9fe61804 100644 --- a/src/Symfony/Component/Mailer/DataCollector/MessageDataCollector.php +++ b/src/Symfony/Component/Mailer/DataCollector/MessageDataCollector.php @@ -53,7 +53,7 @@ public function reset() /** * {@inheritdoc} */ - public function getName() + public function getName(): string { return 'mailer'; } diff --git a/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php b/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php index 34fa328486e7a..37abd4313dcbe 100644 --- a/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php +++ b/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/PostgreSqlConnection.php @@ -38,7 +38,7 @@ final class PostgreSqlConnection extends Connection /** * @return array */ - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } diff --git a/src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php b/src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php index 9be0bf178ea4f..d3e70d525d146 100644 --- a/src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php +++ b/src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php @@ -54,7 +54,7 @@ public function normalize($object, string $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsNormalization($data, string $format = null, array $context = []) + public function supportsNormalization($data, string $format = null, array $context = []): bool { return $data instanceof FlattenException && ($context[Serializer::MESSENGER_SERIALIZATION_CONTEXT] ?? false); } @@ -93,7 +93,7 @@ public function denormalize($data, string $type, string $format = null, array $c /** * {@inheritdoc} */ - public function supportsDenormalization($data, string $type, string $format = null, array $context = []) + public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool { return FlattenException::class === $type && ($context[Serializer::MESSENGER_SERIALIZATION_CONTEXT] ?? false); } diff --git a/src/Symfony/Component/Notifier/DataCollector/NotificationDataCollector.php b/src/Symfony/Component/Notifier/DataCollector/NotificationDataCollector.php index 0bd03e919b2ab..0a0a70c990d69 100644 --- a/src/Symfony/Component/Notifier/DataCollector/NotificationDataCollector.php +++ b/src/Symfony/Component/Notifier/DataCollector/NotificationDataCollector.php @@ -53,7 +53,7 @@ public function reset() /** * {@inheritdoc} */ - public function getName() + public function getName(): string { return 'notifier'; } diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ConstructorExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ConstructorExtractor.php index 86dc43f13b9f5..f8ea6de18529d 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ConstructorExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ConstructorExtractor.php @@ -34,7 +34,7 @@ public function __construct(iterable $extractors = []) /** * {@inheritdoc} */ - public function getTypes(string $class, string $property, array $context = []) + public function getTypes(string $class, string $property, array $context = []): ?array { foreach ($this->extractors as $extractor) { $value = $extractor->getTypesFromConstructor($class, $property); diff --git a/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php index 54d3643b1f584..fcd679ead9e31 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php @@ -103,7 +103,7 @@ public function supports($resource, string $type = null): bool return 'service'; } - protected function getObject(string $id) + protected function getObject(string $id): object { return $this->loaderMap[$id] ?? null; } diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php index 9113d064aacdc..9500117f4f59c 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Security\Core\Tests\Authentication; +use Symfony\Component\Security\Core\User\UserInterface; use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver; use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken; @@ -176,7 +177,7 @@ public function getCredentials() { } - public function getUser() + public function getUser(): UserInterface { } diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php index 563c9db951962..63a9261fadf8a 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/DaoAuthenticationProviderTest.php @@ -391,5 +391,5 @@ public function loadUserByIdentifier(string $identifier): UserInterface; interface DaoAuthenticationProviderTest_UserProvider extends UserProviderInterface { - public function loadUserByUsername($username); + public function loadUserByUsername($username): string; } diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php index be4ccf0989848..a52eb4753490d 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php @@ -268,22 +268,22 @@ public function __construct($name, array $roles = []) $this->roles = $roles; } - public function getUsername() + public function getUsername(): string { return $this->name; } - public function getUserIdentifier() + public function getUserIdentifier(): string { return $this->name; } - public function getPassword() + public function getPassword(): ?string { return '***'; } - public function getRoles() + public function getRoles(): array { if (empty($this->roles)) { return ['ROLE_USER']; @@ -296,7 +296,7 @@ public function eraseCredentials() { } - public function getSalt() + public function getSalt(): ?string { return null; } diff --git a/src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php b/src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php index b8062b268653a..da61fa59166fb 100644 --- a/src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php @@ -152,5 +152,5 @@ abstract class TestPasswordAuthenticatedUser implements UserInterface, PasswordA { abstract public function getPassword(): ?string; - abstract public function getSalt(); + abstract public function getSalt(): ?string; } diff --git a/src/Symfony/Component/Semaphore/Semaphore.php b/src/Symfony/Component/Semaphore/Semaphore.php index 5614364c7bb86..8c1db61471b9a 100644 --- a/src/Symfony/Component/Semaphore/Semaphore.php +++ b/src/Symfony/Component/Semaphore/Semaphore.php @@ -49,7 +49,7 @@ public function __construct(Key $key, PersistingStoreInterface $store, float $tt /** * @return array */ - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } diff --git a/src/Symfony/Component/Serializer/CacheWarmer/CompiledClassMetadataCacheWarmer.php b/src/Symfony/Component/Serializer/CacheWarmer/CompiledClassMetadataCacheWarmer.php index 360640e139723..de12fa1be299a 100644 --- a/src/Symfony/Component/Serializer/CacheWarmer/CompiledClassMetadataCacheWarmer.php +++ b/src/Symfony/Component/Serializer/CacheWarmer/CompiledClassMetadataCacheWarmer.php @@ -40,7 +40,7 @@ public function __construct(array $classesToCompile, ClassMetadataFactoryInterfa /** * {@inheritdoc} */ - public function warmUp($cacheDir) + public function warmUp($cacheDir): array { $metadatas = []; @@ -58,7 +58,7 @@ public function warmUp($cacheDir) /** * {@inheritdoc} */ - public function isOptional() + public function isOptional(): bool { return true; } diff --git a/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php b/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php index 48722d21c1bcc..3cdc62a745216 100644 --- a/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php @@ -35,7 +35,7 @@ public function __construct(array $encoders = []) /** * {@inheritdoc} */ - final public function encode($data, string $format, array $context = []) + final public function encode($data, string $format, array $context = []): string { return $this->getEncoder($format, $context)->encode($data, $format, $context); } diff --git a/src/Symfony/Component/Serializer/Mapping/Factory/CompiledClassMetadataFactory.php b/src/Symfony/Component/Serializer/Mapping/Factory/CompiledClassMetadataFactory.php index 17daf9e66d2e8..3adf65f052106 100644 --- a/src/Symfony/Component/Serializer/Mapping/Factory/CompiledClassMetadataFactory.php +++ b/src/Symfony/Component/Serializer/Mapping/Factory/CompiledClassMetadataFactory.php @@ -14,6 +14,7 @@ use Symfony\Component\Serializer\Mapping\AttributeMetadata; use Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping; use Symfony\Component\Serializer\Mapping\ClassMetadata; +use Symfony\Component\Serializer\Mapping\ClassMetadataInterface; /** * @author Fabien Bourigault @@ -44,7 +45,7 @@ public function __construct(string $compiledClassMetadataFile, ClassMetadataFact /** * {@inheritdoc} */ - public function getMetadataFor($value) + public function getMetadataFor($value): ClassMetadataInterface { $className = \is_object($value) ? \get_class($value) : $value; @@ -72,7 +73,7 @@ public function getMetadataFor($value) /** * {@inheritdoc} */ - public function hasMetadataFor($value) + public function hasMetadataFor($value): bool { $className = \is_object($value) ? \get_class($value) : $value; diff --git a/src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php index 808e046283356..b129bb6a81f03 100644 --- a/src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/BackedEnumNormalizer.php @@ -40,7 +40,7 @@ public function normalize($object, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = null) + public function supportsNormalization($data, $format = null): bool { return $data instanceof \BackedEnum; } @@ -70,7 +70,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 is_subclass_of($type, \BackedEnum::class); } diff --git a/src/Symfony/Component/Serializer/Normalizer/MimeMessageNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/MimeMessageNormalizer.php index 0708847bde0e5..5f3de19335473 100644 --- a/src/Symfony/Component/Serializer/Normalizer/MimeMessageNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/MimeMessageNormalizer.php @@ -100,7 +100,7 @@ public function denormalize($data, string $type, string $format = null, array $c /** * {@inheritdoc} */ - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, string $format = null): bool { return $data instanceof Message || $data instanceof Headers || $data instanceof HeaderInterface || $data instanceof Address || $data instanceof AbstractPart; } @@ -108,7 +108,7 @@ public function supportsNormalization($data, string $format = null) /** * {@inheritdoc} */ - public function supportsDenormalization($data, string $type, string $format = null) + public function supportsDenormalization($data, string $type, string $format = null): bool { return is_a($type, Message::class, true) || Headers::class === $type || AbstractPart::class === $type; } diff --git a/src/Symfony/Component/Serializer/Normalizer/UidNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/UidNormalizer.php index 009d334895ee8..55508a962df4f 100644 --- a/src/Symfony/Component/Serializer/Normalizer/UidNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/UidNormalizer.php @@ -59,7 +59,7 @@ public function normalize($object, string $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsNormalization($data, string $format = null) + public function supportsNormalization($data, string $format = null): bool { return $data instanceof AbstractUid; } @@ -79,7 +79,7 @@ public function denormalize($data, string $type, string $format = null, array $c /** * {@inheritdoc} */ - public function supportsDenormalization($data, string $type, string $format = null) + public function supportsDenormalization($data, string $type, string $format = null): bool { return is_a($type, AbstractUid::class, true); } diff --git a/src/Symfony/Component/Serializer/Normalizer/UnwrappingDenormalizer.php b/src/Symfony/Component/Serializer/Normalizer/UnwrappingDenormalizer.php index 6bc8df80bb3cd..9e9880d901167 100644 --- a/src/Symfony/Component/Serializer/Normalizer/UnwrappingDenormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/UnwrappingDenormalizer.php @@ -54,7 +54,7 @@ public function denormalize($data, $class, string $format = null, array $context /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, string $format = null, array $context = []) + public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool { return \array_key_exists(self::UNWRAP_PATH, $context) && !isset($context['unwrapped']); } diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index d2c0741457d9e..29f829a3a6b0a 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -316,7 +316,7 @@ private function getDenormalizer($data, string $class, ?string $format, array $c /** * {@inheritdoc} */ - final public function encode($data, string $format, array $context = []) + final public function encode($data, string $format, array $context = []): string { return $this->encoder->encode($data, $format, $context); } diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php index d90163d2537a0..f447c684a39eb 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/ChainEncoderTest.php @@ -95,7 +95,7 @@ public function supportsEncoding(string $format): bool return true; } - public function encode($data, string $format, array $context = []) + public function encode($data, string $format, array $context = []): string { } } diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php index e8243b1609ff6..73fcea051c7dd 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php @@ -622,7 +622,7 @@ class NotSerializable /** * @return array */ - public function __sleep() + public function __sleep(): array { if (class_exists(\Error::class)) { throw new \Error('not serializable'); diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php index b2a76656d76fe..14fe5382b3198 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/PropertyNormalizerTest.php @@ -483,7 +483,7 @@ public function getChildren(): array /** * @return Dummy[][][] */ - public function getGrandChildren() + public function getGrandChildren(): array { return $this->grandChildren; } @@ -491,7 +491,7 @@ public function getGrandChildren() /** * @return array */ - public function getIntMatrix() + public function getIntMatrix(): array { return $this->intMatrix; } diff --git a/src/Symfony/Component/Translation/PseudoLocalizationTranslator.php b/src/Symfony/Component/Translation/PseudoLocalizationTranslator.php index 49f122eb83b34..d5a1b29e2a04f 100644 --- a/src/Symfony/Component/Translation/PseudoLocalizationTranslator.php +++ b/src/Symfony/Component/Translation/PseudoLocalizationTranslator.php @@ -82,7 +82,7 @@ public function __construct(TranslatorInterface $translator, array $options = [] /** * {@inheritdoc} */ - public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null) + public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null): string { $trans = ''; $visibleText = ''; diff --git a/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php index 16945d38a293a..35389e5872505 100644 --- a/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php @@ -13,6 +13,7 @@ use Symfony\Component\Translation\IdentityTranslator; use Symfony\Contracts\Translation\Test\TranslatorTest; +use Symfony\Contracts\Translation\TranslatorInterface; class IdentityTranslatorTest extends TranslatorTest { @@ -33,7 +34,7 @@ protected function tearDown(): void \Locale::setDefault($this->defaultLocale); } - public function getTranslator() + public function getTranslator(): TranslatorInterface { return new IdentityTranslator(); } diff --git a/src/Symfony/Component/Translation/TranslatorBag.php b/src/Symfony/Component/Translation/TranslatorBag.php index c6555782fdb70..6d98455e5b78a 100644 --- a/src/Symfony/Component/Translation/TranslatorBag.php +++ b/src/Symfony/Component/Translation/TranslatorBag.php @@ -38,7 +38,7 @@ public function addBag(TranslatorBagInterface $bag): void /** * {@inheritdoc} */ - public function getCatalogue(string $locale = null) + public function getCatalogue(string $locale = null): MessageCatalogueInterface { if (null === $locale || !isset($this->catalogues[$locale])) { $this->catalogues[$locale] = new MessageCatalogue($locale); diff --git a/src/Symfony/Component/Validator/Constraint.php b/src/Symfony/Component/Validator/Constraint.php index a2974373d3cce..73c7c74dfee5f 100644 --- a/src/Symfony/Component/Validator/Constraint.php +++ b/src/Symfony/Component/Validator/Constraint.php @@ -297,7 +297,7 @@ public function getTargets() * * @internal */ - public function __sleep() + public function __sleep(): array { // Initialize "groups" option if it is not set $this->groups; diff --git a/src/Symfony/Component/Validator/Constraints/Compound.php b/src/Symfony/Component/Validator/Constraints/Compound.php index 042da1dd5757b..54dcd6c86f9dd 100644 --- a/src/Symfony/Component/Validator/Constraints/Compound.php +++ b/src/Symfony/Component/Validator/Constraints/Compound.php @@ -35,12 +35,12 @@ public function __construct($options = null) parent::__construct($options); } - final protected function getCompositeOption() + final protected function getCompositeOption(): string { return 'constraints'; } - final public function validatedBy() + final public function validatedBy(): string { return CompoundValidator::class; } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CompoundTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CompoundTest.php index 5f8f8456ad7f1..d5cf9e9ceecbb 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CompoundTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CompoundTest.php @@ -46,7 +46,7 @@ class ForwardingOptionCompound extends Compound { public $min; - public function getDefaultOption() + public function getDefaultOption(): ?string { return 'min'; } diff --git a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php index abab68d050bf5..df67a129f7006 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php @@ -373,12 +373,12 @@ class ClassCompositeConstraint extends Composite { public $nested; - public function getDefaultOption() + public function getDefaultOption(): ?string { return $this->getCompositeOption(); } - protected function getCompositeOption() + protected function getCompositeOption(): string { return 'nested'; } diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php index 87dba42bf6e9b..f9b4381c65fbf 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php @@ -176,7 +176,7 @@ public function loadClassMetadata(ClassMetadata $metadata): bool class PropertyGetterInterfaceConstraintLoader implements LoaderInterface { - public function loadClassMetadata(ClassMetadata $metadata) + public function loadClassMetadata(ClassMetadata $metadata): bool { if (PropertyGetterInterface::class === $metadata->getClassName()) { $metadata->addGetterConstraint('property', new NotBlank()); diff --git a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php index 32e40a964b129..241f81468b971 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php @@ -121,12 +121,12 @@ class PropertyCompositeConstraint extends Composite { public $nested; - public function getDefaultOption() + public function getDefaultOption(): ?string { return $this->getCompositeOption(); } - protected function getCompositeOption() + protected function getCompositeOption(): string { return 'nested'; } diff --git a/src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php b/src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php index 09453d865f220..344bba8772dc6 100644 --- a/src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php +++ b/src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php @@ -42,9 +42,6 @@ public function aParentService(): Service1 { } - /** - * @return ?ContainerInterface - */ public function setContainer(ContainerInterface $container) { return $container;