From cee04892204557a7bdc1cc9d685dbc888937a74d Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 4 Jun 2025 18:31:05 +0200 Subject: [PATCH] Enforce return types on all components --- .github/expected-missing-return-types.diff | 659 ------------------ .github/patch-types.php | 4 +- .github/workflows/unit-tests.yml | 16 +- .../Test/Traits/RuntimeLoaderProvider.php | 5 +- .../Component/BrowserKit/AbstractBrowser.php | 20 +- .../Component/Console/Command/Command.php | 12 +- .../Compiler/AbstractRecursivePass.php | 9 +- .../Compiler/CompilerPassInterface.php | 4 +- .../ConfigurationExtensionInterface.php | 7 +- .../Extension/Extension.php | 15 +- .../Extension/ExtensionInterface.php | 16 +- .../Extension/PrependExtensionInterface.php | 4 +- .../Component/Emoji/EmojiTransliterator.php | 12 +- .../EventSubscriberInterface.php | 2 +- .../ExpressionLanguage/ExpressionLanguage.php | 5 +- src/Symfony/Component/Form/AbstractType.php | 30 +- .../Component/Form/FormTypeInterface.php | 24 +- .../Form/Test/FormIntegrationTestCase.php | 8 +- .../Component/Form/Test/TypeTestCase.php | 12 +- .../Component/HttpKernel/Bundle/Bundle.php | 19 +- .../HttpKernel/Bundle/BundleInterface.php | 12 +- .../DataCollector/DataCollector.php | 5 +- .../DataCollector/DataCollectorInterface.php | 8 +- .../LateDataCollectorInterface.php | 4 +- .../Component/HttpKernel/KernelInterface.php | 12 +- .../Routing/Loader/AttributeClassLoader.php | 8 +- .../RememberMe/TokenProviderInterface.php | 16 +- .../Component/Security/Http/Firewall.php | 20 +- .../Extractor/ExtractorInterface.php | 8 +- .../Translation/IdentityTranslator.php | 5 + .../ConstraintValidatorInterface.php | 8 +- .../VarDumper/Dumper/DataDumperInterface.php | 5 +- .../VarDumper/Test/VarDumperTestTrait.php | 10 +- 33 files changed, 84 insertions(+), 920 deletions(-) delete mode 100644 .github/expected-missing-return-types.diff diff --git a/.github/expected-missing-return-types.diff b/.github/expected-missing-return-types.diff deleted file mode 100644 index 1979bba26f58c..0000000000000 --- a/.github/expected-missing-return-types.diff +++ /dev/null @@ -1,659 +0,0 @@ -# Run these steps to update this file: -sed -i 's/ *"\*\*\/Tests\/",//' composer.json -composer u -o -SYMFONY_PATCH_TYPE_DECLARATIONS='force=2&php=8.1' php .github/patch-types.php -head=$(sed '/^diff /Q' .github/expected-missing-return-types.diff) -git checkout src/Symfony/Contracts/Service/ResetInterface.php -(echo "$head" && echo && git diff -U2 src/ | grep '^index ' -v) > .github/expected-missing-return-types.diff -git checkout composer.json src/ - -diff --git a/src/Symfony/Bridge/Twig/Test/Traits/RuntimeLoaderProvider.php b/src/Symfony/Bridge/Twig/Test/Traits/RuntimeLoaderProvider.php ---- a/src/Symfony/Bridge/Twig/Test/Traits/RuntimeLoaderProvider.php -+++ b/src/Symfony/Bridge/Twig/Test/Traits/RuntimeLoaderProvider.php -@@ -21,5 +21,5 @@ trait RuntimeLoaderProvider - * @return void - */ -- protected function registerTwigRuntimeLoader(Environment $environment, FormRenderer $renderer) -+ protected function registerTwigRuntimeLoader(Environment $environment, FormRenderer $renderer): void - { - $loader = $this->createMock(RuntimeLoaderInterface::class); -diff --git a/src/Symfony/Component/BrowserKit/AbstractBrowser.php b/src/Symfony/Component/BrowserKit/AbstractBrowser.php ---- a/src/Symfony/Component/BrowserKit/AbstractBrowser.php -+++ b/src/Symfony/Component/BrowserKit/AbstractBrowser.php -@@ -420,5 +420,5 @@ abstract class AbstractBrowser - * @throws \RuntimeException When processing returns exit code - */ -- protected function doRequestInProcess(object $request) -+ protected function doRequestInProcess(object $request): object - { - $deprecationsFile = tempnam(sys_get_temp_dir(), 'deprec'); -@@ -457,5 +457,5 @@ abstract class AbstractBrowser - * @psalm-return TResponse - */ -- abstract protected function doRequest(object $request); -+ abstract protected function doRequest(object $request): object; - - /** -@@ -470,5 +470,5 @@ abstract class AbstractBrowser - * @throws LogicException When this abstract class is not implemented - */ -- protected function getScript(object $request) -+ protected function getScript(object $request): string - { - throw new LogicException('To insulate requests, you need to override the getScript() method.'); -@@ -482,5 +482,5 @@ abstract class AbstractBrowser - * @psalm-return TRequest - */ -- protected function filterRequest(Request $request) -+ protected function filterRequest(Request $request): object - { - return $request; -@@ -494,5 +494,5 @@ abstract class AbstractBrowser - * @return Response - */ -- protected function filterResponse(object $response) -+ protected function filterResponse(object $response): Response - { - return $response; -diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php ---- a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php -+++ b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php -@@ -115,5 +115,5 @@ abstract class NodeDefinition implements NodeParentInterface - * @return NodeParentInterface|NodeBuilder|self|ArrayNodeDefinition|VariableNodeDefinition - */ -- public function end(): NodeParentInterface -+ public function end(): NodeParentInterface|NodeBuilder|\Symfony\Component\Config\Definition\Builder\NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition - { - return $this->parent; -diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php ---- a/src/Symfony/Component/Console/Command/Command.php -+++ b/src/Symfony/Component/Console/Command/Command.php -@@ -201,5 +201,5 @@ class Command implements SignalableCommandInterface - * @return void - */ -- protected function configure() -+ protected function configure(): void - { - } -@@ -233,5 +233,5 @@ class Command implements SignalableCommandInterface - * @return void - */ -- protected function interact(InputInterface $input, OutputInterface $output) -+ protected function interact(InputInterface $input, OutputInterface $output): void - { - } -@@ -249,5 +249,5 @@ class Command implements SignalableCommandInterface - * @return void - */ -- protected function initialize(InputInterface $input, OutputInterface $output) -+ protected function initialize(InputInterface $input, OutputInterface $output): void - { - } -diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php ---- a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php -+++ b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php -@@ -38,5 +38,5 @@ abstract class AbstractRecursivePass implements CompilerPassInterface - * @return void - */ -- public function process(ContainerBuilder $container) -+ public function process(ContainerBuilder $container): void - { - $this->container = $container; -@@ -69,5 +69,5 @@ abstract class AbstractRecursivePass implements CompilerPassInterface - * @return mixed - */ -- protected function processValue(mixed $value, bool $isRoot = false) -+ protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if (\is_array($value)) { -diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php b/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php ---- a/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php -+++ b/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php -@@ -26,4 +26,4 @@ interface CompilerPassInterface - * @return void - */ -- public function process(ContainerBuilder $container); -+ public function process(ContainerBuilder $container): void; - } -diff --git a/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php b/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php ---- a/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php -+++ b/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php -@@ -27,4 +27,4 @@ interface ConfigurationExtensionInterface - * @return ConfigurationInterface|null - */ -- public function getConfiguration(array $config, ContainerBuilder $container); -+ public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface; - } -diff --git a/src/Symfony/Component/DependencyInjection/Extension/Extension.php b/src/Symfony/Component/DependencyInjection/Extension/Extension.php ---- a/src/Symfony/Component/DependencyInjection/Extension/Extension.php -+++ b/src/Symfony/Component/DependencyInjection/Extension/Extension.php -@@ -32,5 +32,5 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn - * @return string|false - */ -- public function getXsdValidationBasePath() -+ public function getXsdValidationBasePath(): string|false - { - return false; -@@ -40,5 +40,5 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn - * @return string - */ -- public function getNamespace() -+ public function getNamespace(): string - { - return 'http://example.org/schema/dic/'.$this->getAlias(); -@@ -77,5 +77,5 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn - * @return ConfigurationInterface|null - */ -- public function getConfiguration(array $config, ContainerBuilder $container) -+ public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface - { - $class = static::class; -diff --git a/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php b/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php ---- a/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php -+++ b/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php -@@ -30,5 +30,5 @@ interface ExtensionInterface - * @throws \InvalidArgumentException When provided tag is not defined in this extension - */ -- public function load(array $configs, ContainerBuilder $container); -+ public function load(array $configs, ContainerBuilder $container): void; - - /** -@@ -37,5 +37,5 @@ interface ExtensionInterface - * @return string - */ -- public function getNamespace(); -+ public function getNamespace(): string; - - /** -@@ -44,5 +44,5 @@ interface ExtensionInterface - * @return string|false - */ -- public function getXsdValidationBasePath(); -+ public function getXsdValidationBasePath(): string|false; - - /** -@@ -53,4 +53,4 @@ interface ExtensionInterface - * @return string - */ -- public function getAlias(); -+ public function getAlias(): string; - } -diff --git a/src/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php b/src/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php ---- a/src/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php -+++ b/src/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php -@@ -21,4 +21,4 @@ interface PrependExtensionInterface - * @return void - */ -- public function prepend(ContainerBuilder $container); -+ public function prepend(ContainerBuilder $container): void; - } -diff --git a/src/Symfony/Component/Emoji/EmojiTransliterator.php b/src/Symfony/Component/Emoji/EmojiTransliterator.php ---- a/src/Symfony/Component/Emoji/EmojiTransliterator.php -+++ b/src/Symfony/Component/Emoji/EmojiTransliterator.php -@@ -88,5 +88,5 @@ final class EmojiTransliterator extends \Transliterator - */ - #[\ReturnTypeWillChange] -- public function getErrorCode(): int|false -+ public function getErrorCode(): int - { - return isset($this->transliterator) ? $this->transliterator->getErrorCode() : 0; -@@ -97,5 +97,5 @@ final class EmojiTransliterator extends \Transliterator - */ - #[\ReturnTypeWillChange] -- public function getErrorMessage(): string|false -+ public function getErrorMessage(): string - { - return isset($this->transliterator) ? $this->transliterator->getErrorMessage() : ''; -diff --git a/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php b/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php ---- a/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php -+++ b/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php -@@ -46,4 +46,4 @@ interface EventSubscriberInterface - * @return array> - */ -- public static function getSubscribedEvents(); -+ public static function getSubscribedEvents(): array; - } -diff --git a/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php b/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php ---- a/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php -+++ b/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php -@@ -149,5 +149,5 @@ class ExpressionLanguage - * @return void - */ -- protected function registerFunctions() -+ protected function registerFunctions(): void - { - $basicPhpFunctions = ['constant', 'min', 'max']; -diff --git a/src/Symfony/Component/Form/AbstractType.php b/src/Symfony/Component/Form/AbstractType.php ---- a/src/Symfony/Component/Form/AbstractType.php -+++ b/src/Symfony/Component/Form/AbstractType.php -@@ -24,5 +24,5 @@ abstract class AbstractType implements FormTypeInterface - * @return string|null - */ -- public function getParent() -+ public function getParent(): ?string - { - return FormType::class; -@@ -32,5 +32,5 @@ abstract class AbstractType implements FormTypeInterface - * @return void - */ -- public function configureOptions(OptionsResolver $resolver) -+ public function configureOptions(OptionsResolver $resolver): void - { - } -@@ -39,5 +39,5 @@ abstract class AbstractType implements FormTypeInterface - * @return void - */ -- public function buildForm(FormBuilderInterface $builder, array $options) -+ public function buildForm(FormBuilderInterface $builder, array $options): void - { - } -@@ -46,5 +46,5 @@ abstract class AbstractType implements FormTypeInterface - * @return void - */ -- public function buildView(FormView $view, FormInterface $form, array $options) -+ public function buildView(FormView $view, FormInterface $form, array $options): void - { - } -@@ -53,5 +53,5 @@ abstract class AbstractType implements FormTypeInterface - * @return void - */ -- public function finishView(FormView $view, FormInterface $form, array $options) -+ public function finishView(FormView $view, FormInterface $form, array $options): void - { - } -@@ -60,5 +60,5 @@ abstract class AbstractType implements FormTypeInterface - * @return string - */ -- public function getBlockPrefix() -+ public function getBlockPrefix(): string - { - return StringUtil::fqcnToBlockPrefix(static::class) ?: ''; -diff --git a/src/Symfony/Component/Form/FormTypeInterface.php b/src/Symfony/Component/Form/FormTypeInterface.php ---- a/src/Symfony/Component/Form/FormTypeInterface.php -+++ b/src/Symfony/Component/Form/FormTypeInterface.php -@@ -27,5 +27,5 @@ interface FormTypeInterface - * @return string|null - */ -- public function getParent(); -+ public function getParent(): ?string; - - /** -@@ -34,5 +34,5 @@ interface FormTypeInterface - * @return void - */ -- public function configureOptions(OptionsResolver $resolver); -+ public function configureOptions(OptionsResolver $resolver): void; - - /** -@@ -48,5 +48,5 @@ interface FormTypeInterface - * @see FormTypeExtensionInterface::buildForm() - */ -- public function buildForm(FormBuilderInterface $builder, array $options); -+ public function buildForm(FormBuilderInterface $builder, array $options): void; - - /** -@@ -66,5 +66,5 @@ interface FormTypeInterface - * @see FormTypeExtensionInterface::buildView() - */ -- public function buildView(FormView $view, FormInterface $form, array $options); -+ public function buildView(FormView $view, FormInterface $form, array $options): void; - - /** -@@ -85,5 +85,5 @@ interface FormTypeInterface - * @see FormTypeExtensionInterface::finishView() - */ -- public function finishView(FormView $view, FormInterface $form, array $options); -+ public function finishView(FormView $view, FormInterface $form, array $options): void; - - /** -@@ -95,4 +95,4 @@ interface FormTypeInterface - * @return string - */ -- public function getBlockPrefix(); -+ public function getBlockPrefix(): string; - } -diff --git a/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php b/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php ---- a/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php -+++ b/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php -@@ -40,5 +40,5 @@ abstract class FormIntegrationTestCase extends TestCase - * @return FormExtensionInterface[] - */ -- protected function getExtensions() -+ protected function getExtensions(): array - { - return []; -@@ -48,5 +48,5 @@ abstract class FormIntegrationTestCase extends TestCase - * @return FormTypeExtensionInterface[] - */ -- protected function getTypeExtensions() -+ protected function getTypeExtensions(): array - { - return []; -@@ -56,5 +56,5 @@ abstract class FormIntegrationTestCase extends TestCase - * @return FormTypeInterface[] - */ -- protected function getTypes() -+ protected function getTypes(): array - { - return []; -@@ -64,5 +64,5 @@ abstract class FormIntegrationTestCase extends TestCase - * @return FormTypeGuesserInterface[] - */ -- protected function getTypeGuessers() -+ protected function getTypeGuessers(): array - { - return []; -diff --git a/src/Symfony/Component/Form/Test/TypeTestCase.php b/src/Symfony/Component/Form/Test/TypeTestCase.php ---- a/src/Symfony/Component/Form/Test/TypeTestCase.php -+++ b/src/Symfony/Component/Form/Test/TypeTestCase.php -@@ -33,5 +33,5 @@ abstract class TypeTestCase extends FormIntegrationTestCase - * @return FormExtensionInterface[] - */ -- protected function getExtensions() -+ protected function getExtensions(): array - { - $extensions = []; -@@ -47,5 +47,5 @@ abstract class TypeTestCase extends FormIntegrationTestCase - * @return void - */ -- public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual) -+ public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual): void - { - self::assertEquals($expected->format('c'), $actual->format('c')); -@@ -55,5 +55,5 @@ abstract class TypeTestCase extends FormIntegrationTestCase - * @return void - */ -- public static function assertDateIntervalEquals(\DateInterval $expected, \DateInterval $actual) -+ public static function assertDateIntervalEquals(\DateInterval $expected, \DateInterval $actual): void - { - self::assertEquals($expected->format('%RP%yY%mM%dDT%hH%iM%sS'), $actual->format('%RP%yY%mM%dDT%hH%iM%sS')); -diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php ---- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php -+++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php -@@ -35,5 +35,5 @@ abstract class Bundle implements BundleInterface - * @return void - */ -- public function boot() -+ public function boot(): void - { - } -@@ -42,5 +42,5 @@ abstract class Bundle implements BundleInterface - * @return void - */ -- public function shutdown() -+ public function shutdown(): void - { - } -@@ -52,5 +52,5 @@ abstract class Bundle implements BundleInterface - * @return void - */ -- public function build(ContainerBuilder $container) -+ public function build(ContainerBuilder $container): void - { - } -@@ -122,5 +122,5 @@ abstract class Bundle implements BundleInterface - * @return void - */ -- public function registerCommands(Application $application) -+ public function registerCommands(Application $application): void - { - } -diff --git a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php ---- a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php -+++ b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php -@@ -28,5 +28,5 @@ interface BundleInterface - * @return void - */ -- public function boot(); -+ public function boot(): void; - - /** -@@ -35,5 +35,5 @@ interface BundleInterface - * @return void - */ -- public function shutdown(); -+ public function shutdown(): void; - - /** -@@ -44,5 +44,5 @@ interface BundleInterface - * @return void - */ -- public function build(ContainerBuilder $container); -+ public function build(ContainerBuilder $container): void; - - /** -diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php ---- a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php -+++ b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php -@@ -111,5 +111,5 @@ abstract class DataCollector implements DataCollectorInterface - * @return void - */ -- public function reset() -+ public function reset(): void - { - $this->data = []; -diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php b/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php ---- a/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php -+++ b/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php -@@ -28,5 +28,5 @@ interface DataCollectorInterface extends ResetInterface - * @return void - */ -- public function collect(Request $request, Response $response, ?\Throwable $exception = null); -+ public function collect(Request $request, Response $response, ?\Throwable $exception = null): void; - - /** -@@ -35,4 +35,4 @@ interface DataCollectorInterface extends ResetInterface - * @return string - */ -- public function getName(); -+ public function getName(): string; - } -diff --git a/src/Symfony/Component/HttpKernel/DataCollector/LateDataCollectorInterface.php b/src/Symfony/Component/HttpKernel/DataCollector/LateDataCollectorInterface.php ---- a/src/Symfony/Component/HttpKernel/DataCollector/LateDataCollectorInterface.php -+++ b/src/Symfony/Component/HttpKernel/DataCollector/LateDataCollectorInterface.php -@@ -24,4 +24,4 @@ interface LateDataCollectorInterface - * @return void - */ -- public function lateCollect(); -+ public function lateCollect(): void; - } -diff --git a/src/Symfony/Component/HttpKernel/KernelInterface.php b/src/Symfony/Component/HttpKernel/KernelInterface.php ---- a/src/Symfony/Component/HttpKernel/KernelInterface.php -+++ b/src/Symfony/Component/HttpKernel/KernelInterface.php -@@ -37,5 +37,5 @@ interface KernelInterface extends HttpKernelInterface - * @return void - */ -- public function registerContainerConfiguration(LoaderInterface $loader); -+ public function registerContainerConfiguration(LoaderInterface $loader): void; - - /** -@@ -44,5 +44,5 @@ interface KernelInterface extends HttpKernelInterface - * @return void - */ -- public function boot(); -+ public function boot(): void; - - /** -@@ -53,5 +53,5 @@ interface KernelInterface extends HttpKernelInterface - * @return void - */ -- public function shutdown(); -+ public function shutdown(): void; - - /** -diff --git a/src/Symfony/Component/Routing/Loader/AttributeClassLoader.php b/src/Symfony/Component/Routing/Loader/AttributeClassLoader.php ---- a/src/Symfony/Component/Routing/Loader/AttributeClassLoader.php -+++ b/src/Symfony/Component/Routing/Loader/AttributeClassLoader.php -@@ -277,5 +277,5 @@ abstract class AttributeClassLoader implements LoaderInterface - * @return string - */ -- protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method) -+ protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method): string - { - $name = str_replace('\\', '_', $class->name).'_'.$method->name; -@@ -379,5 +379,5 @@ abstract class AttributeClassLoader implements LoaderInterface - * @return void - */ -- abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $attr); -+ abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $attr): void; - - /** -diff --git a/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php b/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php ---- a/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php -+++ b/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php -@@ -28,5 +28,5 @@ interface TokenProviderInterface - * @throws TokenNotFoundException if the token is not found - */ -- public function loadTokenBySeries(string $series); -+ public function loadTokenBySeries(string $series): PersistentTokenInterface; - - /** -@@ -35,5 +35,5 @@ interface TokenProviderInterface - * @return void - */ -- public function deleteTokenBySeries(string $series); -+ public function deleteTokenBySeries(string $series): void; - - /** -@@ -44,5 +44,5 @@ interface TokenProviderInterface - * @throws TokenNotFoundException if the token is not found - */ -- public function updateToken(string $series, #[\SensitiveParameter] string $tokenValue, \DateTimeInterface $lastUsed); -+ public function updateToken(string $series, #[\SensitiveParameter] string $tokenValue, \DateTimeInterface $lastUsed): void; - - /** -@@ -51,4 +51,4 @@ interface TokenProviderInterface - * @return void - */ -- public function createNewToken(PersistentTokenInterface $token); -+ public function createNewToken(PersistentTokenInterface $token): void; - } -diff --git a/src/Symfony/Component/Security/Http/Firewall.php b/src/Symfony/Component/Security/Http/Firewall.php ---- a/src/Symfony/Component/Security/Http/Firewall.php -+++ b/src/Symfony/Component/Security/Http/Firewall.php -@@ -48,5 +48,5 @@ class Firewall implements EventSubscriberInterface - * @return void - */ -- public function onKernelRequest(RequestEvent $event) -+ public function onKernelRequest(RequestEvent $event): void - { - if (!$event->isMainRequest()) { -@@ -96,5 +96,5 @@ class Firewall implements EventSubscriberInterface - * @return void - */ -- public function onKernelFinishRequest(FinishRequestEvent $event) -+ public function onKernelFinishRequest(FinishRequestEvent $event): void - { - $request = $event->getRequest(); -@@ -109,5 +109,5 @@ class Firewall implements EventSubscriberInterface - * @return array - */ -- public static function getSubscribedEvents() -+ public static function getSubscribedEvents(): array - { - return [ -@@ -120,5 +120,5 @@ class Firewall implements EventSubscriberInterface - * @return void - */ -- protected function callListeners(RequestEvent $event, iterable $listeners) -+ protected function callListeners(RequestEvent $event, iterable $listeners): void - { - foreach ($listeners as $listener) { -diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php ---- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php -+++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php -@@ -820,5 +820,5 @@ XML; - * @return Dummy - */ -- protected static function getObject(): object -+ protected static function getObject(): Dummy - { - $obj = new Dummy(); -diff --git a/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php b/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php ---- a/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php -+++ b/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php -@@ -29,5 +29,5 @@ interface ExtractorInterface - * @return void - */ -- public function extract(string|iterable $resource, MessageCatalogue $catalogue); -+ public function extract(string|iterable $resource, MessageCatalogue $catalogue): void; - - /** -@@ -36,4 +36,4 @@ interface ExtractorInterface - * @return void - */ -- public function setPrefix(string $prefix); -+ public function setPrefix(string $prefix): void; - } -diff --git a/src/Symfony/Component/TypeInfo/Tests/Fixtures/DummyWithPhpDoc.php b/src/Symfony/Component/TypeInfo/Tests/Fixtures/DummyWithPhpDoc.php ---- a/src/Symfony/Component/TypeInfo/Tests/Fixtures/DummyWithPhpDoc.php -+++ b/src/Symfony/Component/TypeInfo/Tests/Fixtures/DummyWithPhpDoc.php -@@ -50,5 +50,5 @@ final class DummyWithPhpDoc - * @return Dummy - */ -- public function getNextDummy(mixed $dummy): mixed -+ public function getNextDummy(mixed $dummy): Dummy - { - throw new \BadMethodCallException(sprintf('"%s" is not implemented.', __METHOD__)); -diff --git a/src/Symfony/Component/Validator/ConstraintValidatorInterface.php b/src/Symfony/Component/Validator/ConstraintValidatorInterface.php ---- a/src/Symfony/Component/Validator/ConstraintValidatorInterface.php -+++ b/src/Symfony/Component/Validator/ConstraintValidatorInterface.php -@@ -24,5 +24,5 @@ interface ConstraintValidatorInterface - * @return void - */ -- public function initialize(ExecutionContextInterface $context); -+ public function initialize(ExecutionContextInterface $context): void; - - /** -@@ -31,4 +31,4 @@ interface ConstraintValidatorInterface - * @return void - */ -- public function validate(mixed $value, Constraint $constraint); -+ public function validate(mixed $value, Constraint $constraint): void; - } -diff --git a/src/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php b/src/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php ---- a/src/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php -+++ b/src/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php -@@ -24,4 +24,4 @@ interface DataDumperInterface - * @return string|null - */ -- public function dump(Data $data); -+ public function dump(Data $data): ?string; - } -diff --git a/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php b/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php ---- a/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php -+++ b/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php -@@ -49,5 +49,5 @@ trait VarDumperTestTrait - * @return void - */ -- public function assertDumpEquals(mixed $expected, mixed $data, int $filter = 0, string $message = '') -+ public function assertDumpEquals(mixed $expected, mixed $data, int $filter = 0, string $message = ''): void - { - $this->assertSame($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message); -@@ -57,5 +57,5 @@ trait VarDumperTestTrait - * @return void - */ -- public function assertDumpMatchesFormat(mixed $expected, mixed $data, int $filter = 0, string $message = '') -+ public function assertDumpMatchesFormat(mixed $expected, mixed $data, int $filter = 0, string $message = ''): void - { - $this->assertStringMatchesFormat($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message); -diff --git a/src/Symfony/Contracts/Translation/LocaleAwareInterface.php b/src/Symfony/Contracts/Translation/LocaleAwareInterface.php ---- a/src/Symfony/Contracts/Translation/LocaleAwareInterface.php -+++ b/src/Symfony/Contracts/Translation/LocaleAwareInterface.php -@@ -21,5 +21,5 @@ interface LocaleAwareInterface - * @throws \InvalidArgumentException If the locale contains invalid characters - */ -- public function setLocale(string $locale); -+ public function setLocale(string $locale): void; - - /** -diff --git a/src/Symfony/Contracts/Translation/TranslatorTrait.php b/src/Symfony/Contracts/Translation/TranslatorTrait.php ---- a/src/Symfony/Contracts/Translation/TranslatorTrait.php -+++ b/src/Symfony/Contracts/Translation/TranslatorTrait.php -@@ -26,5 +26,5 @@ trait TranslatorTrait - * @return void - */ -- public function setLocale(string $locale) -+ public function setLocale(string $locale): void - { - $this->locale = $locale; diff --git a/.github/patch-types.php b/.github/patch-types.php index 0a25ef95af146..c242cfda1f4d2 100644 --- a/.github/patch-types.php +++ b/.github/patch-types.php @@ -44,8 +44,7 @@ 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/HttpClient/Internal/') && str_contains($file, 'V5'): - case false !== strpos($file, '/src/Symfony/Component/PropertyAccess/Tests/Fixtures/AsymmetricVisibility.php'): + case false !== strpos($file, '/src/Symfony/Component/HttpClient/Internal/') && str_contains($file, 'V4'): 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/Security/Http/Tests/Fixtures/IsGrantedAttributeMethodsWithClosureController.php'): @@ -55,7 +54,6 @@ case false !== strpos($file, '/src/Symfony/Component/Validator/Tests/Constraints/Fixtures/WhenTestWithClosure.php'): case false !== strpos($file, '/src/Symfony/Component/Validator/Tests/Fixtures/NestedAttribute/Entity.php'): case false !== strpos($file, '/src/Symfony/Component/VarDumper/Tests/Fixtures/NotLoadableClass.php'): - case false !== strpos($file, '/src/Symfony/Component/VarDumper/Tests/Fixtures/VirtualProperty.php'): case false !== strpos($file, '/src/Symfony/Component/VarExporter/Internal'): case false !== strpos($file, '/src/Symfony/Component/VarExporter/Tests/Fixtures/'): case false !== strpos($file, '/src/Symfony/Contracts/'): diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 9e49f36284904..c915f8f712311 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -148,22 +148,12 @@ jobs: ./phpunit install echo "::endgroup::" - - name: Patch return types + - name: Check return types if: "matrix.php == '8.4' && ! matrix.mode" run: | - patch -sp1 < .github/expected-missing-return-types.diff - git add . sed -i 's/ *"\*\*\/Tests\/",//' composer.json composer install -q --optimize-autoloader || composer install --optimize-autoloader - SYMFONY_PATCH_TYPE_DECLARATIONS='force=2&php=8.4' php .github/patch-types.php - git checkout composer.json src/Symfony/Contracts/Service/ResetInterface.php - SYMFONY_PATCH_TYPE_DECLARATIONS='force=2&php=8.4' php .github/patch-types.php # ensure the script is idempotent - git checkout src/Symfony/Contracts/Service/ResetInterface.php - git diff --exit-code - - - name: Check return types - if: "matrix.php == '8.4' && ! matrix.mode" - run: | + git checkout composer.json php .github/patch-types.php lint - name: Run tests @@ -209,7 +199,7 @@ jobs: PATCHED_COMPONENTS=$(git diff --name-only src/ | grep composer.json || true) # for 7.4 LTS, checkout and test previous major with the patched components (only for patched components) - if [[ $PATCHED_COMPONENTS && $SYMFONY_VERSION = 7.4 ]]; then + if [[ $PATCHED_COMPONENTS && $SYMFONY_VERSION = 7.4 && $FLIP = '' ]]; then export FLIP='^' SYMFONY_VERSION=$(echo $SYMFONY_VERSION | awk '{print $1 - 1}') echo -e "\\n\\e[33;1mChecking out Symfony $SYMFONY_VERSION and running tests with patched components as deps\\e[0m" diff --git a/src/Symfony/Bridge/Twig/Test/Traits/RuntimeLoaderProvider.php b/src/Symfony/Bridge/Twig/Test/Traits/RuntimeLoaderProvider.php index 5aa37c8bd0fe7..6d8943a9605d4 100644 --- a/src/Symfony/Bridge/Twig/Test/Traits/RuntimeLoaderProvider.php +++ b/src/Symfony/Bridge/Twig/Test/Traits/RuntimeLoaderProvider.php @@ -17,10 +17,7 @@ trait RuntimeLoaderProvider { - /** - * @return void - */ - protected function registerTwigRuntimeLoader(Environment $environment, FormRenderer $renderer) + protected function registerTwigRuntimeLoader(Environment $environment, FormRenderer $renderer): void { $loader = $this->createMock(RuntimeLoaderInterface::class); $loader->expects($this->any())->method('load')->willReturnMap([ diff --git a/src/Symfony/Component/BrowserKit/AbstractBrowser.php b/src/Symfony/Component/BrowserKit/AbstractBrowser.php index 1269fcb69e8cb..e294c44960b75 100644 --- a/src/Symfony/Component/BrowserKit/AbstractBrowser.php +++ b/src/Symfony/Component/BrowserKit/AbstractBrowser.php @@ -413,13 +413,11 @@ public function request(string $method, string $uri, array $parameters = [], arr * * @psalm-param TRequest $request * - * @return object - * * @psalm-return TResponse * * @throws \RuntimeException When processing returns exit code */ - protected function doRequestInProcess(object $request) + protected function doRequestInProcess(object $request): object { $deprecationsFile = tempnam(sys_get_temp_dir(), 'deprec'); putenv('SYMFONY_DEPRECATIONS_SERIALIZE='.$deprecationsFile); @@ -452,11 +450,9 @@ protected function doRequestInProcess(object $request) * * @psalm-param TRequest $request * - * @return object - * * @psalm-return TResponse */ - abstract protected function doRequest(object $request); + abstract protected function doRequest(object $request): object; /** * Returns the script to execute when the request must be insulated. @@ -465,11 +461,9 @@ abstract protected function doRequest(object $request); * * @param object $request An origin request instance * - * @return string - * * @throws LogicException When this abstract class is not implemented */ - protected function getScript(object $request) + protected function getScript(object $request): string { throw new LogicException('To insulate requests, you need to override the getScript() method.'); } @@ -477,11 +471,9 @@ protected function getScript(object $request) /** * Filters the BrowserKit request to the origin one. * - * @return object - * * @psalm-return TRequest */ - protected function filterRequest(Request $request) + protected function filterRequest(Request $request): object { return $request; } @@ -490,10 +482,8 @@ protected function filterRequest(Request $request) * Filters the origin response to the BrowserKit one. * * @psalm-param TResponse $response - * - * @return Response */ - protected function filterResponse(object $response) + protected function filterResponse(object $response): Response { return $response; } diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index f6cd8499791f1..7749947540f56 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -197,10 +197,8 @@ public function isEnabled(): bool /** * Configures the current command. - * - * @return void */ - protected function configure() + protected function configure(): void { } @@ -229,10 +227,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int * This method is executed before the InputDefinition is validated. * This means that this is the only place where the command can * interactively ask for values of missing required arguments. - * - * @return void */ - protected function interact(InputInterface $input, OutputInterface $output) + protected function interact(InputInterface $input, OutputInterface $output): void { } @@ -245,10 +241,8 @@ protected function interact(InputInterface $input, OutputInterface $output) * * @see InputInterface::bind() * @see InputInterface::validate() - * - * @return void */ - protected function initialize(InputInterface $input, OutputInterface $output) + protected function initialize(InputInterface $input, OutputInterface $output): void { } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php index 55f8ee7e97d88..aeff6c14cc878 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php @@ -34,10 +34,7 @@ abstract class AbstractRecursivePass implements CompilerPassInterface private ExpressionLanguage $expressionLanguage; private bool $inExpression = false; - /** - * @return void - */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $this->container = $container; @@ -65,10 +62,8 @@ protected function inExpression(bool $reset = true): bool /** * Processes a value found in a definition tree. - * - * @return mixed */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if (\is_array($value)) { foreach ($value as $k => $v) { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php b/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php index 2ad4a048ba8f4..d7ac4766f51ce 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php @@ -22,8 +22,6 @@ interface CompilerPassInterface { /** * You can modify the container here before it is dumped to PHP code. - * - * @return void */ - public function process(ContainerBuilder $container); + public function process(ContainerBuilder $container): void; } diff --git a/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php b/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php index a42967f4da4b3..3e99a77c1ce8c 100644 --- a/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php +++ b/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php @@ -21,10 +21,5 @@ */ interface ConfigurationExtensionInterface { - /** - * Returns extension configuration. - * - * @return ConfigurationInterface|null - */ - public function getConfiguration(array $config, ContainerBuilder $container); + public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface; } diff --git a/src/Symfony/Component/DependencyInjection/Extension/Extension.php b/src/Symfony/Component/DependencyInjection/Extension/Extension.php index 03d08d6d66b8a..e804fbc57c1b8 100644 --- a/src/Symfony/Component/DependencyInjection/Extension/Extension.php +++ b/src/Symfony/Component/DependencyInjection/Extension/Extension.php @@ -28,18 +28,12 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn { private array $processedConfigs = []; - /** - * @return string|false - */ - public function getXsdValidationBasePath() + public function getXsdValidationBasePath(): string|false { return false; } - /** - * @return string - */ - public function getNamespace() + public function getNamespace(): string { return 'http://example.org/schema/dic/'.$this->getAlias(); } @@ -73,10 +67,7 @@ public function getAlias(): string return Container::underscore($classBaseName); } - /** - * @return ConfigurationInterface|null - */ - public function getConfiguration(array $config, ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface { $class = static::class; diff --git a/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php b/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php index bd57eef7334d0..5bd7a4d1341f0 100644 --- a/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php +++ b/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php @@ -25,32 +25,24 @@ interface ExtensionInterface * * @param array> $configs * - * @return void - * * @throws \InvalidArgumentException When provided tag is not defined in this extension */ - public function load(array $configs, ContainerBuilder $container); + public function load(array $configs, ContainerBuilder $container): void; /** * Returns the namespace to be used for this extension (XML namespace). - * - * @return string */ - public function getNamespace(); + public function getNamespace(): string; /** * Returns the base path for the XSD files. - * - * @return string|false */ - public function getXsdValidationBasePath(); + public function getXsdValidationBasePath(): string|false; /** * Returns the recommended alias to use in XML. * * This alias is also the mandatory prefix to use when using YAML. - * - * @return string */ - public function getAlias(); + public function getAlias(): string; } diff --git a/src/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php b/src/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php index 0df94e1092fa5..89a40dcc7d84f 100644 --- a/src/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php +++ b/src/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php @@ -17,8 +17,6 @@ interface PrependExtensionInterface { /** * Allow an extension to prepend the extension configurations. - * - * @return void */ - public function prepend(ContainerBuilder $container); + public function prepend(ContainerBuilder $container): void; } diff --git a/src/Symfony/Component/Emoji/EmojiTransliterator.php b/src/Symfony/Component/Emoji/EmojiTransliterator.php index 67dfe3fb3f56c..44b26c72cc346 100644 --- a/src/Symfony/Component/Emoji/EmojiTransliterator.php +++ b/src/Symfony/Component/Emoji/EmojiTransliterator.php @@ -83,20 +83,12 @@ public function createInverse(): self return self::create($this->id, \Transliterator::REVERSE); } - /** - * @return int - */ - #[\ReturnTypeWillChange] - public function getErrorCode(): int|false + public function getErrorCode(): int { return isset($this->transliterator) ? $this->transliterator->getErrorCode() : 0; } - /** - * @return string - */ - #[\ReturnTypeWillChange] - public function getErrorMessage(): string|false + public function getErrorMessage(): string { return isset($this->transliterator) ? $this->transliterator->getErrorMessage() : ''; } diff --git a/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php b/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php index 2085e428e9152..ca0d6964e532d 100644 --- a/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php +++ b/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php @@ -45,5 +45,5 @@ interface EventSubscriberInterface * * @return array> */ - public static function getSubscribedEvents(); + public static function getSubscribedEvents(): array; } diff --git a/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php b/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php index 379d3863f114c..4899537b6e3e3 100644 --- a/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php +++ b/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php @@ -145,10 +145,7 @@ public function registerProvider(ExpressionFunctionProviderInterface $provider): } } - /** - * @return void - */ - protected function registerFunctions() + protected function registerFunctions(): void { $basicPhpFunctions = ['constant', 'min', 'max']; foreach ($basicPhpFunctions as $function) { diff --git a/src/Symfony/Component/Form/AbstractType.php b/src/Symfony/Component/Form/AbstractType.php index 8fffa379d8496..74548bc6024d4 100644 --- a/src/Symfony/Component/Form/AbstractType.php +++ b/src/Symfony/Component/Form/AbstractType.php @@ -20,46 +20,28 @@ */ abstract class AbstractType implements FormTypeInterface { - /** - * @return string|null - */ - public function getParent() + public function getParent(): ?string { return FormType::class; } - /** - * @return void - */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { } - /** - * @return void - */ - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { } - /** - * @return void - */ - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { } - /** - * @return void - */ - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { } - /** - * @return string - */ - public function getBlockPrefix() + public function getBlockPrefix(): string { return StringUtil::fqcnToBlockPrefix(static::class) ?: ''; } diff --git a/src/Symfony/Component/Form/FormTypeInterface.php b/src/Symfony/Component/Form/FormTypeInterface.php index 2bc9f7711e9a6..6a27b59bbabc7 100644 --- a/src/Symfony/Component/Form/FormTypeInterface.php +++ b/src/Symfony/Component/Form/FormTypeInterface.php @@ -23,17 +23,13 @@ interface FormTypeInterface * * The parent type and its extensions will configure the form with the * following methods before the current implementation. - * - * @return string|null */ - public function getParent(); + public function getParent(): ?string; /** * Configures the options for this type. - * - * @return void */ - public function configureOptions(OptionsResolver $resolver); + public function configureOptions(OptionsResolver $resolver): void; /** * Builds the form. @@ -43,11 +39,9 @@ public function configureOptions(OptionsResolver $resolver); * * @param array $options * - * @return void - * * @see FormTypeExtensionInterface::buildForm() */ - public function buildForm(FormBuilderInterface $builder, array $options); + public function buildForm(FormBuilderInterface $builder, array $options): void; /** * Builds the form view. @@ -61,11 +55,9 @@ public function buildForm(FormBuilderInterface $builder, array $options); * * @param array $options * - * @return void - * * @see FormTypeExtensionInterface::buildView() */ - public function buildView(FormView $view, FormInterface $form, array $options); + public function buildView(FormView $view, FormInterface $form, array $options): void; /** * Finishes the form view. @@ -80,19 +72,15 @@ public function buildView(FormView $view, FormInterface $form, array $options); * * @param array $options * - * @return void - * * @see FormTypeExtensionInterface::finishView() */ - public function finishView(FormView $view, FormInterface $form, array $options); + public function finishView(FormView $view, FormInterface $form, array $options): void; /** * Returns the prefix of the template block name for this type. * * The block prefix defaults to the underscored short class name with * the "Type" suffix removed (e.g. "UserProfileType" => "user_profile"). - * - * @return string */ - public function getBlockPrefix(); + public function getBlockPrefix(): string; } diff --git a/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php b/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php index 8756d99689a23..34530bc4ba34b 100644 --- a/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php +++ b/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php @@ -39,7 +39,7 @@ protected function setUp(): void /** * @return FormExtensionInterface[] */ - protected function getExtensions() + protected function getExtensions(): array { return []; } @@ -47,7 +47,7 @@ protected function getExtensions() /** * @return FormTypeExtensionInterface[] */ - protected function getTypeExtensions() + protected function getTypeExtensions(): array { return []; } @@ -55,7 +55,7 @@ protected function getTypeExtensions() /** * @return FormTypeInterface[] */ - protected function getTypes() + protected function getTypes(): array { return []; } @@ -63,7 +63,7 @@ protected function getTypes() /** * @return FormTypeGuesserInterface[] */ - protected function getTypeGuessers() + protected function getTypeGuessers(): array { return []; } diff --git a/src/Symfony/Component/Form/Test/TypeTestCase.php b/src/Symfony/Component/Form/Test/TypeTestCase.php index 1bbb66d25d508..89aee9bffb6ee 100644 --- a/src/Symfony/Component/Form/Test/TypeTestCase.php +++ b/src/Symfony/Component/Form/Test/TypeTestCase.php @@ -32,7 +32,7 @@ protected function setUp(): void /** * @return FormExtensionInterface[] */ - protected function getExtensions() + protected function getExtensions(): array { $extensions = []; @@ -43,18 +43,12 @@ protected function getExtensions() return $extensions; } - /** - * @return void - */ - public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual) + public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual): void { self::assertEquals($expected->format('c'), $actual->format('c')); } - /** - * @return void - */ - public static function assertDateIntervalEquals(\DateInterval $expected, \DateInterval $actual) + public static function assertDateIntervalEquals(\DateInterval $expected, \DateInterval $actual): void { self::assertEquals($expected->format('%RP%yY%mM%dDT%hH%iM%sS'), $actual->format('%RP%yY%mM%dDT%hH%iM%sS')); } diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php index 3b8006d6c3e6d..853a201f3bf41 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php @@ -31,27 +31,19 @@ abstract class Bundle implements BundleInterface private string $namespace; - /** - * @return void - */ - public function boot() + public function boot(): void { } - /** - * @return void - */ - public function shutdown() + public function shutdown(): void { } /** * This method can be overridden to register compilation passes, * other extensions, ... - * - * @return void */ - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { } @@ -118,10 +110,7 @@ final public function getName(): string return $this->name; } - /** - * @return void - */ - public function registerCommands(Application $application) + public function registerCommands(Application $application): void { } diff --git a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php index 36502e8962f68..9a362bab9e442 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php +++ b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php @@ -24,26 +24,20 @@ interface BundleInterface { /** * Boots the Bundle. - * - * @return void */ - public function boot(); + public function boot(): void; /** * Shutdowns the Bundle. - * - * @return void */ - public function shutdown(); + public function shutdown(): void; /** * Builds the bundle. * * It is only ever called once when the cache is empty. - * - * @return void */ - public function build(ContainerBuilder $container); + public function build(ContainerBuilder $container): void; /** * Returns the container extension that should be implicitly loaded. diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php index 3238e2bb8d67f..ad8c49b1a8efc 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php @@ -107,10 +107,7 @@ final protected function unserialize(string $data): void { } - /** - * @return void - */ - public function reset() + public function reset(): void { $this->data = []; } diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php b/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php index 5e8593d07c3b1..31cc59d46f037 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php @@ -24,15 +24,11 @@ interface DataCollectorInterface extends ResetInterface { /** * Collects data for the given Request and Response. - * - * @return void */ - public function collect(Request $request, Response $response, ?\Throwable $exception = null); + public function collect(Request $request, Response $response, ?\Throwable $exception = null): void; /** * Returns the name of the collector. - * - * @return string */ - public function getName(); + public function getName(): string; } diff --git a/src/Symfony/Component/HttpKernel/DataCollector/LateDataCollectorInterface.php b/src/Symfony/Component/HttpKernel/DataCollector/LateDataCollectorInterface.php index efa1a4f737f63..d17cd7768d2e9 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/LateDataCollectorInterface.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/LateDataCollectorInterface.php @@ -20,8 +20,6 @@ interface LateDataCollectorInterface { /** * Collects data as late as possible. - * - * @return void */ - public function lateCollect(); + public function lateCollect(): void; } diff --git a/src/Symfony/Component/HttpKernel/KernelInterface.php b/src/Symfony/Component/HttpKernel/KernelInterface.php index 14a053ab3004b..2363d5e995e23 100644 --- a/src/Symfony/Component/HttpKernel/KernelInterface.php +++ b/src/Symfony/Component/HttpKernel/KernelInterface.php @@ -33,26 +33,20 @@ public function registerBundles(): iterable; /** * Loads the container configuration. - * - * @return void */ - public function registerContainerConfiguration(LoaderInterface $loader); + public function registerContainerConfiguration(LoaderInterface $loader): void; /** * Boots the current kernel. - * - * @return void */ - public function boot(); + public function boot(): void; /** * Shutdowns the kernel. * * This method is mainly useful when doing functional testing. - * - * @return void */ - public function shutdown(); + public function shutdown(): void; /** * Gets the registered bundle instances. diff --git a/src/Symfony/Component/Routing/Loader/AttributeClassLoader.php b/src/Symfony/Component/Routing/Loader/AttributeClassLoader.php index 254582bf35584..04d1db17cadae 100644 --- a/src/Symfony/Component/Routing/Loader/AttributeClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AttributeClassLoader.php @@ -273,10 +273,8 @@ public function getResolver(): LoaderResolverInterface /** * Gets the default route name for a class method. - * - * @return string */ - protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method) + protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method): string { $name = str_replace('\\', '_', $class->name).'_'.$method->name; $name = \function_exists('mb_strtolower') && preg_match('//u', $name) ? mb_strtolower($name, 'UTF-8') : strtolower($name); @@ -375,10 +373,8 @@ protected function createRoute(string $path, array $defaults, array $requirement /** * @param RouteAttribute $attr or an object that exposes a similar interface - * - * @return void */ - abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $attr); + abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $attr): void; /** * @return iterable diff --git a/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php b/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php index bfe490157b1a7..00e8bac5451f3 100644 --- a/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php +++ b/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php @@ -23,32 +23,24 @@ interface TokenProviderInterface /** * Loads the active token for the given series. * - * @return PersistentTokenInterface - * * @throws TokenNotFoundException if the token is not found */ - public function loadTokenBySeries(string $series); + public function loadTokenBySeries(string $series): PersistentTokenInterface; /** * Deletes all tokens belonging to series. - * - * @return void */ - public function deleteTokenBySeries(string $series); + public function deleteTokenBySeries(string $series): void; /** * Updates the token according to this data. * - * @return void - * * @throws TokenNotFoundException if the token is not found */ - public function updateToken(string $series, #[\SensitiveParameter] string $tokenValue, \DateTimeInterface $lastUsed); + public function updateToken(string $series, #[\SensitiveParameter] string $tokenValue, \DateTimeInterface $lastUsed): void; /** * Creates a new token. - * - * @return void */ - public function createNewToken(PersistentTokenInterface $token); + public function createNewToken(PersistentTokenInterface $token): void; } diff --git a/src/Symfony/Component/Security/Http/Firewall.php b/src/Symfony/Component/Security/Http/Firewall.php index 6c256dba60955..99dc15e208a29 100644 --- a/src/Symfony/Component/Security/Http/Firewall.php +++ b/src/Symfony/Component/Security/Http/Firewall.php @@ -44,10 +44,7 @@ public function __construct( $this->exceptionListeners = new \SplObjectStorage(); } - /** - * @return void - */ - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { if (!$event->isMainRequest()) { return; @@ -92,10 +89,7 @@ public function onKernelRequest(RequestEvent $event) $this->callListeners($event, $authenticationListeners()); } - /** - * @return void - */ - public function onKernelFinishRequest(FinishRequestEvent $event) + public function onKernelFinishRequest(FinishRequestEvent $event): void { $request = $event->getRequest(); @@ -105,10 +99,7 @@ public function onKernelFinishRequest(FinishRequestEvent $event) } } - /** - * @return array - */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => ['onKernelRequest', 8], @@ -116,10 +107,7 @@ public static function getSubscribedEvents() ]; } - /** - * @return void - */ - protected function callListeners(RequestEvent $event, iterable $listeners) + protected function callListeners(RequestEvent $event, iterable $listeners): void { foreach ($listeners as $listener) { $listener($event); diff --git a/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php b/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php index 642130af75ff1..9275e6fcb2343 100644 --- a/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php +++ b/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php @@ -25,15 +25,11 @@ interface ExtractorInterface * Extracts translation messages from files, a file or a directory to the catalogue. * * @param string|iterable $resource Files, a file or a directory - * - * @return void */ - public function extract(string|iterable $resource, MessageCatalogue $catalogue); + public function extract(string|iterable $resource, MessageCatalogue $catalogue): void; /** * Sets the prefix that should be used for new found messages. - * - * @return void */ - public function setPrefix(string $prefix); + public function setPrefix(string $prefix): void; } diff --git a/src/Symfony/Component/Translation/IdentityTranslator.php b/src/Symfony/Component/Translation/IdentityTranslator.php index 46875edf2ac88..87c098ab393ba 100644 --- a/src/Symfony/Component/Translation/IdentityTranslator.php +++ b/src/Symfony/Component/Translation/IdentityTranslator.php @@ -23,4 +23,9 @@ class IdentityTranslator implements TranslatorInterface, LocaleAwareInterface { use TranslatorTrait; + + public function setLocale(string $locale): void + { + $this->locale = $locale; + } } diff --git a/src/Symfony/Component/Validator/ConstraintValidatorInterface.php b/src/Symfony/Component/Validator/ConstraintValidatorInterface.php index fe7da2e8f76b8..68faace618a51 100644 --- a/src/Symfony/Component/Validator/ConstraintValidatorInterface.php +++ b/src/Symfony/Component/Validator/ConstraintValidatorInterface.php @@ -20,15 +20,11 @@ interface ConstraintValidatorInterface { /** * Initializes the constraint validator. - * - * @return void */ - public function initialize(ExecutionContextInterface $context); + public function initialize(ExecutionContextInterface $context): void; /** * Checks if the passed value is valid. - * - * @return void */ - public function validate(mixed $value, Constraint $constraint); + public function validate(mixed $value, Constraint $constraint): void; } diff --git a/src/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php b/src/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php index df05b6af57e5a..40643a8a4374b 100644 --- a/src/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php +++ b/src/Symfony/Component/VarDumper/Dumper/DataDumperInterface.php @@ -20,8 +20,5 @@ */ interface DataDumperInterface { - /** - * @return string|null - */ - public function dump(Data $data); + public function dump(Data $data): ?string; } diff --git a/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php b/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php index f50adb13fc679..46bc7927f37a0 100644 --- a/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php +++ b/src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php @@ -45,18 +45,12 @@ protected function tearDownVarDumper(): void $this->varDumperConfig['flags'] = null; } - /** - * @return void - */ - public function assertDumpEquals(mixed $expected, mixed $data, int $filter = 0, string $message = '') + public function assertDumpEquals(mixed $expected, mixed $data, int $filter = 0, string $message = ''): void { $this->assertSame($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message); } - /** - * @return void - */ - public function assertDumpMatchesFormat(mixed $expected, mixed $data, int $filter = 0, string $message = '') + public function assertDumpMatchesFormat(mixed $expected, mixed $data, int $filter = 0, string $message = ''): void { $this->assertStringMatchesFormat($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message); } 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