From 7ea24615d7b6f46a2af42cf860cd5f74f38eb7ad Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 21 Jul 2023 15:36:26 +0200 Subject: [PATCH] Add types to public and protected properties --- .github/expected-missing-return-types.diff | 22 +++- .../AbstractDoctrineExtension.php | 4 +- .../CompilerPass/RegisterMappingsPass.php | 16 +-- .../Doctrine/Form/DoctrineOrmExtension.php | 2 +- .../Doctrine/Form/DoctrineOrmTypeGuesser.php | 2 +- .../Doctrine/Form/Type/DoctrineType.php | 5 +- .../Bridge/Doctrine/ManagerRegistry.php | 5 +- .../Validator/Constraints/UniqueEntity.php | 18 +-- .../Validator/DoctrineInitializer.php | 2 +- .../Controller/AbstractController.php | 5 +- .../FrameworkBundle/HttpCache/HttpCache.php | 4 +- .../FrameworkBundle/Secrets/AbstractVault.php | 2 +- .../FrameworkBundle/Test/KernelTestCase.php | 11 +- .../Translation/Translator.php | 7 +- .../Security/Factory/AbstractFactory.php | 6 +- .../Security/Factory/RememberMeFactory.php | 2 +- .../Component/BrowserKit/AbstractBrowser.php | 24 ++-- src/Symfony/Component/BrowserKit/Cookie.php | 16 +-- .../Component/BrowserKit/CookieJar.php | 2 +- src/Symfony/Component/BrowserKit/History.php | 4 +- src/Symfony/Component/BrowserKit/Request.php | 14 +-- .../Cache/Adapter/TraceableAdapter.php | 2 +- .../Cache/Traits/AbstractAdapterTrait.php | 4 +- .../Component/Config/Definition/ArrayNode.php | 18 +-- .../Component/Config/Definition/BaseNode.php | 22 ++-- .../Builder/ArrayNodeDefinition.php | 26 ++--- .../Config/Definition/Builder/ExprBuilder.php | 8 +- .../Definition/Builder/MergeBuilder.php | 7 +- .../Config/Definition/Builder/NodeBuilder.php | 6 +- .../Definition/Builder/NodeDefinition.php | 34 +++--- .../Builder/NormalizationBuilder.php | 9 +- .../Builder/NumericNodeDefinition.php | 4 +- .../Config/Definition/Builder/TreeBuilder.php | 4 +- .../Definition/Builder/ValidationBuilder.php | 5 +- .../Config/Definition/NumericNode.php | 4 +- .../Config/Definition/PrototypedArrayNode.php | 12 +- .../Config/Definition/VariableNode.php | 6 +- src/Symfony/Component/Config/FileLocator.php | 2 +- .../Component/Config/Loader/FileLoader.php | 4 +- .../Component/Config/Loader/Loader.php | 4 +- .../Component/Console/Event/ConsoleEvent.php | 2 +- .../Component/Console/Helper/Helper.php | 2 +- .../Console/Helper/InputAwareHelper.php | 2 +- src/Symfony/Component/Console/Input/Input.php | 8 +- .../Compiler/AbstractRecursivePass.php | 7 +- .../DependencyInjection/Container.php | 20 ++-- .../DependencyInjection/Definition.php | 2 +- .../DependencyInjection/Dumper/Dumper.php | 2 +- .../Configurator/AbstractConfigurator.php | 2 +- .../AbstractServiceConfigurator.php | 4 +- .../DependencyInjection/Loader/FileLoader.php | 14 +-- .../Loader/PhpFileLoader.php | 2 +- .../Loader/XmlFileLoader.php | 2 +- .../Loader/YamlFileLoader.php | 4 +- .../ParameterBag/ParameterBag.php | 4 +- .../DomCrawler/AbstractUriElement.php | 17 +-- src/Symfony/Component/DomCrawler/Crawler.php | 5 +- .../Component/DomCrawler/Field/FormField.php | 30 +---- .../Exception/SilencedErrorContext.php | 2 +- .../Debug/TraceableEventDispatcher.php | 4 +- .../EventDispatcher/GenericEvent.php | 4 +- .../ExpressionLanguage/Expression.php | 2 +- .../ExpressionLanguage/Node/Node.php | 4 +- .../Component/ExpressionLanguage/Token.php | 6 +- .../ExpressionLanguage/TokenStream.php | 2 +- .../Iterator/MultiplePcreFilterIterator.php | 4 +- .../Component/Form/AbstractRendererEngine.php | 11 +- src/Symfony/Component/Form/ButtonBuilder.php | 2 +- .../Form/ChoiceList/ArrayChoiceList.php | 17 +-- .../Form/ChoiceList/View/ChoiceGroupView.php | 4 +- .../Form/ChoiceList/View/ChoiceListView.php | 4 +- .../Form/ChoiceList/View/ChoiceView.php | 10 +- .../BaseDateTimeTransformer.php | 7 +- .../DataTransformer/DataTransformerChain.php | 2 +- .../NumberToLocalizedStringTransformer.php | 5 +- .../PercentToLocalizedStringTransformer.php | 2 +- .../Core/EventListener/ResizeFormListener.php | 10 +- .../Form/Extension/Core/Type/MoneyType.php | 2 +- .../Component/Form/FormConfigBuilder.php | 5 +- src/Symfony/Component/Form/FormError.php | 6 +- src/Symfony/Component/Form/FormEvent.php | 3 +- src/Symfony/Component/Form/FormView.php | 6 +- .../Component/Form/ReversedTransformer.php | 2 +- .../Form/Test/FormPerformanceTestCase.php | 5 +- .../Test/Traits/ValidatorExtensionTrait.php | 5 +- .../Component/Form/Test/TypeTestCase.php | 11 +- .../HttpFoundation/BinaryFileResponse.php | 15 +-- .../Component/HttpFoundation/Cookie.php | 14 +-- .../Component/HttpFoundation/HeaderBag.php | 4 +- .../Component/HttpFoundation/JsonResponse.php | 6 +- .../Component/HttpFoundation/ParameterBag.php | 5 +- .../HttpFoundation/RedirectResponse.php | 2 +- .../Component/HttpFoundation/Request.php | 103 +++++------------- .../Component/HttpFoundation/Response.php | 38 ++----- .../HttpFoundation/ResponseHeaderBag.php | 6 +- .../Session/Attribute/AttributeBag.php | 4 +- .../HttpFoundation/Session/Session.php | 2 +- .../Session/Storage/MetadataBag.php | 12 +- .../Storage/MockArraySessionStorage.php | 39 ++----- .../Session/Storage/NativeSessionStorage.php | 26 +---- .../Session/Storage/Proxy/AbstractProxy.php | 12 +- .../Storage/Proxy/SessionHandlerProxy.php | 2 +- .../HttpFoundation/StreamedResponse.php | 7 +- .../Component/HttpKernel/Bundle/Bundle.php | 13 +-- .../ContainerControllerResolver.php | 2 +- .../Controller/ControllerReference.php | 6 +- .../DataCollector/DataCollector.php | 5 +- .../DataCollector/RouterDataCollector.php | 2 +- .../EventListener/ErrorListener.php | 8 +- .../HttpCache/AbstractSurrogate.php | 2 +- .../Component/HttpKernel/HttpCache/Store.php | 2 +- .../Component/HttpKernel/HttpKernel.php | 6 +- .../HttpKernel/HttpKernelBrowser.php | 2 +- src/Symfony/Component/HttpKernel/Kernel.php | 12 +- .../Ldap/Adapter/AbstractConnection.php | 2 +- .../Component/Ldap/Adapter/AbstractQuery.php | 8 +- .../Transport/SesHttpAsyncAwsTransport.php | 3 +- .../Mailer/Test/TransportFactoryTestCase.php | 6 +- .../Transport/AbstractHttpTransport.php | 6 +- .../Transport/AbstractTransportFactory.php | 6 +- .../Discord/Embeds/AbstractDiscordEmbed.php | 2 +- .../Embeds/AbstractDiscordEmbedObject.php | 2 +- .../Bridge/Engagespot/EngagespotOptions.php | 2 +- .../Bridge/Firebase/FirebaseOptions.php | 2 +- .../LinkedIn/Share/AbstractLinkedInShare.php | 2 +- .../Bridge/Slack/Block/AbstractSlackBlock.php | 2 +- .../Slack/Block/AbstractSlackBlockElement.php | 2 +- .../Markup/AbstractTelegramReplyMarkup.php | 2 +- .../Markup/Button/AbstractKeyboardButton.php | 2 +- .../Notifier/Channel/AbstractChannel.php | 4 +- .../Notifier/Transport/AbstractTransport.php | 6 +- .../Transport/AbstractTransportFactory.php | 4 +- src/Symfony/Component/Process/Process.php | 2 +- .../PropertyAccess/PropertyPathIterator.php | 2 +- src/Symfony/Component/PropertyInfo/Type.php | 4 +- .../Exception/MethodNotAllowedException.php | 2 +- .../Routing/Generator/UrlGenerator.php | 15 +-- .../Routing/Loader/AnnotationFileLoader.php | 2 +- .../Loader/Configurator/RouteConfigurator.php | 2 +- .../Loader/Configurator/Traits/AddTrait.php | 9 +- .../Loader/Configurator/Traits/RouteTrait.php | 5 +- .../Routing/Matcher/TraceableUrlMatcher.php | 2 +- .../Component/Routing/Matcher/UrlMatcher.php | 13 +-- src/Symfony/Component/Routing/Router.php | 50 ++------- .../Component/Runtime/GenericRuntime.php | 2 +- .../Security/Core/Role/RoleHierarchy.php | 5 +- .../Validator/Constraints/UserPassword.php | 4 +- .../DefaultAuthenticationFailureHandler.php | 10 +- .../DefaultAuthenticationSuccessHandler.php | 10 +- .../Http/Authenticator/Passport/Passport.php | 2 +- .../RememberMe/AbstractRememberMeHandler.php | 7 +- .../Serializer/Encoder/JsonDecode.php | 5 - .../Serializer/Encoder/JsonEncoder.php | 4 +- .../Serializer/Mapping/Loader/FileLoader.php | 2 +- .../Normalizer/AbstractNormalizer.php | 14 +-- .../Normalizer/AbstractObjectNormalizer.php | 7 +- .../Normalizer/DenormalizerAwareTrait.php | 5 +- .../Normalizer/NormalizerAwareTrait.php | 5 +- .../Normalizer/ObjectNormalizer.php | 2 +- .../Component/Serializer/Serializer.php | 10 +- .../Serializer/SerializerAwareTrait.php | 5 +- .../Component/String/AbstractString.php | 4 +- .../Component/Templating/DelegatingEngine.php | 2 +- .../Component/Templating/Helper/Helper.php | 2 +- .../Templating/Helper/SlotsHelper.php | 4 +- .../Templating/Loader/CacheLoader.php | 4 +- .../Templating/Loader/ChainLoader.php | 2 +- .../Templating/Loader/FilesystemLoader.php | 2 +- .../Component/Templating/Loader/Loader.php | 5 +- .../Component/Templating/PhpEngine.php | 23 ++-- .../Component/Templating/Storage/Storage.php | 2 +- .../Templating/TemplateReference.php | 2 +- .../Catalogue/AbstractOperation.php | 8 +- .../Translation/Dumper/FileDumper.php | 4 +- .../Translation/Dumper/IcuResFileDumper.php | 2 +- .../Component/Translation/Translator.php | 2 +- src/Symfony/Component/Uid/AbstractUid.php | 2 +- .../Component/Validator/Constraint.php | 4 +- .../Validator/ConstraintValidator.php | 5 +- .../Validator/ConstraintValidatorFactory.php | 2 +- .../Constraints/AbstractComparison.php | 6 +- .../Component/Validator/Constraints/All.php | 4 +- .../Validator/Constraints/AtLeastOneOf.php | 10 +- .../Component/Validator/Constraints/Bic.php | 8 +- .../Component/Validator/Constraints/Blank.php | 2 +- .../Validator/Constraints/CardScheme.php | 4 +- .../Constraints/CardSchemeValidator.php | 2 +- .../Validator/Constraints/Choice.php | 18 +-- .../Component/Validator/Constraints/Cidr.php | 14 +-- .../Validator/Constraints/Collection.php | 18 +-- .../Validator/Constraints/Compound.php | 2 +- .../Component/Validator/Constraints/Count.php | 14 +-- .../Validator/Constraints/Country.php | 4 +- .../Validator/Constraints/CssColor.php | 6 +- .../Validator/Constraints/Currency.php | 2 +- .../Component/Validator/Constraints/Date.php | 2 +- .../Validator/Constraints/DateTime.php | 4 +- .../Validator/Constraints/DivisibleBy.php | 2 +- .../Component/Validator/Constraints/Email.php | 4 +- .../Validator/Constraints/EqualTo.php | 2 +- .../Validator/Constraints/Existence.php | 4 +- .../Validator/Constraints/Expression.php | 6 +- .../Constraints/ExpressionSyntax.php | 6 +- .../Component/Validator/Constraints/File.php | 40 +++---- .../Validator/Constraints/GreaterThan.php | 2 +- .../Constraints/GreaterThanOrEqual.php | 2 +- .../Validator/Constraints/GroupSequence.php | 6 +- .../Validator/Constraints/Hostname.php | 4 +- .../Component/Validator/Constraints/Iban.php | 2 +- .../Validator/Constraints/IdenticalTo.php | 2 +- .../Component/Validator/Constraints/Image.php | 54 ++++----- .../Component/Validator/Constraints/Ip.php | 6 +- .../Validator/Constraints/IsFalse.php | 2 +- .../Validator/Constraints/IsNull.php | 2 +- .../Validator/Constraints/IsTrue.php | 2 +- .../Component/Validator/Constraints/Isbn.php | 10 +- .../Component/Validator/Constraints/Isin.php | 2 +- .../Component/Validator/Constraints/Issn.php | 6 +- .../Component/Validator/Constraints/Json.php | 2 +- .../Validator/Constraints/Language.php | 4 +- .../Validator/Constraints/Length.php | 14 +-- .../Validator/Constraints/LessThan.php | 2 +- .../Validator/Constraints/LessThanOrEqual.php | 2 +- .../Validator/Constraints/Locale.php | 4 +- .../Component/Validator/Constraints/Luhn.php | 2 +- .../Validator/Constraints/Negative.php | 2 +- .../Validator/Constraints/NegativeOrZero.php | 2 +- .../Validator/Constraints/NotBlank.php | 4 +- .../Constraints/NotCompromisedPassword.php | 6 +- .../Validator/Constraints/NotEqualTo.php | 2 +- .../Validator/Constraints/NotIdenticalTo.php | 2 +- .../Validator/Constraints/NotNull.php | 2 +- .../Validator/Constraints/Positive.php | 2 +- .../Validator/Constraints/PositiveOrZero.php | 2 +- .../Component/Validator/Constraints/Range.php | 18 +-- .../Component/Validator/Constraints/Regex.php | 8 +- .../Validator/Constraints/Sequentially.php | 4 +- .../Component/Validator/Constraints/Time.php | 2 +- .../Validator/Constraints/Timezone.php | 8 +- .../Validator/Constraints/Traverse.php | 2 +- .../Component/Validator/Constraints/Type.php | 4 +- .../Component/Validator/Constraints/Ulid.php | 2 +- .../Validator/Constraints/Unique.php | 2 +- .../Component/Validator/Constraints/Url.php | 6 +- .../Component/Validator/Constraints/Uuid.php | 10 +- .../Component/Validator/Constraints/Valid.php | 2 +- .../Component/Validator/Constraints/When.php | 6 +- .../Factory/LazyLoadingMetadataFactory.php | 6 +- .../Mapping/Loader/AbstractLoader.php | 2 +- .../Validator/Mapping/Loader/FileLoader.php | 2 +- .../Validator/Mapping/Loader/LoaderChain.php | 2 +- .../Mapping/Loader/StaticMethodLoader.php | 2 +- .../Mapping/Loader/XmlFileLoader.php | 4 +- .../Mapping/Loader/YamlFileLoader.php | 7 +- .../Test/ConstraintValidatorTestCase.php | 27 +++-- .../Tests/Constraints/CollectionTest.php | 16 --- .../Tests/Constraints/ImageValidatorTest.php | 80 -------------- .../Validator/RecursiveValidator.php | 8 +- .../VarDumper/Caster/CutArrayStub.php | 2 +- .../Component/VarDumper/Caster/EnumStub.php | 2 +- .../Component/VarDumper/Caster/FrameStub.php | 4 +- .../Component/VarDumper/Caster/LinkStub.php | 2 +- .../Component/VarDumper/Caster/TraceStub.php | 8 +- .../VarDumper/Cloner/AbstractCloner.php | 8 +- .../Component/VarDumper/Cloner/Cursor.php | 34 +++--- .../Component/VarDumper/Cloner/Stub.php | 16 +-- .../VarDumper/Dumper/AbstractDumper.php | 8 +- .../Component/VarDumper/Dumper/CliDumper.php | 18 +-- .../Component/VarDumper/Dumper/HtmlDumper.php | 13 +-- .../VarExporter/Internal/Hydrator.php | 20 ++-- .../VarExporter/Internal/Registry.php | 8 +- .../Component/VarExporter/Internal/Values.php | 8 +- .../Workflow/Dumper/GraphvizDumper.php | 2 +- .../Component/Workflow/Event/Event.php | 3 +- .../Service/ServiceSubscriberTrait.php | 3 +- .../Service/ServiceSubscriberTraitTest.php | 3 +- 276 files changed, 829 insertions(+), 1241 deletions(-) diff --git a/.github/expected-missing-return-types.diff b/.github/expected-missing-return-types.diff index 2b5235246d528..a1396fac0aaec 100644 --- a/.github/expected-missing-return-types.diff +++ b/.github/expected-missing-return-types.diff @@ -45,6 +45,16 @@ diff --git a/src/Symfony/Component/BrowserKit/AbstractBrowser.php b/src/Symfony/ + 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 +@@ -94,5 +94,5 @@ abstract class NodeDefinition implements NodeParentInterface + * @return NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition + */ +- public function end(): NodeParentInterface ++ public function end(): NodeParentInterface|NodeBuilder|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 @@ -72,14 +82,14 @@ diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Com 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 -@@ -41,5 +41,5 @@ abstract class AbstractRecursivePass implements CompilerPassInterface +@@ -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; -@@ -72,5 +72,5 @@ abstract class AbstractRecursivePass implements CompilerPassInterface +@@ -69,5 +69,5 @@ abstract class AbstractRecursivePass implements CompilerPassInterface * @return mixed */ - protected function processValue(mixed $value, bool $isRoot = false) @@ -278,28 +288,28 @@ diff --git a/src/Symfony/Component/Form/FormTypeInterface.php b/src/Symfony/Comp 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 -@@ -38,5 +38,5 @@ abstract class Bundle implements BundleInterface +@@ -35,5 +35,5 @@ abstract class Bundle implements BundleInterface * @return void */ - public function boot() + public function boot(): void { } -@@ -45,5 +45,5 @@ abstract class Bundle implements BundleInterface +@@ -42,5 +42,5 @@ abstract class Bundle implements BundleInterface * @return void */ - public function shutdown() + public function shutdown(): void { } -@@ -55,5 +55,5 @@ abstract class Bundle implements BundleInterface +@@ -52,5 +52,5 @@ abstract class Bundle implements BundleInterface * @return void */ - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { } -@@ -125,5 +125,5 @@ abstract class Bundle implements BundleInterface +@@ -122,5 +122,5 @@ abstract class Bundle implements BundleInterface * @return void */ - public function registerCommands(Application $application) diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php index ae3b5827a4fe3..2aec2cdadfb9e 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php @@ -28,12 +28,12 @@ abstract class AbstractDoctrineExtension extends Extension /** * Used inside metadata driver method to simplify aggregation of data. */ - protected $aliasMap = []; + protected array $aliasMap = []; /** * Used inside metadata driver method to simplify aggregation of data. */ - protected $drivers = []; + protected array $drivers = []; /** * @param array $objectManager A configured object manager diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php index d3e95bb8edd20..2670bf97fb2d1 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php @@ -35,17 +35,15 @@ abstract class RegisterMappingsPass implements CompilerPassInterface /** * DI object for the driver to use, either a service definition for a * private service or a reference for a public service. - * - * @var Definition|Reference */ - protected $driver; + protected Definition|Reference $driver; /** * List of namespaces handled by the driver. * * @var string[] */ - protected $namespaces; + protected array $namespaces; /** * List of potential container parameters that hold the object manager name @@ -54,24 +52,20 @@ abstract class RegisterMappingsPass implements CompilerPassInterface * * @var string[] */ - protected $managerParameters; + protected array $managerParameters; /** * Naming pattern of the metadata chain driver service ids, for example * 'doctrine.orm.%s_metadata_driver'. - * - * @var string */ - protected $driverPattern; + protected string $driverPattern; /** * A name for a parameter in the container. If set, this compiler pass will * only do anything if the parameter is present. (But regardless of the * value of that parameter. - * - * @var string|false */ - protected $enabledParameter; + protected string|false $enabledParameter; /** * Naming pattern for the configuration service id, for example diff --git a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmExtension.php b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmExtension.php index 75d7562369cce..66ae854829786 100644 --- a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmExtension.php +++ b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmExtension.php @@ -18,7 +18,7 @@ class DoctrineOrmExtension extends AbstractExtension { - protected $registry; + protected ManagerRegistry $registry; public function __construct(ManagerRegistry $registry) { diff --git a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php index d25ae768f24c0..97625f87f3dd7 100644 --- a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php +++ b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php @@ -36,7 +36,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface { - protected $registry; + protected ManagerRegistry $registry; private array $cache = []; diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php index ae5ece50ed301..5b62d1387f7d5 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php @@ -31,10 +31,7 @@ abstract class DoctrineType extends AbstractType implements ResetInterface { - /** - * @var ManagerRegistry - */ - protected $registry; + protected ManagerRegistry $registry; /** * @var IdReader[] diff --git a/src/Symfony/Bridge/Doctrine/ManagerRegistry.php b/src/Symfony/Bridge/Doctrine/ManagerRegistry.php index bcd16dc06e6f3..f7a2cac124d2b 100644 --- a/src/Symfony/Bridge/Doctrine/ManagerRegistry.php +++ b/src/Symfony/Bridge/Doctrine/ManagerRegistry.php @@ -24,10 +24,7 @@ */ abstract class ManagerRegistry extends AbstractManagerRegistry { - /** - * @var Container - */ - protected $container; + protected Container $container; protected function getService($name): object { diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php index db66051158257..f807a1e86d5d9 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php +++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php @@ -27,21 +27,21 @@ class UniqueEntity extends Constraint self::NOT_UNIQUE_ERROR => 'NOT_UNIQUE_ERROR', ]; - public $message = 'This value is already used.'; - public $service = 'doctrine.orm.validator.unique'; - public $em; - public $entityClass; - public $repositoryMethod = 'findBy'; - public $fields = []; - public $errorPath; - public $ignoreNull = true; + public string $message = 'This value is already used.'; + public string $service = 'doctrine.orm.validator.unique'; + public ?string $em = null; + public ?string $entityClass = null; + public string $repositoryMethod = 'findBy'; + public array|string $fields = []; + public ?string $errorPath = null; + public bool|array|string $ignoreNull = true; /** * @param array|string $fields The combination of fields that must contain unique values or a set of options * @param bool|array|string $ignoreNull The combination of fields that ignore null values */ public function __construct( - $fields, + array|string $fields, string $message = null, string $service = null, string $em = null, diff --git a/src/Symfony/Bridge/Doctrine/Validator/DoctrineInitializer.php b/src/Symfony/Bridge/Doctrine/Validator/DoctrineInitializer.php index be03b670f86b9..ca5c4662f38f7 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/DoctrineInitializer.php +++ b/src/Symfony/Bridge/Doctrine/Validator/DoctrineInitializer.php @@ -21,7 +21,7 @@ */ class DoctrineInitializer implements ObjectInitializerInterface { - protected $registry; + protected ManagerRegistry $registry; public function __construct(ManagerRegistry $registry) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php index 3149f1ae89964..6cdfb3d8ae8dd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php @@ -55,10 +55,7 @@ */ abstract class AbstractController implements ServiceSubscriberInterface { - /** - * @var ContainerInterface - */ - protected $container; + protected ContainerInterface $container; #[Required] public function setContainer(ContainerInterface $container): ?ContainerInterface diff --git a/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php b/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php index f312a7afe4946..ab8cae6b74d47 100644 --- a/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php +++ b/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php @@ -27,8 +27,8 @@ */ class HttpCache extends BaseHttpCache { - protected $cacheDir; - protected $kernel; + protected ?string $cacheDir = null; + protected KernelInterface $kernel; private ?StoreInterface $store = null; private ?SurrogateInterface $surrogate; diff --git a/src/Symfony/Bundle/FrameworkBundle/Secrets/AbstractVault.php b/src/Symfony/Bundle/FrameworkBundle/Secrets/AbstractVault.php index ac2078f6d291c..374964a06b426 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Secrets/AbstractVault.php +++ b/src/Symfony/Bundle/FrameworkBundle/Secrets/AbstractVault.php @@ -16,7 +16,7 @@ */ abstract class AbstractVault { - protected $lastMessage; + protected ?string $lastMessage = null; public function getLastMessage(): ?string { diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php index e5ef9112cc893..d14c4dde85e2f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php @@ -27,14 +27,9 @@ abstract class KernelTestCase extends TestCase use MailerAssertionsTrait; use NotificationAssertionsTrait; - protected static $class; - - /** - * @var KernelInterface - */ - protected static $kernel; - - protected static $booted = false; + protected static ?string $class = null; + protected static ?KernelInterface $kernel = null; + protected static bool $booted = false; protected function tearDown(): void { diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php index 3cce60ec111bf..de1f4f925b6d1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php @@ -24,10 +24,9 @@ */ class Translator extends BaseTranslator implements WarmableInterface { - protected $container; - protected $loaderIds; - - protected $options = [ + protected ContainerInterface $container; + protected array $loaderIds; + protected array $options = [ 'cache_dir' => null, 'debug' => false, 'resource_files' => [], diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php index 3dd768b7730d2..b0ce4030b5d58 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php @@ -25,14 +25,14 @@ */ abstract class AbstractFactory implements AuthenticatorFactoryInterface { - protected $options = [ + protected array $options = [ 'check_path' => '/login_check', 'use_forward' => false, 'require_previous_session' => false, 'login_path' => '/login', ]; - protected $defaultSuccessHandlerOptions = [ + protected array $defaultSuccessHandlerOptions = [ 'always_use_default_target_path' => false, 'default_target_path' => '/', 'login_path' => '/login', @@ -40,7 +40,7 @@ abstract class AbstractFactory implements AuthenticatorFactoryInterface 'use_referer' => false, ]; - protected $defaultFailureHandlerOptions = [ + protected array $defaultFailureHandlerOptions = [ 'failure_path' => null, 'failure_forward' => false, 'login_path' => '/login', diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RememberMeFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RememberMeFactory.php index 95b59c3e5c248..d474e96c16016 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RememberMeFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RememberMeFactory.php @@ -32,7 +32,7 @@ class RememberMeFactory implements AuthenticatorFactoryInterface, PrependExtensi { public const PRIORITY = -50; - protected $options = [ + protected array $options = [ 'name' => 'REMEMBERME', 'lifetime' => 31536000, 'path' => '/', diff --git a/src/Symfony/Component/BrowserKit/AbstractBrowser.php b/src/Symfony/Component/BrowserKit/AbstractBrowser.php index a74e71087656e..d6c5d660f6a72 100644 --- a/src/Symfony/Component/BrowserKit/AbstractBrowser.php +++ b/src/Symfony/Component/BrowserKit/AbstractBrowser.php @@ -32,19 +32,19 @@ */ abstract class AbstractBrowser { - protected $history; - protected $cookieJar; - protected $server = []; - protected $internalRequest; - protected $request; - protected $internalResponse; - protected $response; - protected $crawler; + protected History $history; + protected CookieJar $cookieJar; + protected array $server = []; + protected Request $internalRequest; + protected object $request; + protected Response $internalResponse; + protected object $response; + protected Crawler $crawler; protected bool $useHtml5Parser = true; - protected $insulated = false; - protected $redirect; - protected $followRedirects = true; - protected $followMetaRefresh = false; + protected bool $insulated = false; + protected ?string $redirect; + protected bool $followRedirects = true; + protected bool $followMetaRefresh = false; private int $maxRedirects = -1; private int $redirectCount = 0; diff --git a/src/Symfony/Component/BrowserKit/Cookie.php b/src/Symfony/Component/BrowserKit/Cookie.php index ed9bf8e8bdd1d..b16c0a0a2e77f 100644 --- a/src/Symfony/Component/BrowserKit/Cookie.php +++ b/src/Symfony/Component/BrowserKit/Cookie.php @@ -35,14 +35,14 @@ class Cookie 'D M d H:i:s Y T', ]; - protected $name; - protected $value; - protected $expires; - protected $path; - protected $domain; - protected $secure; - protected $httponly; - protected $rawValue; + protected string $name; + protected string $value; + protected ?string $expires = null; + protected string $path; + protected string $domain; + protected bool $secure; + protected bool $httponly; + protected string $rawValue; private ?string $samesite; /** diff --git a/src/Symfony/Component/BrowserKit/CookieJar.php b/src/Symfony/Component/BrowserKit/CookieJar.php index 5bfd2dc3575ac..59445d5fbea2f 100644 --- a/src/Symfony/Component/BrowserKit/CookieJar.php +++ b/src/Symfony/Component/BrowserKit/CookieJar.php @@ -20,7 +20,7 @@ */ class CookieJar { - protected $cookieJar = []; + protected array $cookieJar = []; public function set(Cookie $cookie): void { diff --git a/src/Symfony/Component/BrowserKit/History.php b/src/Symfony/Component/BrowserKit/History.php index 6d3248aca86ef..8fe4f2bbcced3 100644 --- a/src/Symfony/Component/BrowserKit/History.php +++ b/src/Symfony/Component/BrowserKit/History.php @@ -20,8 +20,8 @@ */ class History { - protected $stack = []; - protected $position = -1; + protected array $stack = []; + protected int $position = -1; /** * Clears the history. diff --git a/src/Symfony/Component/BrowserKit/Request.php b/src/Symfony/Component/BrowserKit/Request.php index 6c0af9ad0820b..37031a41bac2f 100644 --- a/src/Symfony/Component/BrowserKit/Request.php +++ b/src/Symfony/Component/BrowserKit/Request.php @@ -16,13 +16,13 @@ */ class Request { - protected $uri; - protected $method; - protected $parameters; - protected $files; - protected $cookies; - protected $server; - protected $content; + protected string $uri; + protected string $method; + protected array $parameters; + protected array $files; + protected array $cookies; + protected array $server; + protected ?string $content; /** * @param string $uri The request URI diff --git a/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php b/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php index f83cb2b723ed7..784c156b48b7b 100644 --- a/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php @@ -27,7 +27,7 @@ */ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInterface, ResettableInterface { - protected $pool; + protected AdapterInterface $pool; private array $calls = []; public function __construct(AdapterInterface $pool) diff --git a/src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php b/src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php index 91dc72b045818..4703c7ba022f7 100644 --- a/src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php +++ b/src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php @@ -43,9 +43,9 @@ trait AbstractAdapterTrait private array $ids = []; /** - * @var int|null The maximum length to enforce for identifiers or null when no limit applies + * The maximum length to enforce for identifiers or null when no limit applies. */ - protected $maxIdLength; + protected ?int $maxIdLength = null; /** * Fetches several cache items. diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index 790e272c98488..15ad478623ea6 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -22,15 +22,15 @@ */ class ArrayNode extends BaseNode implements PrototypeNodeInterface { - protected $xmlRemappings = []; - protected $children = []; - protected $allowFalse = false; - protected $allowNewKeys = true; - protected $addIfNotSet = false; - protected $performDeepMerging = true; - protected $ignoreExtraKeys = false; - protected $removeExtraKeys = true; - protected $normalizeKeys = true; + protected array $xmlRemappings = []; + protected array $children = []; + protected bool $allowFalse = false; + protected bool $allowNewKeys = true; + protected bool $addIfNotSet = false; + protected bool $performDeepMerging = true; + protected bool $ignoreExtraKeys = false; + protected bool $removeExtraKeys = true; + protected bool $normalizeKeys = true; public function setNormalizeKeys(bool $normalizeKeys): void { diff --git a/src/Symfony/Component/Config/Definition/BaseNode.php b/src/Symfony/Component/Config/Definition/BaseNode.php index 1f766a22406aa..7f138012a5b68 100644 --- a/src/Symfony/Component/Config/Definition/BaseNode.php +++ b/src/Symfony/Component/Config/Definition/BaseNode.php @@ -29,17 +29,17 @@ abstract class BaseNode implements NodeInterface private static array $placeholderUniquePrefixes = []; private static array $placeholders = []; - protected $name; - protected $parent; - protected $normalizationClosures = []; - protected $normalizedTypes = []; - protected $finalValidationClosures = []; - protected $allowOverwrite = true; - protected $required = false; - protected $deprecation = []; - protected $equivalentValues = []; - protected $attributes = []; - protected $pathSeparator; + protected string $name; + protected ?NodeInterface $parent; + protected array $normalizationClosures = []; + protected array $normalizedTypes = []; + protected array $finalValidationClosures = []; + protected bool $allowOverwrite = true; + protected bool $required = false; + protected array $deprecation = []; + protected array $equivalentValues = []; + protected array $attributes = []; + protected string $pathSeparator; private mixed $handlingPlaceholder = null; diff --git a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php index f9e089d14257a..dd6c58da746c1 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php @@ -23,19 +23,19 @@ */ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinitionInterface { - protected $performDeepMerging = true; - protected $ignoreExtraKeys = false; - protected $removeExtraKeys = true; - protected $children = []; - protected $prototype; - protected $atLeastOne = false; - protected $allowNewKeys = true; - protected $key; - protected $removeKeyItem; - protected $addDefaults = false; - protected $addDefaultChildren = false; - protected $nodeBuilder; - protected $normalizeKeys = true; + protected bool $performDeepMerging = true; + protected bool $ignoreExtraKeys = false; + protected bool $removeExtraKeys = true; + protected array $children = []; + protected NodeDefinition $prototype; + protected bool $atLeastOne = false; + protected bool $allowNewKeys = true; + protected ?string $key = null; + protected bool $removeKeyItem = false; + protected bool $addDefaults = false; + protected int|string|array|null|false $addDefaultChildren = false; + protected NodeBuilder $nodeBuilder; + protected bool $normalizeKeys = true; public function __construct(?string $name, NodeParentInterface $parent = null) { diff --git a/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php b/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php index 9cb44148121e6..9481d96ae073f 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php @@ -26,11 +26,11 @@ class ExprBuilder public const TYPE_NULL = 'null'; public const TYPE_ARRAY = 'array'; - protected $node; + public string $allowedTypes; + public ?\Closure $ifPart = null; + public ?\Closure $thenPart = null; - public $allowedTypes; - public $ifPart; - public $thenPart; + protected NodeDefinition $node; public function __construct(NodeDefinition $node) { diff --git a/src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php b/src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php index f8980a6e041c9..e22ed446a4a96 100644 --- a/src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php @@ -18,9 +18,10 @@ */ class MergeBuilder { - protected $node; - public $allowFalse = false; - public $allowOverwrite = true; + public bool $allowFalse = false; + public bool $allowOverwrite = true; + + protected NodeDefinition $node; public function __construct(NodeDefinition $node) { diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php b/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php index 4447cb48b207d..d79075a912fb7 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php @@ -18,8 +18,8 @@ */ class NodeBuilder implements NodeParentInterface { - protected $parent; - protected $nodeMapping; + protected (NodeDefinition&ParentNodeDefinitionInterface)|null $parent = null; + protected array $nodeMapping; public function __construct() { @@ -39,7 +39,7 @@ public function __construct() * * @return $this */ - public function setParent(?ParentNodeDefinitionInterface $parent): static + public function setParent((NodeDefinition&ParentNodeDefinitionInterface)|null $parent): static { $this->parent = $parent; diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php index 2defcfe64b9b4..16f97d842280f 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php @@ -22,21 +22,21 @@ */ abstract class NodeDefinition implements NodeParentInterface { - protected $name; - protected $normalization; - protected $validation; - protected $defaultValue; - protected $default = false; - protected $required = false; - protected $deprecation = []; - protected $merge; - protected $allowEmptyValue = true; - protected $nullEquivalent; - protected $trueEquivalent = true; - protected $falseEquivalent = false; - protected $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR; - protected $parent; - protected $attributes = []; + protected ?string $name = null; + protected NormalizationBuilder $normalization; + protected ValidationBuilder $validation; + protected mixed $defaultValue; + protected bool $default = false; + protected bool $required = false; + protected array $deprecation = []; + protected MergeBuilder $merge; + protected bool $allowEmptyValue = true; + protected mixed $nullEquivalent = null; + protected mixed $trueEquivalent = true; + protected mixed $falseEquivalent = false; + protected string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR; + protected NodeParentInterface|NodeInterface|null $parent; + protected array $attributes = []; public function __construct(?string $name, NodeParentInterface $parent = null) { @@ -90,8 +90,10 @@ public function attribute(string $key, mixed $value): static /** * Returns the parent node. + * + * @return NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition */ - public function end(): NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition|null + public function end(): NodeParentInterface { return $this->parent; } diff --git a/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php b/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php index 0e362d9fa3c90..e5cb89d0c06c2 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php @@ -18,10 +18,11 @@ */ class NormalizationBuilder { - protected $node; - public $before = []; - public $declaredTypes = []; - public $remappings = []; + public array $before = []; + public array $declaredTypes = []; + public array $remappings = []; + + protected NodeDefinition $node; public function __construct(NodeDefinition $node) { diff --git a/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php index 890910c95d4fe..41129a2ff9121 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php @@ -20,8 +20,8 @@ */ abstract class NumericNodeDefinition extends ScalarNodeDefinition { - protected $min; - protected $max; + protected int|float|null $min = null; + protected int|float|null $max = null; /** * Ensures that the value is smaller than the given reference. diff --git a/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php b/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php index c4f0c2fd55e01..470181e05af8d 100644 --- a/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php @@ -20,8 +20,8 @@ */ class TreeBuilder implements NodeParentInterface { - protected $tree; - protected $root; + protected NodeInterface $tree; + protected NodeDefinition $root; public function __construct(string $name, string $type = 'array', NodeBuilder $builder = null) { diff --git a/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php b/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php index 1bee851b658c1..b936205b2dd74 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php @@ -18,8 +18,9 @@ */ class ValidationBuilder { - protected $node; - public $rules = []; + public array $rules = []; + + protected NodeDefinition $node; public function __construct(NodeDefinition $node) { diff --git a/src/Symfony/Component/Config/Definition/NumericNode.php b/src/Symfony/Component/Config/Definition/NumericNode.php index da32b843a7dc9..1ea84ba85f7f2 100644 --- a/src/Symfony/Component/Config/Definition/NumericNode.php +++ b/src/Symfony/Component/Config/Definition/NumericNode.php @@ -20,8 +20,8 @@ */ class NumericNode extends ScalarNode { - protected $min; - protected $max; + protected int|float|null $min; + protected int|float|null $max; public function __construct(?string $name, NodeInterface $parent = null, int|float $min = null, int|float $max = null, string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR) { diff --git a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php index 370a20c15e2fe..a11e726384315 100644 --- a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php +++ b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php @@ -23,12 +23,12 @@ */ class PrototypedArrayNode extends ArrayNode { - protected $prototype; - protected $keyAttribute; - protected $removeKeyAttribute = false; - protected $minNumberOfElements = 0; - protected $defaultValue = []; - protected $defaultChildren; + protected PrototypeNodeInterface $prototype; + protected ?string $keyAttribute = null; + protected bool $removeKeyAttribute = false; + protected int $minNumberOfElements = 0; + protected array $defaultValue = []; + protected ?array $defaultChildren = null; /** * @var NodeInterface[] An array of the prototypes of the simplified value children */ diff --git a/src/Symfony/Component/Config/Definition/VariableNode.php b/src/Symfony/Component/Config/Definition/VariableNode.php index b4abcc3b38b45..a4fbace8e9ecb 100644 --- a/src/Symfony/Component/Config/Definition/VariableNode.php +++ b/src/Symfony/Component/Config/Definition/VariableNode.php @@ -23,9 +23,9 @@ */ class VariableNode extends BaseNode implements PrototypeNodeInterface { - protected $defaultValueSet = false; - protected $defaultValue; - protected $allowEmptyValue = true; + protected bool $defaultValueSet = false; + protected mixed $defaultValue = null; + protected bool $allowEmptyValue = true; public function setDefaultValue(mixed $value): void { diff --git a/src/Symfony/Component/Config/FileLocator.php b/src/Symfony/Component/Config/FileLocator.php index bc5af7f89cd2f..a2a35b1c7e628 100644 --- a/src/Symfony/Component/Config/FileLocator.php +++ b/src/Symfony/Component/Config/FileLocator.php @@ -20,7 +20,7 @@ */ class FileLocator implements FileLocatorInterface { - protected $paths; + protected array $paths; /** * @param string|string[] $paths A path or an array of paths where to look for resources diff --git a/src/Symfony/Component/Config/Loader/FileLoader.php b/src/Symfony/Component/Config/Loader/FileLoader.php index bad02a66197aa..af1e5e7443764 100644 --- a/src/Symfony/Component/Config/Loader/FileLoader.php +++ b/src/Symfony/Component/Config/Loader/FileLoader.php @@ -25,9 +25,9 @@ */ abstract class FileLoader extends Loader { - protected static $loading = []; + protected static array $loading = []; - protected $locator; + protected FileLocatorInterface $locator; private ?string $currentDir = null; diff --git a/src/Symfony/Component/Config/Loader/Loader.php b/src/Symfony/Component/Config/Loader/Loader.php index 32d4396f51ec9..1de17e103716e 100644 --- a/src/Symfony/Component/Config/Loader/Loader.php +++ b/src/Symfony/Component/Config/Loader/Loader.php @@ -20,8 +20,8 @@ */ abstract class Loader implements LoaderInterface { - protected $resolver; - protected $env; + protected LoaderResolverInterface $resolver; + protected ?string $env; public function __construct(string $env = null) { diff --git a/src/Symfony/Component/Console/Event/ConsoleEvent.php b/src/Symfony/Component/Console/Event/ConsoleEvent.php index 6ba1615fe0984..437a58e1e1b53 100644 --- a/src/Symfony/Component/Console/Event/ConsoleEvent.php +++ b/src/Symfony/Component/Console/Event/ConsoleEvent.php @@ -23,7 +23,7 @@ */ class ConsoleEvent extends Event { - protected $command; + protected ?Command $command; private InputInterface $input; private OutputInterface $output; diff --git a/src/Symfony/Component/Console/Helper/Helper.php b/src/Symfony/Component/Console/Helper/Helper.php index db0cd661d36f2..6b13659030662 100644 --- a/src/Symfony/Component/Console/Helper/Helper.php +++ b/src/Symfony/Component/Console/Helper/Helper.php @@ -21,7 +21,7 @@ */ abstract class Helper implements HelperInterface { - protected $helperSet; + protected ?HelperSet $helperSet = null; public function setHelperSet(?HelperSet $helperSet): void { diff --git a/src/Symfony/Component/Console/Helper/InputAwareHelper.php b/src/Symfony/Component/Console/Helper/InputAwareHelper.php index 8e7ee52a54251..47126bdaa8fa3 100644 --- a/src/Symfony/Component/Console/Helper/InputAwareHelper.php +++ b/src/Symfony/Component/Console/Helper/InputAwareHelper.php @@ -21,7 +21,7 @@ */ abstract class InputAwareHelper extends Helper implements InputAwareInterface { - protected $input; + protected InputInterface $input; public function setInput(InputInterface $input): void { diff --git a/src/Symfony/Component/Console/Input/Input.php b/src/Symfony/Component/Console/Input/Input.php index 740b1bc042daf..6a9248b7aa8df 100644 --- a/src/Symfony/Component/Console/Input/Input.php +++ b/src/Symfony/Component/Console/Input/Input.php @@ -27,12 +27,12 @@ */ abstract class Input implements InputInterface, StreamableInputInterface { - protected $definition; + protected InputDefinition $definition; /** @var resource */ protected $stream; - protected $options = []; - protected $arguments = []; - protected $interactive = true; + protected array $options = []; + protected array $arguments = []; + protected bool $interactive = true; public function __construct(InputDefinition $definition = null) { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php index a2c98a86a703e..8440a59742f51 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php @@ -26,11 +26,8 @@ */ abstract class AbstractRecursivePass implements CompilerPassInterface { - /** - * @var ContainerBuilder - */ - protected $container; - protected $currentId; + protected ?ContainerBuilder $container; + protected ?string $currentId = null; protected bool $skipScalars = false; private bool $processExpressions = false; diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 15a0ba6c8e560..d4f619ed504ad 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -50,16 +50,16 @@ class_exists(ArgumentServiceLocator::class); */ class Container implements ContainerInterface, ResetInterface { - protected $parameterBag; - protected $services = []; - protected $privates = []; - protected $fileMap = []; - protected $methodMap = []; - protected $factories = []; - protected $aliases = []; - protected $loading = []; - protected $resolving = []; - protected $syntheticIds = []; + protected ParameterBagInterface $parameterBag; + protected array $services = []; + protected array $privates = []; + protected array $fileMap = []; + protected array $methodMap = []; + protected array $factories = []; + protected array $aliases = []; + protected array $loading = []; + protected array $resolving = []; + protected array $syntheticIds = []; private array $envCache = []; private bool $compiled = false; diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 34638059fe86b..dc16d5b5caf5e 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -45,7 +45,7 @@ class Definition private array $bindings = []; private array $errors = []; - protected $arguments = []; + protected array $arguments = []; /** * @internal diff --git a/src/Symfony/Component/DependencyInjection/Dumper/Dumper.php b/src/Symfony/Component/DependencyInjection/Dumper/Dumper.php index e7407b0e2a8bf..6b9068c74224f 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/Dumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/Dumper.php @@ -20,7 +20,7 @@ */ abstract class Dumper implements DumperInterface { - protected $container; + protected ContainerBuilder $container; public function __construct(ContainerBuilder $container) { diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php index 4b76e773ec042..36c15e1b454fd 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php @@ -29,7 +29,7 @@ abstract class AbstractConfigurator /** * @var \Closure(mixed, bool):mixed|null */ - public static $valuePreProcessor; + public static ?\Closure $valuePreProcessor = null; /** @internal */ protected Definition|Alias|null $definition = null; diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractServiceConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractServiceConfigurator.php index abf88ff255255..fcb37fc287fd5 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractServiceConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractServiceConfigurator.php @@ -16,8 +16,8 @@ abstract class AbstractServiceConfigurator extends AbstractConfigurator { - protected $parent; - protected $id; + protected ServicesConfigurator $parent; + protected ?string $id; private array $defaultTags = []; public function __construct(ServicesConfigurator $parent, Definition $definition, string $id = null, array $defaultTags = []) diff --git a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php index 330fd7d2fe183..185fb33d9f77b 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php @@ -37,14 +37,14 @@ abstract class FileLoader extends BaseFileLoader { public const ANONYMOUS_ID_REGEXP = '/^\.\d+_[^~]*+~[._a-zA-Z\d]{7}$/'; - protected $container; - protected $isLoadingInstanceof = false; - protected $instanceof = []; - protected $interfaces = []; - protected $singlyImplemented = []; + protected ContainerBuilder $container; + protected bool $isLoadingInstanceof = false; + protected array $instanceof = []; + protected array $interfaces = []; + protected array $singlyImplemented = []; /** @var array */ - protected $aliases = []; - protected $autoRegisterAliasesForSinglyImplementedInterfaces = true; + protected array $aliases = []; + protected bool $autoRegisterAliasesForSinglyImplementedInterfaces = true; public function __construct(ContainerBuilder $container, FileLocatorInterface $locator, string $env = null) { diff --git a/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php index e56fb51560932..13021f2f00a2e 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php @@ -33,7 +33,7 @@ */ class PhpFileLoader extends FileLoader { - protected $autoRegisterAliasesForSinglyImplementedInterfaces = false; + protected bool $autoRegisterAliasesForSinglyImplementedInterfaces = false; private ?ConfigBuilderGeneratorInterface $generator; public function __construct(ContainerBuilder $container, FileLocatorInterface $locator, string $env = null, ConfigBuilderGeneratorInterface $generator = null) diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 8203b75c46540..d26833828e147 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -39,7 +39,7 @@ class XmlFileLoader extends FileLoader { public const NS = 'http://symfony.com/schema/dic/services'; - protected $autoRegisterAliasesForSinglyImplementedInterfaces = false; + protected bool $autoRegisterAliasesForSinglyImplementedInterfaces = false; public function load(mixed $resource, string $type = null): mixed { diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index c7c18998f39a2..576cd586031da 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -110,12 +110,12 @@ class YamlFileLoader extends FileLoader 'bind' => 'bind', ]; - private YamlParser $yamlParser; + protected bool $autoRegisterAliasesForSinglyImplementedInterfaces = false; + private YamlParser $yamlParser; private int $anonymousServicesCount; private string $anonymousServicesSuffix; - protected $autoRegisterAliasesForSinglyImplementedInterfaces = false; public function load(mixed $resource, string $type = null): mixed { diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php index b301268e322fe..d0a12a95259df 100644 --- a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php +++ b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php @@ -23,8 +23,8 @@ */ class ParameterBag implements ParameterBagInterface { - protected $parameters = []; - protected $resolved = false; + protected array $parameters = []; + protected bool $resolved = false; protected array $deprecatedParameters = []; public function __construct(array $parameters = []) diff --git a/src/Symfony/Component/DomCrawler/AbstractUriElement.php b/src/Symfony/Component/DomCrawler/AbstractUriElement.php index c0b76ca9c2698..9a3712bb2da5f 100644 --- a/src/Symfony/Component/DomCrawler/AbstractUriElement.php +++ b/src/Symfony/Component/DomCrawler/AbstractUriElement.php @@ -18,20 +18,9 @@ */ abstract class AbstractUriElement { - /** - * @var \DOMElement - */ - protected $node; - - /** - * @var string|null The method to use for the element - */ - protected $method; - - /** - * @var string The URI of the page where the element is embedded (or the base href) - */ - protected $currentUri; + protected \DOMElement $node; + protected ?string $method; + protected ?string $currentUri; /** * @param \DOMElement $node A \DOMElement instance diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 15773f4483184..be56712a30d91 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -23,10 +23,7 @@ */ class Crawler implements \Countable, \IteratorAggregate { - /** - * @var string|null - */ - protected $uri; + protected ?string $uri; /** * The default namespace prefix to be used with XPath and CSS expressions. diff --git a/src/Symfony/Component/DomCrawler/Field/FormField.php b/src/Symfony/Component/DomCrawler/Field/FormField.php index 54fe3bbea67ee..f364d52c6a626 100644 --- a/src/Symfony/Component/DomCrawler/Field/FormField.php +++ b/src/Symfony/Component/DomCrawler/Field/FormField.php @@ -18,30 +18,12 @@ */ abstract class FormField { - /** - * @var \DOMElement - */ - protected $node; - /** - * @var string - */ - protected $name; - /** - * @var string - */ - protected $value; - /** - * @var \DOMDocument - */ - protected $document; - /** - * @var \DOMXPath - */ - protected $xpath; - /** - * @var bool - */ - protected $disabled; + protected \DOMElement $node; + protected string $name; + protected string|array|null $value = null; + protected \DOMDocument $document; + protected \DOMXPath $xpath; + protected bool $disabled = false; /** * @param \DOMElement $node The node associated with this field diff --git a/src/Symfony/Component/ErrorHandler/Exception/SilencedErrorContext.php b/src/Symfony/Component/ErrorHandler/Exception/SilencedErrorContext.php index ac19e6391ad91..a3190da16703e 100644 --- a/src/Symfony/Component/ErrorHandler/Exception/SilencedErrorContext.php +++ b/src/Symfony/Component/ErrorHandler/Exception/SilencedErrorContext.php @@ -18,7 +18,7 @@ */ class SilencedErrorContext implements \JsonSerializable { - public $count = 1; + public int $count = 1; private int $severity; private string $file; diff --git a/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php b/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php index 52e844b92f2d0..1163e070f6667 100644 --- a/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php +++ b/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php @@ -30,8 +30,8 @@ */ class TraceableEventDispatcher implements EventDispatcherInterface, ResetInterface { - protected $logger; - protected $stopwatch; + protected ?LoggerInterface $logger; + protected Stopwatch $stopwatch; /** * @var \SplObjectStorage|null diff --git a/src/Symfony/Component/EventDispatcher/GenericEvent.php b/src/Symfony/Component/EventDispatcher/GenericEvent.php index 68a20306334c3..b14faa5fc9d4f 100644 --- a/src/Symfony/Component/EventDispatcher/GenericEvent.php +++ b/src/Symfony/Component/EventDispatcher/GenericEvent.php @@ -25,8 +25,8 @@ */ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate { - protected $subject; - protected $arguments; + protected mixed $subject; + protected array $arguments; /** * Encapsulate an event with $subject and $args. diff --git a/src/Symfony/Component/ExpressionLanguage/Expression.php b/src/Symfony/Component/ExpressionLanguage/Expression.php index 3cab1dfe6cd08..8bfa1ecdc880c 100644 --- a/src/Symfony/Component/ExpressionLanguage/Expression.php +++ b/src/Symfony/Component/ExpressionLanguage/Expression.php @@ -18,7 +18,7 @@ */ class Expression { - protected $expression; + protected string $expression; public function __construct(string $expression) { diff --git a/src/Symfony/Component/ExpressionLanguage/Node/Node.php b/src/Symfony/Component/ExpressionLanguage/Node/Node.php index 77254e17fec77..4ba5e5c86335c 100644 --- a/src/Symfony/Component/ExpressionLanguage/Node/Node.php +++ b/src/Symfony/Component/ExpressionLanguage/Node/Node.php @@ -20,8 +20,8 @@ */ class Node { - public $nodes = []; - public $attributes = []; + public array $nodes = []; + public array $attributes = []; /** * @param array $nodes An array of nodes diff --git a/src/Symfony/Component/ExpressionLanguage/Token.php b/src/Symfony/Component/ExpressionLanguage/Token.php index 6eff31e9bc77f..b15667b3b17b1 100644 --- a/src/Symfony/Component/ExpressionLanguage/Token.php +++ b/src/Symfony/Component/ExpressionLanguage/Token.php @@ -18,9 +18,9 @@ */ class Token { - public $value; - public $type; - public $cursor; + public string $type; + public string|int|float|null $value; + public ?int $cursor; public const EOF_TYPE = 'end of expression'; public const NAME_TYPE = 'name'; diff --git a/src/Symfony/Component/ExpressionLanguage/TokenStream.php b/src/Symfony/Component/ExpressionLanguage/TokenStream.php index ab04de437b1d2..da9e3aceca9d9 100644 --- a/src/Symfony/Component/ExpressionLanguage/TokenStream.php +++ b/src/Symfony/Component/ExpressionLanguage/TokenStream.php @@ -18,7 +18,7 @@ */ class TokenStream { - public $current; + public Token $current; private array $tokens; private int $position = 0; diff --git a/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php b/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php index f4d2a7ff0e463..3450c49d438e2 100644 --- a/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php +++ b/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php @@ -23,8 +23,8 @@ */ abstract class MultiplePcreFilterIterator extends \FilterIterator { - protected $matchRegexps = []; - protected $noMatchRegexps = []; + protected array $matchRegexps = []; + protected array $noMatchRegexps = []; /** * @param \Iterator $iterator The Iterator to filter diff --git a/src/Symfony/Component/Form/AbstractRendererEngine.php b/src/Symfony/Component/Form/AbstractRendererEngine.php index cd7215025a1ee..bccdf69cc5922 100644 --- a/src/Symfony/Component/Form/AbstractRendererEngine.php +++ b/src/Symfony/Component/Form/AbstractRendererEngine.php @@ -25,25 +25,22 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface, Re */ public const CACHE_KEY_VAR = 'cache_key'; - /** - * @var array - */ - protected $defaultThemes; + protected array $defaultThemes; /** * @var array[] */ - protected $themes = []; + protected array $themes = []; /** * @var bool[] */ - protected $useDefaultThemes = []; + protected array $useDefaultThemes = []; /** * @var array[] */ - protected $resources = []; + protected array $resources = []; /** * @var array> diff --git a/src/Symfony/Component/Form/ButtonBuilder.php b/src/Symfony/Component/Form/ButtonBuilder.php index f9a6142dbf68d..e640149bb86e7 100644 --- a/src/Symfony/Component/Form/ButtonBuilder.php +++ b/src/Symfony/Component/Form/ButtonBuilder.php @@ -25,7 +25,7 @@ */ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface { - protected $locked = false; + protected bool $locked = false; private bool $disabled = false; private ResolvedFormTypeInterface $type; diff --git a/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php b/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php index 4ac7e55fba2a6..5f0d7dc36e2bc 100644 --- a/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php +++ b/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php @@ -24,27 +24,18 @@ */ class ArrayChoiceList implements ChoiceListInterface { - /** - * The choices in the list. - * - * @var array - */ - protected $choices; + protected array $choices; /** * The values indexed by the original keys. - * - * @var array */ - protected $structuredValues; + protected array $structuredValues; /** * The original keys of the choices array. - * - * @var int[]|string[] */ - protected $originalKeys; - protected $valueCallback; + protected array $originalKeys; + protected ?\Closure $valueCallback = null; /** * Creates a list with the given choices and values. diff --git a/src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php b/src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php index 64fe3baec3829..562515012c423 100644 --- a/src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php +++ b/src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php @@ -20,8 +20,8 @@ */ class ChoiceGroupView implements \IteratorAggregate { - public $label; - public $choices; + public string $label; + public array $choices; /** * Creates a new choice group view. diff --git a/src/Symfony/Component/Form/ChoiceList/View/ChoiceListView.php b/src/Symfony/Component/Form/ChoiceList/View/ChoiceListView.php index 949174e3a7deb..15afc4a8a5f6d 100644 --- a/src/Symfony/Component/Form/ChoiceList/View/ChoiceListView.php +++ b/src/Symfony/Component/Form/ChoiceList/View/ChoiceListView.php @@ -22,8 +22,8 @@ */ class ChoiceListView { - public $choices; - public $preferredChoices; + public array $choices; + public array $preferredChoices; /** * Creates a new choice list view. diff --git a/src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php b/src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php index 050d8ed243fda..52587fd363b2b 100644 --- a/src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php +++ b/src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php @@ -20,19 +20,19 @@ */ class ChoiceView { - public $label; - public $value; - public $data; + public string|TranslatableInterface|false $label; + public string $value; + public mixed $data; /** * Additional attributes for the HTML tag. */ - public $attr; + public array $attr; /** * Additional parameters used to translate the label. */ - public $labelTranslationParameters; + public array $labelTranslationParameters; /** * Creates a new choice view. diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php index c12a6de216667..d2a897471495b 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php @@ -21,7 +21,7 @@ */ abstract class BaseDateTimeTransformer implements DataTransformerInterface { - protected static $formats = [ + protected static array $formats = [ \IntlDateFormatter::NONE, \IntlDateFormatter::FULL, \IntlDateFormatter::LONG, @@ -29,9 +29,8 @@ abstract class BaseDateTimeTransformer implements DataTransformerInterface \IntlDateFormatter::SHORT, ]; - protected $inputTimezone; - - protected $outputTimezone; + protected string $inputTimezone; + protected string $outputTimezone; /** * @param string|null $inputTimezone The name of the input timezone diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php index 41b93e56a70c0..ec5def469520a 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php @@ -21,7 +21,7 @@ */ class DataTransformerChain implements DataTransformerInterface { - protected $transformers; + protected array $transformers; /** * Uses the given value transformers to transform values. diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php index 5ab33b4c945a1..911246782df98 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php @@ -25,9 +25,8 @@ */ class NumberToLocalizedStringTransformer implements DataTransformerInterface { - protected $grouping; - - protected $roundingMode; + protected bool $grouping; + protected int $roundingMode; private ?int $scale; private ?string $locale; diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php index 7bea4d227c0ae..0915021d3bab9 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php @@ -28,7 +28,7 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface public const FRACTIONAL = 'fractional'; public const INTEGER = 'integer'; - protected static $types = [ + protected static array $types = [ self::FRACTIONAL, self::INTEGER, ]; diff --git a/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php b/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php index f5901f1ed973e..482007d53b943 100644 --- a/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php +++ b/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php @@ -24,11 +24,11 @@ */ class ResizeFormListener implements EventSubscriberInterface { - protected $type; - protected $options; - protected $prototypeOptions; - protected $allowAdd; - protected $allowDelete; + protected string $type; + protected array $options; + protected array $prototypeOptions; + protected bool $allowAdd; + protected bool $allowDelete; private \Closure|bool $deleteEmpty; diff --git a/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php b/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php index 837d9ade42615..c82911a2163bb 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php @@ -22,7 +22,7 @@ class MoneyType extends AbstractType { - protected static $patterns = []; + protected static array $patterns = []; public function buildForm(FormBuilderInterface $builder, array $options): void { diff --git a/src/Symfony/Component/Form/FormConfigBuilder.php b/src/Symfony/Component/Form/FormConfigBuilder.php index ef10087b80971..49aa89ab048e1 100644 --- a/src/Symfony/Component/Form/FormConfigBuilder.php +++ b/src/Symfony/Component/Form/FormConfigBuilder.php @@ -26,14 +26,13 @@ */ class FormConfigBuilder implements FormConfigBuilderInterface { + protected bool $locked = false; + /** * Caches a globally unique {@link NativeRequestHandler} instance. */ private static NativeRequestHandler $nativeRequestHandler; - /** @var bool */ - protected $locked = false; - private EventDispatcherInterface $dispatcher; private string $name; private ?PropertyPathInterface $propertyPath = null; diff --git a/src/Symfony/Component/Form/FormError.php b/src/Symfony/Component/Form/FormError.php index 632d839ea221d..face43bcef850 100644 --- a/src/Symfony/Component/Form/FormError.php +++ b/src/Symfony/Component/Form/FormError.php @@ -20,9 +20,9 @@ */ class FormError { - protected $messageTemplate; - protected $messageParameters; - protected $messagePluralization; + protected string $messageTemplate; + protected array $messageParameters; + protected ?int $messagePluralization; private string $message; private mixed $cause; diff --git a/src/Symfony/Component/Form/FormEvent.php b/src/Symfony/Component/Form/FormEvent.php index cedf2ea2e72b0..e46fbb6a6aca3 100644 --- a/src/Symfony/Component/Form/FormEvent.php +++ b/src/Symfony/Component/Form/FormEvent.php @@ -18,8 +18,9 @@ */ class FormEvent extends Event { + protected mixed $data; + private FormInterface $form; - protected $data; public function __construct(FormInterface $form, mixed $data) { diff --git a/src/Symfony/Component/Form/FormView.php b/src/Symfony/Component/Form/FormView.php index 746d1d2ee4d06..e9e9e9957b3e4 100644 --- a/src/Symfony/Component/Form/FormView.php +++ b/src/Symfony/Component/Form/FormView.php @@ -24,7 +24,7 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable /** * The variables assigned to this view. */ - public $vars = [ + public array $vars = [ 'value' => null, 'attr' => [], ]; @@ -32,14 +32,14 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable /** * The parent view. */ - public $parent; + public ?self $parent = null; /** * The child views. * * @var array */ - public $children = []; + public array $children = []; /** * Is the form attached to this renderer rendered? diff --git a/src/Symfony/Component/Form/ReversedTransformer.php b/src/Symfony/Component/Form/ReversedTransformer.php index 8572672369a6e..b68387908081c 100644 --- a/src/Symfony/Component/Form/ReversedTransformer.php +++ b/src/Symfony/Component/Form/ReversedTransformer.php @@ -21,7 +21,7 @@ */ class ReversedTransformer implements DataTransformerInterface { - protected $reversedTransformer; + protected DataTransformerInterface $reversedTransformer; public function __construct(DataTransformerInterface $reversedTransformer) { diff --git a/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php b/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php index 16894bea0c84c..f398d3e72cbde 100644 --- a/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php +++ b/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php @@ -25,10 +25,7 @@ abstract class FormPerformanceTestCase extends FormIntegrationTestCase { use VersionAwareTest; - /** - * @var int - */ - protected $maxRunningTime = 0; + protected int $maxRunningTime = 0; protected function runTest() { diff --git a/src/Symfony/Component/Form/Test/Traits/ValidatorExtensionTrait.php b/src/Symfony/Component/Form/Test/Traits/ValidatorExtensionTrait.php index 721371996996b..0b2c1e90da54d 100644 --- a/src/Symfony/Component/Form/Test/Traits/ValidatorExtensionTrait.php +++ b/src/Symfony/Component/Form/Test/Traits/ValidatorExtensionTrait.php @@ -19,10 +19,7 @@ trait ValidatorExtensionTrait { - /** - * @var ValidatorInterface|null - */ - protected $validator; + protected ValidatorInterface $validator; protected function getValidatorExtension(): ValidatorExtension { diff --git a/src/Symfony/Component/Form/Test/TypeTestCase.php b/src/Symfony/Component/Form/Test/TypeTestCase.php index ac8eb9baa47ec..5d4c2ba9c6228 100644 --- a/src/Symfony/Component/Form/Test/TypeTestCase.php +++ b/src/Symfony/Component/Form/Test/TypeTestCase.php @@ -17,15 +17,8 @@ abstract class TypeTestCase extends FormIntegrationTestCase { - /** - * @var FormBuilder - */ - protected $builder; - - /** - * @var EventDispatcherInterface - */ - protected $dispatcher; + protected FormBuilder $builder; + protected EventDispatcherInterface $dispatcher; protected function setUp(): void { diff --git a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php index 7822259852964..20da6a427ec65 100644 --- a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php +++ b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php @@ -25,16 +25,13 @@ */ class BinaryFileResponse extends Response { - protected static $trustXSendfileTypeHeader = false; + protected static bool $trustXSendfileTypeHeader = false; - /** - * @var File - */ - protected $file; - protected $offset = 0; - protected $maxlen = -1; - protected $deleteFileAfterSend = false; - protected $chunkSize = 16 * 1024; + protected File $file; + protected int $offset = 0; + protected int $maxlen = -1; + protected bool $deleteFileAfterSend = false; + protected int $chunkSize = 16 * 1024; /** * @param \SplFileInfo|string $file The file to stream diff --git a/src/Symfony/Component/HttpFoundation/Cookie.php b/src/Symfony/Component/HttpFoundation/Cookie.php index 9f43cc2aedd19..28c5780f0009e 100644 --- a/src/Symfony/Component/HttpFoundation/Cookie.php +++ b/src/Symfony/Component/HttpFoundation/Cookie.php @@ -22,13 +22,13 @@ class Cookie public const SAMESITE_LAX = 'lax'; public const SAMESITE_STRICT = 'strict'; - protected $name; - protected $value; - protected $domain; - protected $expire; - protected $path; - protected $secure; - protected $httpOnly; + protected string $name; + protected ?string $value; + protected ?string $domain; + protected int $expire; + protected string $path; + protected ?bool $secure; + protected bool $httpOnly; private bool $raw; private ?string $sameSite = null; diff --git a/src/Symfony/Component/HttpFoundation/HeaderBag.php b/src/Symfony/Component/HttpFoundation/HeaderBag.php index c5117ebcc3cf0..ff242c6c8c313 100644 --- a/src/Symfony/Component/HttpFoundation/HeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/HeaderBag.php @@ -26,8 +26,8 @@ class HeaderBag implements \IteratorAggregate, \Countable /** * @var array> */ - protected $headers = []; - protected $cacheControl = []; + protected array $headers = []; + protected array $cacheControl = []; public function __construct(array $headers = []) { diff --git a/src/Symfony/Component/HttpFoundation/JsonResponse.php b/src/Symfony/Component/HttpFoundation/JsonResponse.php index 62278b657ad9b..4571d22c7d313 100644 --- a/src/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/src/Symfony/Component/HttpFoundation/JsonResponse.php @@ -24,14 +24,14 @@ */ class JsonResponse extends Response { - protected $data; - protected $callback; + protected mixed $data; + protected ?string $callback = null; // Encode <, >, ', &, and " characters in the JSON, making it also safe to be embedded into HTML. // 15 === JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT public const DEFAULT_ENCODING_OPTIONS = 15; - protected $encodingOptions = self::DEFAULT_ENCODING_OPTIONS; + protected int $encodingOptions = self::DEFAULT_ENCODING_OPTIONS; /** * @param bool $json If the data is already a JSON string diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php index 9841ee402d02e..5ac610a75243e 100644 --- a/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -22,10 +22,7 @@ */ class ParameterBag implements \IteratorAggregate, \Countable { - /** - * Parameter storage. - */ - protected $parameters; + protected array $parameters; public function __construct(array $parameters = []) { diff --git a/src/Symfony/Component/HttpFoundation/RedirectResponse.php b/src/Symfony/Component/HttpFoundation/RedirectResponse.php index a001df81dab67..abb0c4c1b766c 100644 --- a/src/Symfony/Component/HttpFoundation/RedirectResponse.php +++ b/src/Symfony/Component/HttpFoundation/RedirectResponse.php @@ -18,7 +18,7 @@ */ class RedirectResponse extends Response { - protected $targetUrl; + protected string $targetUrl; /** * Creates a redirect response so that it conforms to the rules defined for a redirect status code. diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index da00224ee8c75..558809b732fbe 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -65,70 +65,56 @@ class Request /** * @var string[] */ - protected static $trustedProxies = []; + protected static array $trustedProxies = []; /** * @var string[] */ - protected static $trustedHostPatterns = []; + protected static array $trustedHostPatterns = []; /** * @var string[] */ - protected static $trustedHosts = []; + protected static array $trustedHosts = []; - protected static $httpMethodParameterOverride = false; + protected static bool $httpMethodParameterOverride = false; /** * Custom parameters. - * - * @var ParameterBag */ - public $attributes; + public ParameterBag $attributes; /** * Request body parameters ($_POST). * * @see getPayload() for portability between content types - * - * @var InputBag */ - public $request; + public InputBag $request; /** * Query string parameters ($_GET). - * - * @var InputBag */ - public $query; + public InputBag $query; /** * Server and execution environment parameters ($_SERVER). - * - * @var ServerBag */ - public $server; + public ServerBag $server; /** * Uploaded files ($_FILES). - * - * @var FileBag */ - public $files; + public FileBag $files; /** * Cookies ($_COOKIE). - * - * @var InputBag */ - public $cookies; + public InputBag $cookies; /** * Headers (taken from the $_SERVER). - * - * @var HeaderBag */ - public $headers; + public HeaderBag $headers; /** * @var string|resource|false|null @@ -138,76 +124,41 @@ class Request /** * @var string[] */ - protected $languages; + protected array $languages; /** * @var string[] */ - protected $charsets; + protected array $charsets; /** * @var string[] */ - protected $encodings; + protected array $encodings; /** * @var string[] */ - protected $acceptableContentTypes; + protected array $acceptableContentTypes; - /** - * @var string - */ - protected $pathInfo; - - /** - * @var string - */ - protected $requestUri; - - /** - * @var string - */ - protected $baseUrl; - - /** - * @var string - */ - protected $basePath; - - /** - * @var string - */ - protected $method; - - /** - * @var string - */ - protected $format; - - /** - * @var SessionInterface|callable(): SessionInterface - */ - protected $session; - - /** - * @var string|null - */ - protected $locale; - - /** - * @var string - */ - protected $defaultLocale = 'en'; + protected string $pathInfo; + protected string $requestUri; + protected string $baseUrl; + protected string $basePath; + protected string $method; + protected ?string $format; + protected SessionInterface|\Closure|null $session = null; + protected ?string $locale = null; + protected string $defaultLocale = 'en'; /** * @var array */ - protected static $formats; + protected static array $formats; - protected static $requestFactory; + protected static ?\Closure $requestFactory = null; - private ?string $preferredFormat = null; + private string $preferredFormat; private bool $isHostValid = true; private bool $isForwardedValid = true; private bool $isSafeContentPreferred; diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 6a751be4867bd..48c6c881e5513 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -105,35 +105,13 @@ class Response 'etag' => true, ]; - /** - * @var ResponseHeaderBag - */ - public $headers; + public ResponseHeaderBag $headers; - /** - * @var string - */ - protected $content; - - /** - * @var string - */ - protected $version; - - /** - * @var int - */ - protected $statusCode; - - /** - * @var string - */ - protected $statusText; - - /** - * @var string - */ - protected $charset; + protected string $content; + protected string $version; + protected int $statusCode; + protected string $statusText; + protected ?string $charset = null; /** * Status codes translation table. @@ -143,10 +121,8 @@ class Response * (last updated 2021-10-01). * * Unless otherwise noted, the status code is defined in RFC2616. - * - * @var array */ - public static $statusTexts = [ + public static array $statusTexts = [ 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', // RFC2518 diff --git a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php index 0dd87e4a1d75b..2b5f6712837cf 100644 --- a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php @@ -24,9 +24,9 @@ class ResponseHeaderBag extends HeaderBag public const DISPOSITION_ATTACHMENT = 'attachment'; public const DISPOSITION_INLINE = 'inline'; - protected $computedCacheControl = []; - protected $cookies = []; - protected $headerNames = []; + protected array $computedCacheControl = []; + protected array $cookies = []; + protected array $headerNames = []; public function __construct(array $headers = []) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php b/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php index 2e6e4054a0157..042f3bd90f451 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php @@ -18,11 +18,11 @@ */ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Countable { + protected array $attributes = []; + private string $name = 'attributes'; private string $storageKey; - protected $attributes = []; - /** * @param string $storageKey The key used to store attributes in the session */ diff --git a/src/Symfony/Component/HttpFoundation/Session/Session.php b/src/Symfony/Component/HttpFoundation/Session/Session.php index 929ea2129a103..f212b52e49662 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Session.php +++ b/src/Symfony/Component/HttpFoundation/Session/Session.php @@ -32,7 +32,7 @@ class_exists(SessionBagProxy::class); */ class Session implements FlashBagAwareSessionInterface, \IteratorAggregate, \Countable { - protected $storage; + protected SessionStorageInterface $storage; private string $flashName; private string $attributeName; diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php b/src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php index 6bea3207a5932..9bcaafc4e7def 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php @@ -26,19 +26,11 @@ class MetadataBag implements SessionBagInterface public const UPDATED = 'u'; public const LIFETIME = 'l'; + protected array $meta = [self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0]; + private string $name = '__metadata'; private string $storageKey; - - /** - * @var array - */ - protected $meta = [self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0]; - - /** - * Unix timestamp. - */ private int $lastUsed; - private int $updateThreshold; /** diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php index 34693c89d8d29..49b5ee5878c7f 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php @@ -27,40 +27,17 @@ */ class MockArraySessionStorage implements SessionStorageInterface { - /** - * @var string - */ - protected $id = ''; - - /** - * @var string - */ - protected $name; - - /** - * @var bool - */ - protected $started = false; - - /** - * @var bool - */ - protected $closed = false; - - /** - * @var array - */ - protected $data = []; - - /** - * @var MetadataBag - */ - protected $metadataBag; + protected string $id = ''; + protected string $name; + protected bool $started = false; + protected bool $closed = false; + protected array $data = []; + protected MetadataBag $metadataBag; /** - * @var array|SessionBagInterface[] + * @var SessionBagInterface[] */ - protected $bags = []; + protected array $bags = []; public function __construct(string $name = 'MOCKSESSID', MetadataBag $metaBag = null) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index f0dc750b568f3..4f6a9ba0d0482 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -31,27 +31,11 @@ class NativeSessionStorage implements SessionStorageInterface /** * @var SessionBagInterface[] */ - protected $bags = []; - - /** - * @var bool - */ - protected $started = false; - - /** - * @var bool - */ - protected $closed = false; - - /** - * @var AbstractProxy|\SessionHandlerInterface - */ - protected $saveHandler; - - /** - * @var MetadataBag - */ - protected $metadataBag; + protected array $bags = []; + protected bool $started = false; + protected bool $closed = false; + protected AbstractProxy|\SessionHandlerInterface $saveHandler; + protected MetadataBag $metadataBag; /** * Depending on how you want the storage driver to behave you probably diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php index 3b995fa7a60d6..c3a0278f6a5f5 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php @@ -16,17 +16,9 @@ */ abstract class AbstractProxy { - /** - * Flag if handler wraps an internal PHP session handler (using \SessionHandler). - * - * @var bool - */ - protected $wrapper = false; + protected bool $wrapper = false; - /** - * @var string - */ - protected $saveHandlerName; + protected ?string $saveHandlerName = null; /** * Gets the session.save_handler name. diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php index 7bf3f9ff1e1dc..b8df97f45aa74 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php @@ -18,7 +18,7 @@ */ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface, \SessionUpdateTimestampHandlerInterface { - protected $handler; + protected \SessionHandlerInterface $handler; public function __construct(\SessionHandlerInterface $handler) { diff --git a/src/Symfony/Component/HttpFoundation/StreamedResponse.php b/src/Symfony/Component/HttpFoundation/StreamedResponse.php index 68250d95dcb1e..4ee14443f2f75 100644 --- a/src/Symfony/Component/HttpFoundation/StreamedResponse.php +++ b/src/Symfony/Component/HttpFoundation/StreamedResponse.php @@ -26,9 +26,10 @@ */ class StreamedResponse extends Response { - protected $callback; - protected $streamed; - private bool $headersSent; + protected \Closure $callback; + protected bool $streamed = false; + + private bool $headersSent = false; /** * @param int $status The HTTP status code (200 "OK" by default) diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php index 09a19c480c498..0f8f84508266c 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php @@ -24,15 +24,12 @@ */ abstract class Bundle implements BundleInterface { - protected $name; - protected $extension; - protected $path; - private string $namespace; + protected string $name; + protected ExtensionInterface|false $extension; + protected string $path; + protected ?ContainerInterface $container; - /** - * @var ContainerInterface|null - */ - protected $container; + private string $namespace; /** * @return void diff --git a/src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php b/src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php index 1c9254e732a7f..5e1531de525ee 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php @@ -23,7 +23,7 @@ */ class ContainerControllerResolver extends ControllerResolver { - protected $container; + protected ContainerInterface $container; public function __construct(ContainerInterface $container, LoggerInterface $logger = null) { diff --git a/src/Symfony/Component/HttpKernel/Controller/ControllerReference.php b/src/Symfony/Component/HttpKernel/Controller/ControllerReference.php index b4fdadd21e122..7801557372341 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ControllerReference.php +++ b/src/Symfony/Component/HttpKernel/Controller/ControllerReference.php @@ -26,9 +26,9 @@ */ class ControllerReference { - public $controller; - public $attributes = []; - public $query = []; + public string $controller; + public array $attributes = []; + public array $query = []; /** * @param string $controller The controller name diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php index aa14dfd2200b2..03d1303e8b97f 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php @@ -28,10 +28,7 @@ */ abstract class DataCollector implements DataCollectorInterface { - /** - * @var array|Data - */ - protected $data = []; + protected array|Data $data = []; private ClonerInterface $cloner; diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php index fc9ded26997a3..38c58bd86c6c9 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php @@ -24,7 +24,7 @@ class RouterDataCollector extends DataCollector /** * @var \SplObjectStorage */ - protected $controllers; + protected \SplObjectStorage $controllers; public function __construct() { diff --git a/src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php b/src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php index 62e63743bdb40..abe78ae39998a 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ErrorListener.php @@ -32,13 +32,13 @@ */ class ErrorListener implements EventSubscriberInterface { - protected $controller; - protected $logger; - protected $debug; + protected string|object|array|null $controller; + protected ?\Psr\Log\LoggerInterface $logger; + protected bool $debug; /** * @var array|null}> */ - protected $exceptionsMapping; + protected array $exceptionsMapping; /** * @param array|null}> $exceptionsMapping diff --git a/src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php b/src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php index a2b298f77b9ef..c2f2076d2bb96 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php @@ -23,7 +23,7 @@ */ abstract class AbstractSurrogate implements SurrogateInterface { - protected $contentTypes; + protected array $contentTypes; /** * @param array $contentTypes An array of content-type that should be parsed for Surrogate information diff --git a/src/Symfony/Component/HttpKernel/HttpCache/Store.php b/src/Symfony/Component/HttpKernel/HttpCache/Store.php index 2224497380b1a..b6a2e76bd59c5 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -24,7 +24,7 @@ */ class Store implements StoreInterface { - protected $root; + protected string $root; /** @var \SplObjectStorage */ private \SplObjectStorage $keyCache; /** @var array */ diff --git a/src/Symfony/Component/HttpKernel/HttpKernel.php b/src/Symfony/Component/HttpKernel/HttpKernel.php index a9fbc2f1a857d..9b4c48e31068a 100644 --- a/src/Symfony/Component/HttpKernel/HttpKernel.php +++ b/src/Symfony/Component/HttpKernel/HttpKernel.php @@ -50,9 +50,9 @@ class_exists(KernelEvents::class); */ class HttpKernel implements HttpKernelInterface, TerminableInterface { - protected $dispatcher; - protected $resolver; - protected $requestStack; + protected EventDispatcherInterface $dispatcher; + protected ControllerResolverInterface $resolver; + protected RequestStack $requestStack; private ArgumentResolverInterface $argumentResolver; private bool $handleAllThrowables; diff --git a/src/Symfony/Component/HttpKernel/HttpKernelBrowser.php b/src/Symfony/Component/HttpKernel/HttpKernelBrowser.php index cc3500bef4e4a..83761ee69860f 100644 --- a/src/Symfony/Component/HttpKernel/HttpKernelBrowser.php +++ b/src/Symfony/Component/HttpKernel/HttpKernelBrowser.php @@ -30,7 +30,7 @@ */ class HttpKernelBrowser extends AbstractBrowser { - protected $kernel; + protected HttpKernelInterface $kernel; private bool $catchExceptions = true; /** diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 18e38af31611f..1f4541e3f7723 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,13 +58,13 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl /** * @var array */ - protected $bundles = []; + protected array $bundles = []; - protected $container; - protected $environment; - protected $debug; - protected $booted = false; - protected $startTime; + protected ?ContainerInterface $container = null; + protected string $environment; + protected bool $debug; + protected bool $booted = false; + protected ?float $startTime = null; private string $projectDir; private ?string $warmupDir = null; diff --git a/src/Symfony/Component/Ldap/Adapter/AbstractConnection.php b/src/Symfony/Component/Ldap/Adapter/AbstractConnection.php index 4240a29cbbc2b..19028444d467c 100644 --- a/src/Symfony/Component/Ldap/Adapter/AbstractConnection.php +++ b/src/Symfony/Component/Ldap/Adapter/AbstractConnection.php @@ -19,7 +19,7 @@ */ abstract class AbstractConnection implements ConnectionInterface { - protected $config; + protected array $config; public function __construct(array $config = []) { diff --git a/src/Symfony/Component/Ldap/Adapter/AbstractQuery.php b/src/Symfony/Component/Ldap/Adapter/AbstractQuery.php index 56e0d91b283db..96eaf8acaa48b 100644 --- a/src/Symfony/Component/Ldap/Adapter/AbstractQuery.php +++ b/src/Symfony/Component/Ldap/Adapter/AbstractQuery.php @@ -19,10 +19,10 @@ */ abstract class AbstractQuery implements QueryInterface { - protected $connection; - protected $dn; - protected $query; - protected $options; + protected ConnectionInterface $connection; + protected string $dn; + protected string $query; + protected array $options; public function __construct(ConnectionInterface $connection, string $dn, string $query, array $options = []) { diff --git a/src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesHttpAsyncAwsTransport.php b/src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesHttpAsyncAwsTransport.php index 6efcbc874e156..66a3d9966b5a1 100644 --- a/src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesHttpAsyncAwsTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesHttpAsyncAwsTransport.php @@ -28,8 +28,7 @@ */ class SesHttpAsyncAwsTransport extends AbstractTransport { - /** @var SesClient */ - protected $sesClient; + protected SesClient $sesClient; public function __construct(SesClient $sesClient, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null) { diff --git a/src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php b/src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php index 7bcd8989877a5..c6bd432ab4361 100644 --- a/src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php +++ b/src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php @@ -31,9 +31,9 @@ abstract class TransportFactoryTestCase extends TestCase protected const USER = 'u$er'; protected const PASSWORD = 'pa$s'; - protected $dispatcher; - protected $client; - protected $logger; + protected EventDispatcherInterface $dispatcher; + protected HttpClientInterface $client; + protected LoggerInterface $logger; abstract public function getFactory(): TransportFactoryInterface; diff --git a/src/Symfony/Component/Mailer/Transport/AbstractHttpTransport.php b/src/Symfony/Component/Mailer/Transport/AbstractHttpTransport.php index b3fb5a2a0622b..bd868233cdbdb 100644 --- a/src/Symfony/Component/Mailer/Transport/AbstractHttpTransport.php +++ b/src/Symfony/Component/Mailer/Transport/AbstractHttpTransport.php @@ -24,9 +24,9 @@ */ abstract class AbstractHttpTransport extends AbstractTransport { - protected $host; - protected $port; - protected $client; + protected ?string $host = null; + protected ?int $port = null; + protected ?HttpClientInterface $client; public function __construct(HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null) { diff --git a/src/Symfony/Component/Mailer/Transport/AbstractTransportFactory.php b/src/Symfony/Component/Mailer/Transport/AbstractTransportFactory.php index 0d021ed8e0151..7690c5f7e08ac 100644 --- a/src/Symfony/Component/Mailer/Transport/AbstractTransportFactory.php +++ b/src/Symfony/Component/Mailer/Transport/AbstractTransportFactory.php @@ -21,9 +21,9 @@ */ abstract class AbstractTransportFactory implements TransportFactoryInterface { - protected $dispatcher; - protected $client; - protected $logger; + protected ?EventDispatcherInterface $dispatcher; + protected ?HttpClientInterface $client; + protected ?LoggerInterface $logger; public function __construct(EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null) { diff --git a/src/Symfony/Component/Notifier/Bridge/Discord/Embeds/AbstractDiscordEmbed.php b/src/Symfony/Component/Notifier/Bridge/Discord/Embeds/AbstractDiscordEmbed.php index 57ef5a9c9ade0..f2b4616b72479 100644 --- a/src/Symfony/Component/Notifier/Bridge/Discord/Embeds/AbstractDiscordEmbed.php +++ b/src/Symfony/Component/Notifier/Bridge/Discord/Embeds/AbstractDiscordEmbed.php @@ -16,7 +16,7 @@ */ abstract class AbstractDiscordEmbed implements DiscordEmbedInterface { - protected $options = []; + protected array $options = []; public function toArray(): array { diff --git a/src/Symfony/Component/Notifier/Bridge/Discord/Embeds/AbstractDiscordEmbedObject.php b/src/Symfony/Component/Notifier/Bridge/Discord/Embeds/AbstractDiscordEmbedObject.php index 6fa50370380e7..430941eed1b1a 100644 --- a/src/Symfony/Component/Notifier/Bridge/Discord/Embeds/AbstractDiscordEmbedObject.php +++ b/src/Symfony/Component/Notifier/Bridge/Discord/Embeds/AbstractDiscordEmbedObject.php @@ -16,7 +16,7 @@ */ abstract class AbstractDiscordEmbedObject implements DiscordEmbedObjectInterface { - protected $options = []; + protected array $options = []; public function toArray(): array { diff --git a/src/Symfony/Component/Notifier/Bridge/Engagespot/EngagespotOptions.php b/src/Symfony/Component/Notifier/Bridge/Engagespot/EngagespotOptions.php index 54137d5651666..9e1d568fd887f 100644 --- a/src/Symfony/Component/Notifier/Bridge/Engagespot/EngagespotOptions.php +++ b/src/Symfony/Component/Notifier/Bridge/Engagespot/EngagespotOptions.php @@ -20,7 +20,7 @@ */ final class EngagespotOptions implements MessageOptionsInterface { - protected $options; + protected array $options; public function __construct(array $options = []) { diff --git a/src/Symfony/Component/Notifier/Bridge/Firebase/FirebaseOptions.php b/src/Symfony/Component/Notifier/Bridge/Firebase/FirebaseOptions.php index b37c2b8847a62..728a85a387a5e 100644 --- a/src/Symfony/Component/Notifier/Bridge/Firebase/FirebaseOptions.php +++ b/src/Symfony/Component/Notifier/Bridge/Firebase/FirebaseOptions.php @@ -25,7 +25,7 @@ abstract class FirebaseOptions implements MessageOptionsInterface /** * @see https://firebase.google.com/docs/cloud-messaging/xmpp-server-ref.html#notification-payload-support */ - protected $options; + protected array $options; private array $data; diff --git a/src/Symfony/Component/Notifier/Bridge/LinkedIn/Share/AbstractLinkedInShare.php b/src/Symfony/Component/Notifier/Bridge/LinkedIn/Share/AbstractLinkedInShare.php index 8a02cc734df17..619dd8553ce42 100644 --- a/src/Symfony/Component/Notifier/Bridge/LinkedIn/Share/AbstractLinkedInShare.php +++ b/src/Symfony/Component/Notifier/Bridge/LinkedIn/Share/AbstractLinkedInShare.php @@ -16,7 +16,7 @@ */ abstract class AbstractLinkedInShare { - protected $options = []; + protected array $options = []; public function toArray(): array { diff --git a/src/Symfony/Component/Notifier/Bridge/Slack/Block/AbstractSlackBlock.php b/src/Symfony/Component/Notifier/Bridge/Slack/Block/AbstractSlackBlock.php index 8794162b1205d..6dfccda81cdaf 100644 --- a/src/Symfony/Component/Notifier/Bridge/Slack/Block/AbstractSlackBlock.php +++ b/src/Symfony/Component/Notifier/Bridge/Slack/Block/AbstractSlackBlock.php @@ -16,7 +16,7 @@ */ abstract class AbstractSlackBlock implements SlackBlockInterface { - protected $options = []; + protected array $options = []; public function toArray(): array { diff --git a/src/Symfony/Component/Notifier/Bridge/Slack/Block/AbstractSlackBlockElement.php b/src/Symfony/Component/Notifier/Bridge/Slack/Block/AbstractSlackBlockElement.php index 66895ce26e22d..7236ba68edd7c 100644 --- a/src/Symfony/Component/Notifier/Bridge/Slack/Block/AbstractSlackBlockElement.php +++ b/src/Symfony/Component/Notifier/Bridge/Slack/Block/AbstractSlackBlockElement.php @@ -16,7 +16,7 @@ */ abstract class AbstractSlackBlockElement implements SlackBlockElementInterface { - protected $options = []; + protected array $options = []; public function toArray(): array { diff --git a/src/Symfony/Component/Notifier/Bridge/Telegram/Reply/Markup/AbstractTelegramReplyMarkup.php b/src/Symfony/Component/Notifier/Bridge/Telegram/Reply/Markup/AbstractTelegramReplyMarkup.php index 8bf4bb0cd3db6..a19a7e7775cf0 100644 --- a/src/Symfony/Component/Notifier/Bridge/Telegram/Reply/Markup/AbstractTelegramReplyMarkup.php +++ b/src/Symfony/Component/Notifier/Bridge/Telegram/Reply/Markup/AbstractTelegramReplyMarkup.php @@ -16,7 +16,7 @@ */ abstract class AbstractTelegramReplyMarkup { - protected $options = []; + protected array $options = []; public function toArray(): array { diff --git a/src/Symfony/Component/Notifier/Bridge/Telegram/Reply/Markup/Button/AbstractKeyboardButton.php b/src/Symfony/Component/Notifier/Bridge/Telegram/Reply/Markup/Button/AbstractKeyboardButton.php index 03d05ab4f4679..6598429683313 100644 --- a/src/Symfony/Component/Notifier/Bridge/Telegram/Reply/Markup/Button/AbstractKeyboardButton.php +++ b/src/Symfony/Component/Notifier/Bridge/Telegram/Reply/Markup/Button/AbstractKeyboardButton.php @@ -16,7 +16,7 @@ */ abstract class AbstractKeyboardButton { - protected $options = []; + protected array $options = []; public function toArray(): array { diff --git a/src/Symfony/Component/Notifier/Channel/AbstractChannel.php b/src/Symfony/Component/Notifier/Channel/AbstractChannel.php index a83a51da4115c..7b8f342ee3cdb 100644 --- a/src/Symfony/Component/Notifier/Channel/AbstractChannel.php +++ b/src/Symfony/Component/Notifier/Channel/AbstractChannel.php @@ -20,8 +20,8 @@ */ abstract class AbstractChannel implements ChannelInterface { - protected $transport; - protected $bus; + protected ?TransportInterface $transport; + protected ?MessageBusInterface $bus; public function __construct(TransportInterface $transport = null, MessageBusInterface $bus = null) { diff --git a/src/Symfony/Component/Notifier/Transport/AbstractTransport.php b/src/Symfony/Component/Notifier/Transport/AbstractTransport.php index 7c73c5b3f5f7b..1338be370abdd 100644 --- a/src/Symfony/Component/Notifier/Transport/AbstractTransport.php +++ b/src/Symfony/Component/Notifier/Transport/AbstractTransport.php @@ -30,9 +30,9 @@ abstract class AbstractTransport implements TransportInterface private ?EventDispatcherInterface $dispatcher; - protected $client; - protected $host; - protected $port; + protected ?HttpClientInterface $client; + protected ?string $host = null; + protected ?int $port = null; public function __construct(HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null) { diff --git a/src/Symfony/Component/Notifier/Transport/AbstractTransportFactory.php b/src/Symfony/Component/Notifier/Transport/AbstractTransportFactory.php index 914208a10071b..a2115b8577f6d 100644 --- a/src/Symfony/Component/Notifier/Transport/AbstractTransportFactory.php +++ b/src/Symfony/Component/Notifier/Transport/AbstractTransportFactory.php @@ -21,8 +21,8 @@ */ abstract class AbstractTransportFactory implements TransportFactoryInterface { - protected $dispatcher; - protected $client; + protected ?EventDispatcherInterface $dispatcher; + protected ?HttpClientInterface $client; public function __construct(EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null) { diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 5a5cfe9fa0a24..b5705a8e0b849 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -89,7 +89,7 @@ class Process implements \IteratorAggregate * * User-defined errors must use exit codes in the 64-113 range. */ - public static $exitCodes = [ + public static array $exitCodes = [ 0 => 'OK', 1 => 'General error', 2 => 'Misuse of shell builtins', diff --git a/src/Symfony/Component/PropertyAccess/PropertyPathIterator.php b/src/Symfony/Component/PropertyAccess/PropertyPathIterator.php index 0312ba156c142..5f140e0004647 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyPathIterator.php +++ b/src/Symfony/Component/PropertyAccess/PropertyPathIterator.php @@ -21,7 +21,7 @@ */ class PropertyPathIterator extends \ArrayIterator implements PropertyPathIteratorInterface { - protected $path; + protected PropertyPathInterface $path; public function __construct(PropertyPathInterface $path) { diff --git a/src/Symfony/Component/PropertyInfo/Type.php b/src/Symfony/Component/PropertyInfo/Type.php index a6fb90abf4a1e..c50bfb33ad12a 100644 --- a/src/Symfony/Component/PropertyInfo/Type.php +++ b/src/Symfony/Component/PropertyInfo/Type.php @@ -38,7 +38,7 @@ class Type * * @var string[] */ - public static $builtinTypes = [ + public static array $builtinTypes = [ self::BUILTIN_TYPE_INT, self::BUILTIN_TYPE_FLOAT, self::BUILTIN_TYPE_STRING, @@ -58,7 +58,7 @@ class Type * * @var string[] */ - public static $builtinCollectionTypes = [ + public static array $builtinCollectionTypes = [ self::BUILTIN_TYPE_ARRAY, self::BUILTIN_TYPE_ITERABLE, ]; diff --git a/src/Symfony/Component/Routing/Exception/MethodNotAllowedException.php b/src/Symfony/Component/Routing/Exception/MethodNotAllowedException.php index 0e4381bb6d997..060a06c78c641 100644 --- a/src/Symfony/Component/Routing/Exception/MethodNotAllowedException.php +++ b/src/Symfony/Component/Routing/Exception/MethodNotAllowedException.php @@ -20,7 +20,7 @@ */ class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface { - protected $allowedMethods = []; + protected array $allowedMethods = []; /** * @param string[] $allowedMethods diff --git a/src/Symfony/Component/Routing/Generator/UrlGenerator.php b/src/Symfony/Component/Routing/Generator/UrlGenerator.php index c98512b23b0c0..7d69b5baa03eb 100644 --- a/src/Symfony/Component/Routing/Generator/UrlGenerator.php +++ b/src/Symfony/Component/Routing/Generator/UrlGenerator.php @@ -42,15 +42,10 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt '%2A' => '*', ]; - protected $routes; - protected $context; - - /** - * @var bool|null - */ - protected $strictRequirements = true; - - protected $logger; + protected RouteCollection $routes; + protected RequestContext $context; + protected ?bool $strictRequirements = true; + protected ?LoggerInterface $logger; private ?string $defaultLocale; @@ -62,7 +57,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt * "?" and "#" (would be interpreted wrongly as query and fragment identifier), * "'" and """ (are used as delimiters in HTML). */ - protected $decodedChars = [ + protected array $decodedChars = [ // the slash can be used to designate a hierarchical structure and we want allow using it with this meaning // some webservers don't allow the slash in encoded form in the path for security reasons anyway // see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index 5699824d8bc5f..4eeb6b49bb92d 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -24,7 +24,7 @@ */ class AnnotationFileLoader extends FileLoader { - protected $loader; + protected AnnotationClassLoader $loader; public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader) { diff --git a/src/Symfony/Component/Routing/Loader/Configurator/RouteConfigurator.php b/src/Symfony/Component/Routing/Loader/Configurator/RouteConfigurator.php index 9407cc8ee73fd..bb2f6c6f35246 100644 --- a/src/Symfony/Component/Routing/Loader/Configurator/RouteConfigurator.php +++ b/src/Symfony/Component/Routing/Loader/Configurator/RouteConfigurator.php @@ -22,7 +22,7 @@ class RouteConfigurator use Traits\HostTrait; use Traits\RouteTrait; - protected $parentConfigurator; + protected ?CollectionConfigurator $parentConfigurator; public function __construct(RouteCollection $collection, RouteCollection $route, string $name = '', CollectionConfigurator $parentConfigurator = null, array $prefixes = null) { diff --git a/src/Symfony/Component/Routing/Loader/Configurator/Traits/AddTrait.php b/src/Symfony/Component/Routing/Loader/Configurator/Traits/AddTrait.php index 5698df5daa5c6..5668ab052003b 100644 --- a/src/Symfony/Component/Routing/Loader/Configurator/Traits/AddTrait.php +++ b/src/Symfony/Component/Routing/Loader/Configurator/Traits/AddTrait.php @@ -23,12 +23,9 @@ trait AddTrait { use LocalizedRouteTrait; - /** - * @var RouteCollection - */ - protected $collection; - protected $name = ''; - protected $prefixes; + protected RouteCollection $collection; + protected string $name = ''; + protected ?array $prefixes = null; /** * Adds a route. diff --git a/src/Symfony/Component/Routing/Loader/Configurator/Traits/RouteTrait.php b/src/Symfony/Component/Routing/Loader/Configurator/Traits/RouteTrait.php index 16dc43d0a3608..0e93aa6cff885 100644 --- a/src/Symfony/Component/Routing/Loader/Configurator/Traits/RouteTrait.php +++ b/src/Symfony/Component/Routing/Loader/Configurator/Traits/RouteTrait.php @@ -16,10 +16,7 @@ trait RouteTrait { - /** - * @var RouteCollection|Route - */ - protected $route; + protected RouteCollection|Route $route; /** * Adds defaults. diff --git a/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php b/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php index cf309ba5c9c76..0f8970580a450 100644 --- a/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php +++ b/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php @@ -27,7 +27,7 @@ class TraceableUrlMatcher extends UrlMatcher public const ROUTE_ALMOST_MATCHES = 1; public const ROUTE_MATCHES = 2; - protected $traces; + protected array $traces; public function getTraces(string $pathinfo): array { diff --git a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php index b1a29c4ea952b..a341e52353b57 100644 --- a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php +++ b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php @@ -32,13 +32,12 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface public const REQUIREMENT_MISMATCH = 1; public const ROUTE_MATCH = 2; - /** @var RequestContext */ - protected $context; + protected RequestContext $context; /** * Collects HTTP methods that would be allowed for the request. */ - protected $allow = []; + protected array $allow = []; /** * Collects URI schemes that would be allowed for the request. @@ -47,14 +46,14 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface */ protected array $allowSchemes = []; - protected $routes; - protected $request; - protected $expressionLanguage; + protected RouteCollection $routes; + protected ?Request $request = null; + protected ExpressionLanguage $expressionLanguage; /** * @var ExpressionFunctionProviderInterface[] */ - protected $expressionLanguageProviders = []; + protected array $expressionLanguageProviders = []; public function __construct(RouteCollection $routes, RequestContext $context) { diff --git a/src/Symfony/Component/Routing/Router.php b/src/Symfony/Component/Routing/Router.php index bc262cfef6b16..7e6a515e0ea16 100644 --- a/src/Symfony/Component/Routing/Router.php +++ b/src/Symfony/Component/Routing/Router.php @@ -37,47 +37,15 @@ */ class Router implements RouterInterface, RequestMatcherInterface { - /** - * @var UrlMatcherInterface|null - */ - protected $matcher; - - /** - * @var UrlGeneratorInterface|null - */ - protected $generator; - - /** - * @var RequestContext - */ - protected $context; - - /** - * @var LoaderInterface - */ - protected $loader; - - /** - * @var RouteCollection|null - */ - protected $collection; - - protected $resource; - - /** - * @var array - */ - protected $options = []; - - /** - * @var LoggerInterface|null - */ - protected $logger; - - /** - * @var string|null - */ - protected $defaultLocale; + protected UrlMatcherInterface|RequestMatcherInterface $matcher; + protected UrlGeneratorInterface $generator; + protected RequestContext $context; + protected LoaderInterface $loader; + protected RouteCollection $collection; + protected mixed $resource; + protected array $options = []; + protected ?LoggerInterface $logger; + protected ?string $defaultLocale; private ConfigCacheFactoryInterface $configCacheFactory; diff --git a/src/Symfony/Component/Runtime/GenericRuntime.php b/src/Symfony/Component/Runtime/GenericRuntime.php index f1b3254ad4808..acec06586fc7b 100644 --- a/src/Symfony/Component/Runtime/GenericRuntime.php +++ b/src/Symfony/Component/Runtime/GenericRuntime.php @@ -46,7 +46,7 @@ class_exists(ClosureResolver::class); */ class GenericRuntime implements RuntimeInterface { - protected $options; + protected array $options; /** * @param array { diff --git a/src/Symfony/Component/Security/Core/Role/RoleHierarchy.php b/src/Symfony/Component/Security/Core/Role/RoleHierarchy.php index acc1c2510322e..15c5750d88c62 100644 --- a/src/Symfony/Component/Security/Core/Role/RoleHierarchy.php +++ b/src/Symfony/Component/Security/Core/Role/RoleHierarchy.php @@ -18,9 +18,10 @@ */ class RoleHierarchy implements RoleHierarchyInterface { - private array $hierarchy; /** @var array> */ - protected $map; + protected array $map; + + private array $hierarchy; /** * @param array> $hierarchy diff --git a/src/Symfony/Component/Security/Core/Validator/Constraints/UserPassword.php b/src/Symfony/Component/Security/Core/Validator/Constraints/UserPassword.php index e7b7cd26d49f7..6f4024c02c24b 100644 --- a/src/Symfony/Component/Security/Core/Validator/Constraints/UserPassword.php +++ b/src/Symfony/Component/Security/Core/Validator/Constraints/UserPassword.php @@ -22,8 +22,8 @@ class UserPassword extends Constraint self::INVALID_PASSWORD_ERROR => 'INVALID_PASSWORD_ERROR', ]; - public $message = 'This value should be the user\'s current password.'; - public $service = 'security.validator.user_password'; + public string $message = 'This value should be the user\'s current password.'; + public string $service = 'security.validator.user_password'; public function __construct(array $options = null, string $message = null, string $service = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php index 382613597054f..17adf4b305cdd 100644 --- a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php +++ b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php @@ -32,11 +32,11 @@ */ class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandlerInterface { - protected $httpKernel; - protected $httpUtils; - protected $logger; - protected $options; - protected $defaultOptions = [ + protected HttpKernelInterface $httpKernel; + protected HttpUtils $httpUtils; + protected array $options; + protected ?LoggerInterface $logger; + protected array $defaultOptions = [ 'failure_path' => null, 'failure_forward' => false, 'login_path' => '/login', diff --git a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php index 6ca9a623f582e..51f21569125c4 100644 --- a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php +++ b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php @@ -30,11 +30,11 @@ class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandle { use TargetPathTrait; - protected $httpUtils; - protected $logger; - protected $options; - protected $firewallName; - protected $defaultOptions = [ + protected HttpUtils $httpUtils; + protected array $options; + protected ?LoggerInterface $logger; + protected ?string $firewallName = null; + protected array $defaultOptions = [ 'always_use_default_target_path' => false, 'default_target_path' => '/', 'login_path' => '/login', diff --git a/src/Symfony/Component/Security/Http/Authenticator/Passport/Passport.php b/src/Symfony/Component/Security/Http/Authenticator/Passport/Passport.php index b0fb4828afc55..17f204d51b324 100644 --- a/src/Symfony/Component/Security/Http/Authenticator/Passport/Passport.php +++ b/src/Symfony/Component/Security/Http/Authenticator/Passport/Passport.php @@ -27,7 +27,7 @@ */ class Passport { - protected $user; + protected UserInterface $user; private array $badges = []; private array $attributes = []; diff --git a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeHandler.php b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeHandler.php index 24843e244e81d..ea0f9a41b9d7d 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeHandler.php +++ b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeHandler.php @@ -23,10 +23,11 @@ */ abstract class AbstractRememberMeHandler implements RememberMeHandlerInterface { + protected RequestStack $requestStack; + protected array $options; + protected ?LoggerInterface $logger; + private UserProviderInterface $userProvider; - protected $requestStack; - protected $options; - protected $logger; public function __construct(UserProviderInterface $userProvider, RequestStack $requestStack, array $options = [], LoggerInterface $logger = null) { diff --git a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php index a9ca028451826..1be381c18b6ab 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php @@ -20,11 +20,6 @@ */ class JsonDecode implements DecoderInterface { - /** - * @deprecated since Symfony 6.4, to be removed in 7.0 - */ - protected $serializer; - /** * True to return the result as an associative array, false for a nested stdClass hierarchy. */ diff --git a/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php b/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php index f81386db33b03..d6cf495b0b167 100644 --- a/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/JsonEncoder.php @@ -20,8 +20,8 @@ class JsonEncoder implements EncoderInterface, DecoderInterface { public const FORMAT = 'json'; - protected $encodingImpl; - protected $decodingImpl; + protected JsonEncode $encodingImpl; + protected JsonDecode $decodingImpl; private array $defaultContext = [ JsonDecode::ASSOCIATIVE => true, diff --git a/src/Symfony/Component/Serializer/Mapping/Loader/FileLoader.php b/src/Symfony/Component/Serializer/Mapping/Loader/FileLoader.php index f4947ef4cef03..7fda4ebd5f94f 100644 --- a/src/Symfony/Component/Serializer/Mapping/Loader/FileLoader.php +++ b/src/Symfony/Component/Serializer/Mapping/Loader/FileLoader.php @@ -20,7 +20,7 @@ */ abstract class FileLoader implements LoaderInterface { - protected $file; + protected string $file; /** * @param string $file The mapping file to load diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index c0ce6870ac92d..7bea25cfb3485 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -123,22 +123,14 @@ abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerIn */ protected const CIRCULAR_REFERENCE_LIMIT_COUNTERS = 'circular_reference_limit_counters'; - protected $defaultContext = [ + protected array $defaultContext = [ self::ALLOW_EXTRA_ATTRIBUTES => true, self::CIRCULAR_REFERENCE_HANDLER => null, self::CIRCULAR_REFERENCE_LIMIT => 1, self::IGNORED_ATTRIBUTES => [], ]; - - /** - * @var ClassMetadataFactoryInterface|null - */ - protected $classMetadataFactory; - - /** - * @var NameConverterInterface|null - */ - protected $nameConverter; + protected ?ClassMetadataFactoryInterface $classMetadataFactory; + protected ?NameConverterInterface $nameConverter; /** * Sets the {@link ClassMetadataFactoryInterface} to use. diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index 60b37a8646890..ddca68f585e9e 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -105,15 +105,12 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer */ public const PRESERVE_EMPTY_OBJECTS = 'preserve_empty_objects'; + protected ?ClassDiscriminatorResolverInterface $classDiscriminatorResolver; + private array $typesCache = []; private array $attributesCache = []; private readonly \Closure $objectClassResolver; - /** - * @var ClassDiscriminatorResolverInterface|null - */ - protected $classDiscriminatorResolver; - public function __construct( ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizerAwareTrait.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizerAwareTrait.php index c5cc86ecf63ca..166e3f69c986c 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DenormalizerAwareTrait.php +++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizerAwareTrait.php @@ -16,10 +16,7 @@ */ trait DenormalizerAwareTrait { - /** - * @var DenormalizerInterface - */ - protected $denormalizer; + protected DenormalizerInterface $denormalizer; /** * @return void diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizerAwareTrait.php b/src/Symfony/Component/Serializer/Normalizer/NormalizerAwareTrait.php index 98139de6d3f39..e21c6c1751467 100644 --- a/src/Symfony/Component/Serializer/Normalizer/NormalizerAwareTrait.php +++ b/src/Symfony/Component/Serializer/Normalizer/NormalizerAwareTrait.php @@ -16,10 +16,7 @@ */ trait NormalizerAwareTrait { - /** - * @var NormalizerInterface - */ - protected $normalizer; + protected NormalizerInterface $normalizer; public function setNormalizer(NormalizerInterface $normalizer): void { diff --git a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php index c328dcf404db3..cad926def77cd 100644 --- a/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php @@ -28,7 +28,7 @@ */ final class ObjectNormalizer extends AbstractObjectNormalizer { - protected $propertyAccessor; + protected PropertyAccessorInterface $propertyAccessor; /** @var array */ private array $discriminatorCache = []; diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index 4eb7d315868c1..eb8bb82f48cfa 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -58,15 +58,9 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz 'string' => true, ]; - /** - * @var ChainEncoder - */ - protected $encoder; + protected ChainEncoder $encoder; - /** - * @var ChainDecoder - */ - protected $decoder; + protected ChainDecoder $decoder; /** * @var array>> diff --git a/src/Symfony/Component/Serializer/SerializerAwareTrait.php b/src/Symfony/Component/Serializer/SerializerAwareTrait.php index f74f56b410d59..e4ba0ecb9c225 100644 --- a/src/Symfony/Component/Serializer/SerializerAwareTrait.php +++ b/src/Symfony/Component/Serializer/SerializerAwareTrait.php @@ -16,10 +16,7 @@ */ trait SerializerAwareTrait { - /** - * @var SerializerInterface - */ - protected $serializer; + protected SerializerInterface $serializer; public function setSerializer(SerializerInterface $serializer): void { diff --git a/src/Symfony/Component/String/AbstractString.php b/src/Symfony/Component/String/AbstractString.php index cc3a2e04c60ad..3f36eefceef0d 100644 --- a/src/Symfony/Component/String/AbstractString.php +++ b/src/Symfony/Component/String/AbstractString.php @@ -39,8 +39,8 @@ abstract class AbstractString implements \Stringable, \JsonSerializable public const PREG_SPLIT_DELIM_CAPTURE = \PREG_SPLIT_DELIM_CAPTURE; public const PREG_SPLIT_OFFSET_CAPTURE = \PREG_SPLIT_OFFSET_CAPTURE; - protected $string = ''; - protected $ignoreCase = false; + protected string $string = ''; + protected ?bool $ignoreCase = false; abstract public function __construct(string $string = ''); diff --git a/src/Symfony/Component/Templating/DelegatingEngine.php b/src/Symfony/Component/Templating/DelegatingEngine.php index fb905b688b06e..8ec6b63850e63 100644 --- a/src/Symfony/Component/Templating/DelegatingEngine.php +++ b/src/Symfony/Component/Templating/DelegatingEngine.php @@ -21,7 +21,7 @@ class DelegatingEngine implements EngineInterface, StreamingEngineInterface /** * @var EngineInterface[] */ - protected $engines = []; + protected array $engines = []; /** * @param EngineInterface[] $engines An array of EngineInterface instances to add diff --git a/src/Symfony/Component/Templating/Helper/Helper.php b/src/Symfony/Component/Templating/Helper/Helper.php index 7a910e51bbb39..4963e2b069b35 100644 --- a/src/Symfony/Component/Templating/Helper/Helper.php +++ b/src/Symfony/Component/Templating/Helper/Helper.php @@ -21,7 +21,7 @@ */ abstract class Helper implements HelperInterface { - protected $charset = 'UTF-8'; + protected string $charset = 'UTF-8'; /** * Sets the default charset. diff --git a/src/Symfony/Component/Templating/Helper/SlotsHelper.php b/src/Symfony/Component/Templating/Helper/SlotsHelper.php index f325ddc37549d..cca583a3f7dd3 100644 --- a/src/Symfony/Component/Templating/Helper/SlotsHelper.php +++ b/src/Symfony/Component/Templating/Helper/SlotsHelper.php @@ -18,8 +18,8 @@ */ class SlotsHelper extends Helper { - protected $slots = []; - protected $openSlots = []; + protected array $slots = []; + protected array $openSlots = []; /** * Starts a new slot. diff --git a/src/Symfony/Component/Templating/Loader/CacheLoader.php b/src/Symfony/Component/Templating/Loader/CacheLoader.php index c3b4613ed3d06..827cb9cf961e4 100644 --- a/src/Symfony/Component/Templating/Loader/CacheLoader.php +++ b/src/Symfony/Component/Templating/Loader/CacheLoader.php @@ -26,8 +26,8 @@ */ class CacheLoader extends Loader { - protected $loader; - protected $dir; + protected LoaderInterface $loader; + protected string $dir; /** * @param string $dir The directory where to store the cache files diff --git a/src/Symfony/Component/Templating/Loader/ChainLoader.php b/src/Symfony/Component/Templating/Loader/ChainLoader.php index 8bdad989c6b48..4416374a6838f 100644 --- a/src/Symfony/Component/Templating/Loader/ChainLoader.php +++ b/src/Symfony/Component/Templating/Loader/ChainLoader.php @@ -21,7 +21,7 @@ */ class ChainLoader extends Loader { - protected $loaders = []; + protected array $loaders = []; /** * @param LoaderInterface[] $loaders diff --git a/src/Symfony/Component/Templating/Loader/FilesystemLoader.php b/src/Symfony/Component/Templating/Loader/FilesystemLoader.php index 6c06ed85c2a9e..a7aa8a8e904e7 100644 --- a/src/Symfony/Component/Templating/Loader/FilesystemLoader.php +++ b/src/Symfony/Component/Templating/Loader/FilesystemLoader.php @@ -22,7 +22,7 @@ */ class FilesystemLoader extends Loader { - protected $templatePathPatterns; + protected array $templatePathPatterns; /** * @param string|string[] $templatePathPatterns An array of path patterns to look for templates diff --git a/src/Symfony/Component/Templating/Loader/Loader.php b/src/Symfony/Component/Templating/Loader/Loader.php index ca575f6f8b944..eb52d7570d0d9 100644 --- a/src/Symfony/Component/Templating/Loader/Loader.php +++ b/src/Symfony/Component/Templating/Loader/Loader.php @@ -20,10 +20,7 @@ */ abstract class Loader implements LoaderInterface { - /** - * @var LoggerInterface|null - */ - protected $logger; + protected ?LoggerInterface $logger = null; /** * Sets the debug logger to use for this loader. diff --git a/src/Symfony/Component/Templating/PhpEngine.php b/src/Symfony/Component/Templating/PhpEngine.php index 0b76e54e85f8f..6bf23411a2f05 100644 --- a/src/Symfony/Component/Templating/PhpEngine.php +++ b/src/Symfony/Component/Templating/PhpEngine.php @@ -26,20 +26,21 @@ */ class PhpEngine implements EngineInterface, \ArrayAccess { - protected $loader; - protected $current; + protected LoaderInterface $loader; + protected string $current; /** * @var HelperInterface[] */ - protected $helpers = []; - protected $parents = []; - protected $stack = []; - protected $charset = 'UTF-8'; - protected $cache = []; - protected $escapers = []; - protected static $escaperCache = []; - protected $globals = []; - protected $parser; + protected array $helpers = []; + protected array $parents = []; + protected array $stack = []; + protected string $charset = 'UTF-8'; + protected array $cache = []; + protected array $escapers = []; + protected array $globals = []; + protected TemplateNameParserInterface $parser; + + protected static array $escaperCache = []; private Storage $evalTemplate; private array $evalParameters; diff --git a/src/Symfony/Component/Templating/Storage/Storage.php b/src/Symfony/Component/Templating/Storage/Storage.php index f17d24e877ad0..de7b00a7fc9dd 100644 --- a/src/Symfony/Component/Templating/Storage/Storage.php +++ b/src/Symfony/Component/Templating/Storage/Storage.php @@ -18,7 +18,7 @@ */ abstract class Storage { - protected $template; + protected string $template; /** * @param string $template The template name diff --git a/src/Symfony/Component/Templating/TemplateReference.php b/src/Symfony/Component/Templating/TemplateReference.php index e42f49a55460a..52b7e96b07773 100644 --- a/src/Symfony/Component/Templating/TemplateReference.php +++ b/src/Symfony/Component/Templating/TemplateReference.php @@ -18,7 +18,7 @@ */ class TemplateReference implements TemplateReferenceInterface { - protected $parameters; + protected array $parameters; public function __construct(string $name = null, string $engine = null) { diff --git a/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php b/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php index 6dc0119f63cc6..559d3a5d22791 100644 --- a/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php +++ b/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php @@ -30,9 +30,9 @@ abstract class AbstractOperation implements OperationInterface public const NEW_BATCH = 'new'; public const ALL_BATCH = 'all'; - protected $source; - protected $target; - protected $result; + protected MessageCatalogueInterface $source; + protected MessageCatalogueInterface $target; + protected MessageCatalogue $result; /** * This array stores 'all', 'new' and 'obsolete' messages for all valid domains. @@ -55,7 +55,7 @@ abstract class AbstractOperation implements OperationInterface * * @var array The array that stores 'all', 'new' and 'obsolete' messages */ - protected $messages; + protected array $messages; private array $domains; diff --git a/src/Symfony/Component/Translation/Dumper/FileDumper.php b/src/Symfony/Component/Translation/Dumper/FileDumper.php index a9ddd168c3586..3846e7380da5f 100644 --- a/src/Symfony/Component/Translation/Dumper/FileDumper.php +++ b/src/Symfony/Component/Translation/Dumper/FileDumper.php @@ -27,10 +27,8 @@ abstract class FileDumper implements DumperInterface { /** * A template for the relative paths to files. - * - * @var string */ - protected $relativePathTemplate = '%domain%.%locale%.%extension%'; + protected string $relativePathTemplate = '%domain%.%locale%.%extension%'; /** * Sets the template for the relative paths to files. diff --git a/src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php b/src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php index 72c1ec0890796..e603ee8c48c99 100644 --- a/src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php +++ b/src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php @@ -20,7 +20,7 @@ */ class IcuResFileDumper extends FileDumper { - protected $relativePathTemplate = '%domain%/%locale%.%extension%'; + protected string $relativePathTemplate = '%domain%/%locale%.%extension%'; public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string { diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php index 0934b516d0e9d..63037c574c0e7 100644 --- a/src/Symfony/Component/Translation/Translator.php +++ b/src/Symfony/Component/Translation/Translator.php @@ -36,7 +36,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA /** * @var MessageCatalogueInterface[] */ - protected $catalogues = []; + protected array $catalogues = []; private string $locale; diff --git a/src/Symfony/Component/Uid/AbstractUid.php b/src/Symfony/Component/Uid/AbstractUid.php index 54d2b13b01c1a..b8337097e26f3 100644 --- a/src/Symfony/Component/Uid/AbstractUid.php +++ b/src/Symfony/Component/Uid/AbstractUid.php @@ -19,7 +19,7 @@ abstract class AbstractUid implements \JsonSerializable /** * The identifier in its canonic representation. */ - protected $uid; + protected string $uid; /** * Whether the passed value is valid for the constructor of the current class. diff --git a/src/Symfony/Component/Validator/Constraint.php b/src/Symfony/Component/Validator/Constraint.php index 50314963fdf1e..902ff04b3fe56 100644 --- a/src/Symfony/Component/Validator/Constraint.php +++ b/src/Symfony/Component/Validator/Constraint.php @@ -52,14 +52,14 @@ abstract class Constraint /** * Domain-specific data attached to a constraint. */ - public $payload; + public mixed $payload; /** * The groups that the constraint belongs to. * * @var string[] */ - public $groups; + public ?array $groups = null; /** * Returns the name of the given error code. diff --git a/src/Symfony/Component/Validator/ConstraintValidator.php b/src/Symfony/Component/Validator/ConstraintValidator.php index f9dceaf54d7bb..75f3195b8b7ff 100644 --- a/src/Symfony/Component/Validator/ConstraintValidator.php +++ b/src/Symfony/Component/Validator/ConstraintValidator.php @@ -31,10 +31,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface */ public const OBJECT_TO_STRING = 2; - /** - * @var ExecutionContextInterface - */ - protected $context; + protected ExecutionContextInterface $context; public function initialize(ExecutionContextInterface $context): void { diff --git a/src/Symfony/Component/Validator/ConstraintValidatorFactory.php b/src/Symfony/Component/Validator/ConstraintValidatorFactory.php index 778e202a84bf8..51ea6e07ae5c1 100644 --- a/src/Symfony/Component/Validator/ConstraintValidatorFactory.php +++ b/src/Symfony/Component/Validator/ConstraintValidatorFactory.php @@ -24,7 +24,7 @@ */ class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface { - protected $validators = []; + protected array $validators; public function __construct(array $validators = []) { diff --git a/src/Symfony/Component/Validator/Constraints/AbstractComparison.php b/src/Symfony/Component/Validator/Constraints/AbstractComparison.php index d13031793fb6a..c7b87ba0ec791 100644 --- a/src/Symfony/Component/Validator/Constraints/AbstractComparison.php +++ b/src/Symfony/Component/Validator/Constraints/AbstractComparison.php @@ -24,9 +24,9 @@ */ abstract class AbstractComparison extends Constraint { - public $message; - public $value; - public $propertyPath; + public string $message; + public mixed $value = null; + public ?string $propertyPath = null; public function __construct(mixed $value = null, string $propertyPath = null, string $message = null, array $groups = null, mixed $payload = null, array $options = []) { diff --git a/src/Symfony/Component/Validator/Constraints/All.php b/src/Symfony/Component/Validator/Constraints/All.php index 63d2d5b96d61b..95f8826014e16 100644 --- a/src/Symfony/Component/Validator/Constraints/All.php +++ b/src/Symfony/Component/Validator/Constraints/All.php @@ -11,13 +11,15 @@ namespace Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\Constraint; + /** * @author Bernhard Schussek */ #[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class All extends Composite { - public $constraints = []; + public array|Constraint $constraints = []; public function __construct(mixed $constraints = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/AtLeastOneOf.php b/src/Symfony/Component/Validator/Constraints/AtLeastOneOf.php index bfa33533de430..60f5e31a6bcc7 100644 --- a/src/Symfony/Component/Validator/Constraints/AtLeastOneOf.php +++ b/src/Symfony/Component/Validator/Constraints/AtLeastOneOf.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\Constraint; + /** * @author Przemysław Bogusz */ @@ -23,10 +25,10 @@ class AtLeastOneOf extends Composite self::AT_LEAST_ONE_OF_ERROR => 'AT_LEAST_ONE_OF_ERROR', ]; - public $constraints = []; - public $message = 'This value should satisfy at least one of the following constraints:'; - public $messageCollection = 'Each element of this collection should satisfy its own set of constraints.'; - public $includeInternalMessages = true; + public array|Constraint $constraints = []; + public string $message = 'This value should satisfy at least one of the following constraints:'; + public string $messageCollection = 'Each element of this collection should satisfy its own set of constraints.'; + public bool $includeInternalMessages = true; public function __construct(mixed $constraints = null, array $groups = null, mixed $payload = null, string $message = null, string $messageCollection = null, bool $includeInternalMessages = null) { diff --git a/src/Symfony/Component/Validator/Constraints/Bic.php b/src/Symfony/Component/Validator/Constraints/Bic.php index faeb63939bce1..47f523f899874 100644 --- a/src/Symfony/Component/Validator/Constraints/Bic.php +++ b/src/Symfony/Component/Validator/Constraints/Bic.php @@ -38,10 +38,10 @@ class Bic extends Constraint self::INVALID_CASE_ERROR => 'INVALID_CASE_ERROR', ]; - public $message = 'This is not a valid Business Identifier Code (BIC).'; - public $ibanMessage = 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.'; - public $iban; - public $ibanPropertyPath; + public string $message = 'This is not a valid Business Identifier Code (BIC).'; + public string $ibanMessage = 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.'; + public ?string $iban = null; + public ?string $ibanPropertyPath = null; public function __construct(array $options = null, string $message = null, string $iban = null, string $ibanPropertyPath = null, string $ibanMessage = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/Blank.php b/src/Symfony/Component/Validator/Constraints/Blank.php index f620815ed2ada..9f0b2be825067 100644 --- a/src/Symfony/Component/Validator/Constraints/Blank.php +++ b/src/Symfony/Component/Validator/Constraints/Blank.php @@ -25,7 +25,7 @@ class Blank extends Constraint self::NOT_BLANK_ERROR => 'NOT_BLANK_ERROR', ]; - public $message = 'This value should be blank.'; + public string $message = 'This value should be blank.'; public function __construct(array $options = null, string $message = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/CardScheme.php b/src/Symfony/Component/Validator/Constraints/CardScheme.php index 260bdd4ac1344..3097ef8a68be6 100644 --- a/src/Symfony/Component/Validator/Constraints/CardScheme.php +++ b/src/Symfony/Component/Validator/Constraints/CardScheme.php @@ -43,8 +43,8 @@ class CardScheme extends Constraint self::INVALID_FORMAT_ERROR => 'INVALID_FORMAT_ERROR', ]; - public $message = 'Unsupported card type or invalid card number.'; - public $schemes; + public string $message = 'Unsupported card type or invalid card number.'; + public array|string|null $schemes = null; public function __construct(array|string|null $schemes, string $message = null, array $groups = null, mixed $payload = null, array $options = []) { diff --git a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php index c21a93a9b10a9..ffc44a538ee7d 100644 --- a/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php @@ -26,7 +26,7 @@ */ class CardSchemeValidator extends ConstraintValidator { - protected $schemes = [ + protected array $schemes = [ // American Express card numbers start with 34 or 37 and have 15 digits. CardScheme::AMEX => [ '/^3[47][0-9]{13}$/', diff --git a/src/Symfony/Component/Validator/Constraints/Choice.php b/src/Symfony/Component/Validator/Constraints/Choice.php index 66ac0df9c6043..de1d87f5f36e8 100644 --- a/src/Symfony/Component/Validator/Constraints/Choice.php +++ b/src/Symfony/Component/Validator/Constraints/Choice.php @@ -29,17 +29,17 @@ class Choice extends Constraint self::TOO_MANY_ERROR => 'TOO_MANY_ERROR', ]; - public $choices; + public ?array $choices = null; /** @var callable|string|null */ public $callback; - public $multiple = false; - public $strict = true; - public $min; - public $max; - public $message = 'The value you selected is not a valid choice.'; - public $multipleMessage = 'One or more of the given values is invalid.'; - public $minMessage = 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.'; - public $maxMessage = 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.'; + public bool $multiple = false; + public bool $strict = true; + public ?int $min = null; + public ?int $max = null; + public string $message = 'The value you selected is not a valid choice.'; + public string $multipleMessage = 'One or more of the given values is invalid.'; + public string $minMessage = 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.'; + public string $maxMessage = 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.'; public bool $match = true; public function getDefaultOption(): ?string diff --git a/src/Symfony/Component/Validator/Constraints/Cidr.php b/src/Symfony/Component/Validator/Constraints/Cidr.php index 84d48af733276..b62e6c1228ac8 100644 --- a/src/Symfony/Component/Validator/Constraints/Cidr.php +++ b/src/Symfony/Component/Validator/Constraints/Cidr.php @@ -37,15 +37,11 @@ class Cidr extends Constraint Ip::V6 => 128, ]; - public $version = Ip::ALL; - - public $message = 'This value is not a valid CIDR notation.'; - - public $netmaskRangeViolationMessage = 'The value of the netmask should be between {{ min }} and {{ max }}.'; - - public $netmaskMin = 0; - - public $netmaskMax; + public string $version = Ip::ALL; + public string $message = 'This value is not a valid CIDR notation.'; + public string $netmaskRangeViolationMessage = 'The value of the netmask should be between {{ min }} and {{ max }}.'; + public int $netmaskMin = 0; + public int $netmaskMax; public function __construct( array $options = null, diff --git a/src/Symfony/Component/Validator/Constraints/Collection.php b/src/Symfony/Component/Validator/Constraints/Collection.php index 635822ca48603..57c27793340ce 100644 --- a/src/Symfony/Component/Validator/Constraints/Collection.php +++ b/src/Symfony/Component/Validator/Constraints/Collection.php @@ -11,8 +11,6 @@ namespace Symfony\Component\Validator\Constraints; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; - /** * @author Bernhard Schussek */ @@ -27,13 +25,13 @@ class Collection extends Composite self::NO_SUCH_FIELD_ERROR => 'NO_SUCH_FIELD_ERROR', ]; - public $fields = []; - public $allowExtraFields = false; - public $allowMissingFields = false; - public $extraFieldsMessage = 'This field was not expected.'; - public $missingFieldsMessage = 'This field is missing.'; + public array $fields = []; + public bool $allowExtraFields = false; + public bool $allowMissingFields = false; + public string $extraFieldsMessage = 'This field was not expected.'; + public string $missingFieldsMessage = 'This field is missing.'; - public function __construct(mixed $fields = null, array $groups = null, mixed $payload = null, bool $allowExtraFields = null, bool $allowMissingFields = null, string $extraFieldsMessage = null, string $missingFieldsMessage = null) + public function __construct(array $fields = null, array $groups = null, mixed $payload = null, bool $allowExtraFields = null, bool $allowMissingFields = null, string $extraFieldsMessage = null, string $missingFieldsMessage = null) { // no known options set? $fields is the fields array if (\is_array($fields) @@ -53,10 +51,6 @@ protected function initializeNestedConstraints(): void { parent::initializeNestedConstraints(); - if (!\is_array($this->fields)) { - throw new ConstraintDefinitionException(sprintf('The option "fields" is expected to be an array in constraint "%s".', __CLASS__)); - } - foreach ($this->fields as $fieldName => $field) { // the XmlFileLoader and YamlFileLoader pass the field Optional // and Required constraint as an array with exactly one element diff --git a/src/Symfony/Component/Validator/Constraints/Compound.php b/src/Symfony/Component/Validator/Constraints/Compound.php index de0080fec889d..f6e875c01d12d 100644 --- a/src/Symfony/Component/Validator/Constraints/Compound.php +++ b/src/Symfony/Component/Validator/Constraints/Compound.php @@ -22,7 +22,7 @@ abstract class Compound extends Composite { /** @var Constraint[] */ - public $constraints = []; + public array $constraints = []; public function __construct(mixed $options = null) { diff --git a/src/Symfony/Component/Validator/Constraints/Count.php b/src/Symfony/Component/Validator/Constraints/Count.php index 92c9b240fb17b..f18c99c84dd62 100644 --- a/src/Symfony/Component/Validator/Constraints/Count.php +++ b/src/Symfony/Component/Validator/Constraints/Count.php @@ -32,13 +32,13 @@ class Count extends Constraint self::NOT_DIVISIBLE_BY_ERROR => 'NOT_DIVISIBLE_BY_ERROR', ]; - public $minMessage = 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.'; - public $maxMessage = 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.'; - public $exactMessage = 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.'; - public $divisibleByMessage = 'The number of elements in this collection should be a multiple of {{ compared_value }}.'; - public $min; - public $max; - public $divisibleBy; + public string $minMessage = 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.'; + public string $maxMessage = 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.'; + public string $exactMessage = 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.'; + public string $divisibleByMessage = 'The number of elements in this collection should be a multiple of {{ compared_value }}.'; + public ?int $min = null; + public ?int $max = null; + public ?int $divisibleBy = null; public function __construct( int|array $exactly = null, diff --git a/src/Symfony/Component/Validator/Constraints/Country.php b/src/Symfony/Component/Validator/Constraints/Country.php index a4a63aa4807a2..f3dfeaa9a1136 100644 --- a/src/Symfony/Component/Validator/Constraints/Country.php +++ b/src/Symfony/Component/Validator/Constraints/Country.php @@ -27,8 +27,8 @@ class Country extends Constraint self::NO_SUCH_COUNTRY_ERROR => 'NO_SUCH_COUNTRY_ERROR', ]; - public $message = 'This value is not a valid country.'; - public $alpha3 = false; + public string $message = 'This value is not a valid country.'; + public bool $alpha3 = false; public function __construct( array $options = null, diff --git a/src/Symfony/Component/Validator/Constraints/CssColor.php b/src/Symfony/Component/Validator/Constraints/CssColor.php index 81934884a0f46..73b7c0543c41f 100644 --- a/src/Symfony/Component/Validator/Constraints/CssColor.php +++ b/src/Symfony/Component/Validator/Constraints/CssColor.php @@ -56,13 +56,13 @@ class CssColor extends Constraint self::HSLA, ]; - public $message = 'This value is not a valid CSS color.'; - public $formats; + public string $message = 'This value is not a valid CSS color.'; + public array|string $formats; /** * @param array|string $formats The types of CSS colors allowed (e.g. hexadecimal only, RGB and HSL only, etc.). */ - public function __construct($formats = [], string $message = null, array $groups = null, $payload = null, array $options = null) + public function __construct(array|string $formats = [], string $message = null, array $groups = null, $payload = null, array $options = null) { $validationModesAsString = implode(', ', self::$validationModes); diff --git a/src/Symfony/Component/Validator/Constraints/Currency.php b/src/Symfony/Component/Validator/Constraints/Currency.php index 5defeac1c2639..f75412c728a88 100644 --- a/src/Symfony/Component/Validator/Constraints/Currency.php +++ b/src/Symfony/Component/Validator/Constraints/Currency.php @@ -28,7 +28,7 @@ class Currency extends Constraint self::NO_SUCH_CURRENCY_ERROR => 'NO_SUCH_CURRENCY_ERROR', ]; - public $message = 'This value is not a valid currency.'; + public string $message = 'This value is not a valid currency.'; public function __construct(array $options = null, string $message = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/Date.php b/src/Symfony/Component/Validator/Constraints/Date.php index de402ade4917b..b54f9b2efb8d1 100644 --- a/src/Symfony/Component/Validator/Constraints/Date.php +++ b/src/Symfony/Component/Validator/Constraints/Date.php @@ -27,7 +27,7 @@ class Date extends Constraint self::INVALID_DATE_ERROR => 'INVALID_DATE_ERROR', ]; - public $message = 'This value is not a valid date.'; + public string $message = 'This value is not a valid date.'; public function __construct(array $options = null, string $message = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/DateTime.php b/src/Symfony/Component/Validator/Constraints/DateTime.php index 62f772c79ef8a..5f434346fc680 100644 --- a/src/Symfony/Component/Validator/Constraints/DateTime.php +++ b/src/Symfony/Component/Validator/Constraints/DateTime.php @@ -29,8 +29,8 @@ class DateTime extends Constraint self::INVALID_TIME_ERROR => 'INVALID_TIME_ERROR', ]; - public $format = 'Y-m-d H:i:s'; - public $message = 'This value is not a valid datetime.'; + public string $format = 'Y-m-d H:i:s'; + public string $message = 'This value is not a valid datetime.'; public function __construct(string|array $format = null, string $message = null, array $groups = null, mixed $payload = null, array $options = []) { diff --git a/src/Symfony/Component/Validator/Constraints/DivisibleBy.php b/src/Symfony/Component/Validator/Constraints/DivisibleBy.php index 84355d891ffdd..f1490358dccf6 100644 --- a/src/Symfony/Component/Validator/Constraints/DivisibleBy.php +++ b/src/Symfony/Component/Validator/Constraints/DivisibleBy.php @@ -23,5 +23,5 @@ class DivisibleBy extends AbstractComparison self::NOT_DIVISIBLE_BY => 'NOT_DIVISIBLE_BY', ]; - public $message = 'This value should be a multiple of {{ compared_value }}.'; + public string $message = 'This value should be a multiple of {{ compared_value }}.'; } diff --git a/src/Symfony/Component/Validator/Constraints/Email.php b/src/Symfony/Component/Validator/Constraints/Email.php index 337aece2f7218..6edcca3e20b5c 100644 --- a/src/Symfony/Component/Validator/Constraints/Email.php +++ b/src/Symfony/Component/Validator/Constraints/Email.php @@ -38,8 +38,8 @@ class Email extends Constraint self::INVALID_FORMAT_ERROR => 'STRICT_CHECK_FAILED_ERROR', ]; - public $message = 'This value is not a valid email address.'; - public $mode; + public string $message = 'This value is not a valid email address.'; + public ?string $mode = null; /** @var callable|null */ public $normalizer; diff --git a/src/Symfony/Component/Validator/Constraints/EqualTo.php b/src/Symfony/Component/Validator/Constraints/EqualTo.php index fedece0e043c0..3a6f8f828da69 100644 --- a/src/Symfony/Component/Validator/Constraints/EqualTo.php +++ b/src/Symfony/Component/Validator/Constraints/EqualTo.php @@ -24,5 +24,5 @@ class EqualTo extends AbstractComparison self::NOT_EQUAL_ERROR => 'NOT_EQUAL_ERROR', ]; - public $message = 'This value should be equal to {{ compared_value }}.'; + public string $message = 'This value should be equal to {{ compared_value }}.'; } diff --git a/src/Symfony/Component/Validator/Constraints/Existence.php b/src/Symfony/Component/Validator/Constraints/Existence.php index a0d6ebd6061ef..72bc1da61f4a6 100644 --- a/src/Symfony/Component/Validator/Constraints/Existence.php +++ b/src/Symfony/Component/Validator/Constraints/Existence.php @@ -11,12 +11,14 @@ namespace Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\Constraint; + /** * @author Bernhard Schussek */ abstract class Existence extends Composite { - public $constraints = []; + public array|Constraint $constraints = []; public function getDefaultOption(): ?string { diff --git a/src/Symfony/Component/Validator/Constraints/Expression.php b/src/Symfony/Component/Validator/Constraints/Expression.php index 1f0f35b86315f..a6bd83141723c 100644 --- a/src/Symfony/Component/Validator/Constraints/Expression.php +++ b/src/Symfony/Component/Validator/Constraints/Expression.php @@ -29,9 +29,9 @@ class Expression extends Constraint self::EXPRESSION_FAILED_ERROR => 'EXPRESSION_FAILED_ERROR', ]; - public $message = 'This value is not valid.'; - public $expression; - public $values = []; + public string $message = 'This value is not valid.'; + public string|ExpressionObject|null $expression = null; + public array $values = []; public bool $negate = true; public function __construct( diff --git a/src/Symfony/Component/Validator/Constraints/ExpressionSyntax.php b/src/Symfony/Component/Validator/Constraints/ExpressionSyntax.php index e3940cf3851d6..b0255743e7e57 100644 --- a/src/Symfony/Component/Validator/Constraints/ExpressionSyntax.php +++ b/src/Symfony/Component/Validator/Constraints/ExpressionSyntax.php @@ -25,9 +25,9 @@ class ExpressionSyntax extends Constraint self::EXPRESSION_SYNTAX_ERROR => 'EXPRESSION_SYNTAX_ERROR', ]; - public $message = 'This value should be a valid expression.'; - public $service; - public $allowedVariables; + public string $message = 'This value should be a valid expression.'; + public ?string $service = null; + public ?array $allowedVariables = null; public function __construct(array $options = null, string $message = null, string $service = null, array $allowedVariables = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/File.php b/src/Symfony/Component/Validator/Constraints/File.php index cb774269ac242..1f11d8290f117 100644 --- a/src/Symfony/Component/Validator/Constraints/File.php +++ b/src/Symfony/Component/Validator/Constraints/File.php @@ -41,28 +41,28 @@ class File extends Constraint self::FILENAME_TOO_LONG => 'FILENAME_TOO_LONG', ]; - public $binaryFormat; - public $mimeTypes = []; + public ?bool $binaryFormat = null; + public array|string $mimeTypes = []; public ?int $filenameMaxLength = null; - public array|string|null $extensions = []; - public $notFoundMessage = 'The file could not be found.'; - public $notReadableMessage = 'The file is not readable.'; - public $maxSizeMessage = 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.'; - public $mimeTypesMessage = 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.'; + public array|string $extensions = []; + public string $notFoundMessage = 'The file could not be found.'; + public string $notReadableMessage = 'The file is not readable.'; + public string $maxSizeMessage = 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.'; + public string $mimeTypesMessage = 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.'; public string $extensionsMessage = 'The extension of the file is invalid ({{ extension }}). Allowed extensions are {{ extensions }}.'; - public $disallowEmptyMessage = 'An empty file is not allowed.'; - public $filenameTooLongMessage = 'The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.'; - - public $uploadIniSizeErrorMessage = 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.'; - public $uploadFormSizeErrorMessage = 'The file is too large.'; - public $uploadPartialErrorMessage = 'The file was only partially uploaded.'; - public $uploadNoFileErrorMessage = 'No file was uploaded.'; - public $uploadNoTmpDirErrorMessage = 'No temporary folder was configured in php.ini.'; - public $uploadCantWriteErrorMessage = 'Cannot write temporary file to disk.'; - public $uploadExtensionErrorMessage = 'A PHP extension caused the upload to fail.'; - public $uploadErrorMessage = 'The file could not be uploaded.'; - - protected $maxSize; + public string $disallowEmptyMessage = 'An empty file is not allowed.'; + public string $filenameTooLongMessage = 'The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.'; + + public string $uploadIniSizeErrorMessage = 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.'; + public string $uploadFormSizeErrorMessage = 'The file is too large.'; + public string $uploadPartialErrorMessage = 'The file was only partially uploaded.'; + public string $uploadNoFileErrorMessage = 'No file was uploaded.'; + public string $uploadNoTmpDirErrorMessage = 'No temporary folder was configured in php.ini.'; + public string $uploadCantWriteErrorMessage = 'Cannot write temporary file to disk.'; + public string $uploadExtensionErrorMessage = 'A PHP extension caused the upload to fail.'; + public string $uploadErrorMessage = 'The file could not be uploaded.'; + + protected int|string|null $maxSize = null; /** * @param array|string[]|string $extensions diff --git a/src/Symfony/Component/Validator/Constraints/GreaterThan.php b/src/Symfony/Component/Validator/Constraints/GreaterThan.php index d010b0de7a282..99785aee006e6 100644 --- a/src/Symfony/Component/Validator/Constraints/GreaterThan.php +++ b/src/Symfony/Component/Validator/Constraints/GreaterThan.php @@ -24,5 +24,5 @@ class GreaterThan extends AbstractComparison self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', ]; - public $message = 'This value should be greater than {{ compared_value }}.'; + public string $message = 'This value should be greater than {{ compared_value }}.'; } diff --git a/src/Symfony/Component/Validator/Constraints/GreaterThanOrEqual.php b/src/Symfony/Component/Validator/Constraints/GreaterThanOrEqual.php index faf1c48d04196..43c36e80e5286 100644 --- a/src/Symfony/Component/Validator/Constraints/GreaterThanOrEqual.php +++ b/src/Symfony/Component/Validator/Constraints/GreaterThanOrEqual.php @@ -24,5 +24,5 @@ class GreaterThanOrEqual extends AbstractComparison self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', ]; - public $message = 'This value should be greater than or equal to {{ compared_value }}.'; + public string $message = 'This value should be greater than or equal to {{ compared_value }}.'; } diff --git a/src/Symfony/Component/Validator/Constraints/GroupSequence.php b/src/Symfony/Component/Validator/Constraints/GroupSequence.php index 5c9a41b7b0123..b3a8a91bfac1e 100644 --- a/src/Symfony/Component/Validator/Constraints/GroupSequence.php +++ b/src/Symfony/Component/Validator/Constraints/GroupSequence.php @@ -54,7 +54,7 @@ class GroupSequence * * @var array */ - public $groups; + public array $groups; /** * The group in which cascaded objects are validated when validating @@ -67,10 +67,8 @@ class GroupSequence * "Default" group. When validating that class in the "Default" group, the * group sequence is used instead, but still the "Default" group should be * cascaded to other objects. - * - * @var string|GroupSequence */ - public $cascadedGroup; + public string|GroupSequence $cascadedGroup; /** * Creates a new group sequence. diff --git a/src/Symfony/Component/Validator/Constraints/Hostname.php b/src/Symfony/Component/Validator/Constraints/Hostname.php index d24166de562ba..28f2a9b2d577e 100644 --- a/src/Symfony/Component/Validator/Constraints/Hostname.php +++ b/src/Symfony/Component/Validator/Constraints/Hostname.php @@ -25,8 +25,8 @@ class Hostname extends Constraint self::INVALID_HOSTNAME_ERROR => 'INVALID_HOSTNAME_ERROR', ]; - public $message = 'This value is not a valid hostname.'; - public $requireTld = true; + public string $message = 'This value is not a valid hostname.'; + public bool $requireTld = true; public function __construct( array $options = null, diff --git a/src/Symfony/Component/Validator/Constraints/Iban.php b/src/Symfony/Component/Validator/Constraints/Iban.php index 00287f831eac7..601e2b01cc7fb 100644 --- a/src/Symfony/Component/Validator/Constraints/Iban.php +++ b/src/Symfony/Component/Validator/Constraints/Iban.php @@ -35,7 +35,7 @@ class Iban extends Constraint self::NOT_SUPPORTED_COUNTRY_CODE_ERROR => 'NOT_SUPPORTED_COUNTRY_CODE_ERROR', ]; - public $message = 'This is not a valid International Bank Account Number (IBAN).'; + public string $message = 'This is not a valid International Bank Account Number (IBAN).'; public function __construct(array $options = null, string $message = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/IdenticalTo.php b/src/Symfony/Component/Validator/Constraints/IdenticalTo.php index 7ef73a0471c06..6a8b7bdf2637c 100644 --- a/src/Symfony/Component/Validator/Constraints/IdenticalTo.php +++ b/src/Symfony/Component/Validator/Constraints/IdenticalTo.php @@ -24,5 +24,5 @@ class IdenticalTo extends AbstractComparison self::NOT_IDENTICAL_ERROR => 'NOT_IDENTICAL_ERROR', ]; - public $message = 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.'; + public string $message = 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.'; } diff --git a/src/Symfony/Component/Validator/Constraints/Image.php b/src/Symfony/Component/Validator/Constraints/Image.php index 7306dd7bde12c..1b37a54d5bee2 100644 --- a/src/Symfony/Component/Validator/Constraints/Image.php +++ b/src/Symfony/Component/Validator/Constraints/Image.php @@ -55,35 +55,35 @@ class Image extends File self::CORRUPTED_IMAGE_ERROR => 'CORRUPTED_IMAGE_ERROR', ]; - public $mimeTypes = 'image/*'; - public $minWidth; - public $maxWidth; - public $maxHeight; - public $minHeight; - public $maxRatio; - public $minRatio; - public $minPixels; - public $maxPixels; - public $allowSquare = true; - public $allowLandscape = true; - public $allowPortrait = true; - public $detectCorrupted = false; + public array|string $mimeTypes = 'image/*'; + public ?int $minWidth = null; + public ?int $maxWidth = null; + public ?int $maxHeight = null; + public ?int $minHeight = null; + public int|float|null $maxRatio = null; + public int|float|null $minRatio = null; + public int|float|null $minPixels = null; + public int|float|null $maxPixels = null; + public bool $allowSquare = true; + public bool $allowLandscape = true; + public bool $allowPortrait = true; + public bool $detectCorrupted = false; // The constant for a wrong MIME type is taken from the parent class. - public $mimeTypesMessage = 'This file is not a valid image.'; - public $sizeNotDetectedMessage = 'The size of the image could not be detected.'; - public $maxWidthMessage = 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.'; - public $minWidthMessage = 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.'; - public $maxHeightMessage = 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.'; - public $minHeightMessage = 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.'; - public $minPixelsMessage = 'The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels.'; - public $maxPixelsMessage = 'The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels.'; - public $maxRatioMessage = 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.'; - public $minRatioMessage = 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.'; - public $allowSquareMessage = 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.'; - public $allowLandscapeMessage = 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.'; - public $allowPortraitMessage = 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.'; - public $corruptedMessage = 'The image file is corrupted.'; + public string $mimeTypesMessage = 'This file is not a valid image.'; + public string $sizeNotDetectedMessage = 'The size of the image could not be detected.'; + public string $maxWidthMessage = 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.'; + public string $minWidthMessage = 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.'; + public string $maxHeightMessage = 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.'; + public string $minHeightMessage = 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.'; + public string $minPixelsMessage = 'The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels.'; + public string $maxPixelsMessage = 'The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels.'; + public string $maxRatioMessage = 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.'; + public string $minRatioMessage = 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.'; + public string $allowSquareMessage = 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.'; + public string $allowLandscapeMessage = 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.'; + public string $allowPortraitMessage = 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.'; + public string $corruptedMessage = 'The image file is corrupted.'; public function __construct( array $options = null, diff --git a/src/Symfony/Component/Validator/Constraints/Ip.php b/src/Symfony/Component/Validator/Constraints/Ip.php index 5d942f12c327d..35e47deeab4b9 100644 --- a/src/Symfony/Component/Validator/Constraints/Ip.php +++ b/src/Symfony/Component/Validator/Constraints/Ip.php @@ -67,10 +67,8 @@ class Ip extends Constraint self::INVALID_IP_ERROR => 'INVALID_IP_ERROR', ]; - public $version = self::V4; - - public $message = 'This is not a valid IP address.'; - + public string $version = self::V4; + public string $message = 'This is not a valid IP address.'; /** @var callable|null */ public $normalizer; diff --git a/src/Symfony/Component/Validator/Constraints/IsFalse.php b/src/Symfony/Component/Validator/Constraints/IsFalse.php index f87180fb35577..62dfc42e1f628 100644 --- a/src/Symfony/Component/Validator/Constraints/IsFalse.php +++ b/src/Symfony/Component/Validator/Constraints/IsFalse.php @@ -25,7 +25,7 @@ class IsFalse extends Constraint self::NOT_FALSE_ERROR => 'NOT_FALSE_ERROR', ]; - public $message = 'This value should be false.'; + public string $message = 'This value should be false.'; public function __construct(array $options = null, string $message = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/IsNull.php b/src/Symfony/Component/Validator/Constraints/IsNull.php index 018ad150707ee..cbac402fa9d20 100644 --- a/src/Symfony/Component/Validator/Constraints/IsNull.php +++ b/src/Symfony/Component/Validator/Constraints/IsNull.php @@ -25,7 +25,7 @@ class IsNull extends Constraint self::NOT_NULL_ERROR => 'NOT_NULL_ERROR', ]; - public $message = 'This value should be null.'; + public string $message = 'This value should be null.'; public function __construct(array $options = null, string $message = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/IsTrue.php b/src/Symfony/Component/Validator/Constraints/IsTrue.php index 045da66e64b8a..c574ffb37304c 100644 --- a/src/Symfony/Component/Validator/Constraints/IsTrue.php +++ b/src/Symfony/Component/Validator/Constraints/IsTrue.php @@ -25,7 +25,7 @@ class IsTrue extends Constraint self::NOT_TRUE_ERROR => 'NOT_TRUE_ERROR', ]; - public $message = 'This value should be true.'; + public string $message = 'This value should be true.'; public function __construct(array $options = null, string $message = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/Isbn.php b/src/Symfony/Component/Validator/Constraints/Isbn.php index b8373f5912873..9b7c42ab8f412 100644 --- a/src/Symfony/Component/Validator/Constraints/Isbn.php +++ b/src/Symfony/Component/Validator/Constraints/Isbn.php @@ -38,11 +38,11 @@ class Isbn extends Constraint self::TYPE_NOT_RECOGNIZED_ERROR => 'TYPE_NOT_RECOGNIZED_ERROR', ]; - public $isbn10Message = 'This value is not a valid ISBN-10.'; - public $isbn13Message = 'This value is not a valid ISBN-13.'; - public $bothIsbnMessage = 'This value is neither a valid ISBN-10 nor a valid ISBN-13.'; - public $type; - public $message; + public string $isbn10Message = 'This value is not a valid ISBN-10.'; + public string $isbn13Message = 'This value is not a valid ISBN-13.'; + public string $bothIsbnMessage = 'This value is neither a valid ISBN-10 nor a valid ISBN-13.'; + public ?string $type = null; + public ?string $message = null; public function __construct( string|array $type = null, diff --git a/src/Symfony/Component/Validator/Constraints/Isin.php b/src/Symfony/Component/Validator/Constraints/Isin.php index b800dec86cdef..496e3d90363be 100644 --- a/src/Symfony/Component/Validator/Constraints/Isin.php +++ b/src/Symfony/Component/Validator/Constraints/Isin.php @@ -32,7 +32,7 @@ class Isin extends Constraint self::INVALID_CHECKSUM_ERROR => 'INVALID_CHECKSUM_ERROR', ]; - public $message = 'This value is not a valid International Securities Identification Number (ISIN).'; + public string $message = 'This value is not a valid International Securities Identification Number (ISIN).'; public function __construct(array $options = null, string $message = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/Issn.php b/src/Symfony/Component/Validator/Constraints/Issn.php index cafb242ec2d2e..d03b835c6efb4 100644 --- a/src/Symfony/Component/Validator/Constraints/Issn.php +++ b/src/Symfony/Component/Validator/Constraints/Issn.php @@ -36,9 +36,9 @@ class Issn extends Constraint self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', ]; - public $message = 'This value is not a valid ISSN.'; - public $caseSensitive = false; - public $requireHyphen = false; + public string $message = 'This value is not a valid ISSN.'; + public bool $caseSensitive = false; + public bool $requireHyphen = false; public function __construct( array $options = null, diff --git a/src/Symfony/Component/Validator/Constraints/Json.php b/src/Symfony/Component/Validator/Constraints/Json.php index 3ef40d94df7af..6656e4a5b6ad0 100644 --- a/src/Symfony/Component/Validator/Constraints/Json.php +++ b/src/Symfony/Component/Validator/Constraints/Json.php @@ -25,7 +25,7 @@ class Json extends Constraint self::INVALID_JSON_ERROR => 'INVALID_JSON_ERROR', ]; - public $message = 'This value should be valid JSON.'; + public string $message = 'This value should be valid JSON.'; public function __construct(array $options = null, string $message = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/Language.php b/src/Symfony/Component/Validator/Constraints/Language.php index 0ff135b2b85ef..fe38adcf83d3f 100644 --- a/src/Symfony/Component/Validator/Constraints/Language.php +++ b/src/Symfony/Component/Validator/Constraints/Language.php @@ -27,8 +27,8 @@ class Language extends Constraint self::NO_SUCH_LANGUAGE_ERROR => 'NO_SUCH_LANGUAGE_ERROR', ]; - public $message = 'This value is not a valid language.'; - public $alpha3 = false; + public string $message = 'This value is not a valid language.'; + public bool $alpha3 = false; public function __construct( array $options = null, diff --git a/src/Symfony/Component/Validator/Constraints/Length.php b/src/Symfony/Component/Validator/Constraints/Length.php index 607f7462e98fe..33d62fe94f8e4 100644 --- a/src/Symfony/Component/Validator/Constraints/Length.php +++ b/src/Symfony/Component/Validator/Constraints/Length.php @@ -43,13 +43,13 @@ class Length extends Constraint self::COUNT_GRAPHEMES, ]; - public $maxMessage = 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.'; - public $minMessage = 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.'; - public $exactMessage = 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.'; - public $charsetMessage = 'This value does not match the expected {{ charset }} charset.'; - public $max; - public $min; - public $charset = 'UTF-8'; + public string $maxMessage = 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.'; + public string $minMessage = 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.'; + public string $exactMessage = 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.'; + public string $charsetMessage = 'This value does not match the expected {{ charset }} charset.'; + public ?int $max = null; + public ?int $min = null; + public string $charset = 'UTF-8'; /** @var callable|null */ public $normalizer; /** @var self::COUNT_* */ diff --git a/src/Symfony/Component/Validator/Constraints/LessThan.php b/src/Symfony/Component/Validator/Constraints/LessThan.php index ef5dedc0e1a52..da07673f6fb2f 100644 --- a/src/Symfony/Component/Validator/Constraints/LessThan.php +++ b/src/Symfony/Component/Validator/Constraints/LessThan.php @@ -24,5 +24,5 @@ class LessThan extends AbstractComparison self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR', ]; - public $message = 'This value should be less than {{ compared_value }}.'; + public string $message = 'This value should be less than {{ compared_value }}.'; } diff --git a/src/Symfony/Component/Validator/Constraints/LessThanOrEqual.php b/src/Symfony/Component/Validator/Constraints/LessThanOrEqual.php index 0c2b5c851444b..4d838830f953d 100644 --- a/src/Symfony/Component/Validator/Constraints/LessThanOrEqual.php +++ b/src/Symfony/Component/Validator/Constraints/LessThanOrEqual.php @@ -24,5 +24,5 @@ class LessThanOrEqual extends AbstractComparison self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR', ]; - public $message = 'This value should be less than or equal to {{ compared_value }}.'; + public string $message = 'This value should be less than or equal to {{ compared_value }}.'; } diff --git a/src/Symfony/Component/Validator/Constraints/Locale.php b/src/Symfony/Component/Validator/Constraints/Locale.php index 43bd4127e4ecc..964c81da780f4 100644 --- a/src/Symfony/Component/Validator/Constraints/Locale.php +++ b/src/Symfony/Component/Validator/Constraints/Locale.php @@ -27,8 +27,8 @@ class Locale extends Constraint self::NO_SUCH_LOCALE_ERROR => 'NO_SUCH_LOCALE_ERROR', ]; - public $message = 'This value is not a valid locale.'; - public $canonicalize = true; + public string $message = 'This value is not a valid locale.'; + public bool $canonicalize = true; public function __construct( array $options = null, diff --git a/src/Symfony/Component/Validator/Constraints/Luhn.php b/src/Symfony/Component/Validator/Constraints/Luhn.php index 2fc5c8bc5bb66..f370067bd5109 100644 --- a/src/Symfony/Component/Validator/Constraints/Luhn.php +++ b/src/Symfony/Component/Validator/Constraints/Luhn.php @@ -31,7 +31,7 @@ class Luhn extends Constraint self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR', ]; - public $message = 'Invalid card number.'; + public string $message = 'Invalid card number.'; public function __construct( array $options = null, diff --git a/src/Symfony/Component/Validator/Constraints/Negative.php b/src/Symfony/Component/Validator/Constraints/Negative.php index 0a47120d3a844..eeb336ac12e5b 100644 --- a/src/Symfony/Component/Validator/Constraints/Negative.php +++ b/src/Symfony/Component/Validator/Constraints/Negative.php @@ -19,5 +19,5 @@ class Negative extends LessThan { use ZeroComparisonConstraintTrait; - public $message = 'This value should be negative.'; + public string $message = 'This value should be negative.'; } diff --git a/src/Symfony/Component/Validator/Constraints/NegativeOrZero.php b/src/Symfony/Component/Validator/Constraints/NegativeOrZero.php index 8161f3b022d2c..740e582ca46fc 100644 --- a/src/Symfony/Component/Validator/Constraints/NegativeOrZero.php +++ b/src/Symfony/Component/Validator/Constraints/NegativeOrZero.php @@ -19,5 +19,5 @@ class NegativeOrZero extends LessThanOrEqual { use ZeroComparisonConstraintTrait; - public $message = 'This value should be either negative or zero.'; + public string $message = 'This value should be either negative or zero.'; } diff --git a/src/Symfony/Component/Validator/Constraints/NotBlank.php b/src/Symfony/Component/Validator/Constraints/NotBlank.php index 8fad02082fe0a..fca14cf781aac 100644 --- a/src/Symfony/Component/Validator/Constraints/NotBlank.php +++ b/src/Symfony/Component/Validator/Constraints/NotBlank.php @@ -27,8 +27,8 @@ class NotBlank extends Constraint self::IS_BLANK_ERROR => 'IS_BLANK_ERROR', ]; - public $message = 'This value should not be blank.'; - public $allowNull = false; + public string $message = 'This value should not be blank.'; + public bool $allowNull = false; /** @var callable|null */ public $normalizer; diff --git a/src/Symfony/Component/Validator/Constraints/NotCompromisedPassword.php b/src/Symfony/Component/Validator/Constraints/NotCompromisedPassword.php index afd9571672f0a..2c3924e879814 100644 --- a/src/Symfony/Component/Validator/Constraints/NotCompromisedPassword.php +++ b/src/Symfony/Component/Validator/Constraints/NotCompromisedPassword.php @@ -27,9 +27,9 @@ class NotCompromisedPassword extends Constraint self::COMPROMISED_PASSWORD_ERROR => 'COMPROMISED_PASSWORD_ERROR', ]; - public $message = 'This password has been leaked in a data breach, it must not be used. Please use another password.'; - public $threshold = 1; - public $skipOnError = false; + public string $message = 'This password has been leaked in a data breach, it must not be used. Please use another password.'; + public int $threshold = 1; + public bool $skipOnError = false; public function __construct( array $options = null, diff --git a/src/Symfony/Component/Validator/Constraints/NotEqualTo.php b/src/Symfony/Component/Validator/Constraints/NotEqualTo.php index aad8beb1cf320..65967433fcf7b 100644 --- a/src/Symfony/Component/Validator/Constraints/NotEqualTo.php +++ b/src/Symfony/Component/Validator/Constraints/NotEqualTo.php @@ -24,5 +24,5 @@ class NotEqualTo extends AbstractComparison self::IS_EQUAL_ERROR => 'IS_EQUAL_ERROR', ]; - public $message = 'This value should not be equal to {{ compared_value }}.'; + public string $message = 'This value should not be equal to {{ compared_value }}.'; } diff --git a/src/Symfony/Component/Validator/Constraints/NotIdenticalTo.php b/src/Symfony/Component/Validator/Constraints/NotIdenticalTo.php index 7107c8b1ef068..c7500196e29a3 100644 --- a/src/Symfony/Component/Validator/Constraints/NotIdenticalTo.php +++ b/src/Symfony/Component/Validator/Constraints/NotIdenticalTo.php @@ -24,5 +24,5 @@ class NotIdenticalTo extends AbstractComparison self::IS_IDENTICAL_ERROR => 'IS_IDENTICAL_ERROR', ]; - public $message = 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.'; + public string $message = 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.'; } diff --git a/src/Symfony/Component/Validator/Constraints/NotNull.php b/src/Symfony/Component/Validator/Constraints/NotNull.php index 8b3ebc16c6792..14f82be19ff7e 100644 --- a/src/Symfony/Component/Validator/Constraints/NotNull.php +++ b/src/Symfony/Component/Validator/Constraints/NotNull.php @@ -25,7 +25,7 @@ class NotNull extends Constraint self::IS_NULL_ERROR => 'IS_NULL_ERROR', ]; - public $message = 'This value should not be null.'; + public string $message = 'This value should not be null.'; public function __construct(array $options = null, string $message = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/Positive.php b/src/Symfony/Component/Validator/Constraints/Positive.php index 5385dc50335f4..4f5e2da826f1c 100644 --- a/src/Symfony/Component/Validator/Constraints/Positive.php +++ b/src/Symfony/Component/Validator/Constraints/Positive.php @@ -19,5 +19,5 @@ class Positive extends GreaterThan { use ZeroComparisonConstraintTrait; - public $message = 'This value should be positive.'; + public string $message = 'This value should be positive.'; } diff --git a/src/Symfony/Component/Validator/Constraints/PositiveOrZero.php b/src/Symfony/Component/Validator/Constraints/PositiveOrZero.php index d73228193761f..2df48d3297706 100644 --- a/src/Symfony/Component/Validator/Constraints/PositiveOrZero.php +++ b/src/Symfony/Component/Validator/Constraints/PositiveOrZero.php @@ -19,5 +19,5 @@ class PositiveOrZero extends GreaterThanOrEqual { use ZeroComparisonConstraintTrait; - public $message = 'This value should be either positive or zero.'; + public string $message = 'This value should be either positive or zero.'; } diff --git a/src/Symfony/Component/Validator/Constraints/Range.php b/src/Symfony/Component/Validator/Constraints/Range.php index 97203957c94e1..8d8d1dfa86cb9 100644 --- a/src/Symfony/Component/Validator/Constraints/Range.php +++ b/src/Symfony/Component/Validator/Constraints/Range.php @@ -35,15 +35,15 @@ class Range extends Constraint self::TOO_LOW_ERROR => 'TOO_LOW_ERROR', ]; - public $notInRangeMessage = 'This value should be between {{ min }} and {{ max }}.'; - public $minMessage = 'This value should be {{ limit }} or more.'; - public $maxMessage = 'This value should be {{ limit }} or less.'; - public $invalidMessage = 'This value should be a valid number.'; - public $invalidDateTimeMessage = 'This value should be a valid datetime.'; - public $min; - public $minPropertyPath; - public $max; - public $maxPropertyPath; + public string $notInRangeMessage = 'This value should be between {{ min }} and {{ max }}.'; + public string $minMessage = 'This value should be {{ limit }} or more.'; + public string $maxMessage = 'This value should be {{ limit }} or less.'; + public string $invalidMessage = 'This value should be a valid number.'; + public string $invalidDateTimeMessage = 'This value should be a valid datetime.'; + public mixed $min = null; + public ?string $minPropertyPath = null; + public mixed $max = null; + public ?string $maxPropertyPath = null; public function __construct( array $options = null, diff --git a/src/Symfony/Component/Validator/Constraints/Regex.php b/src/Symfony/Component/Validator/Constraints/Regex.php index c98da744d3c00..53a525fa3b9b9 100644 --- a/src/Symfony/Component/Validator/Constraints/Regex.php +++ b/src/Symfony/Component/Validator/Constraints/Regex.php @@ -26,10 +26,10 @@ class Regex extends Constraint self::REGEX_FAILED_ERROR => 'REGEX_FAILED_ERROR', ]; - public $message = 'This value is not valid.'; - public $pattern; - public $htmlPattern; - public $match = true; + public string $message = 'This value is not valid.'; + public ?string $pattern = null; + public ?string $htmlPattern = null; + public bool $match = true; /** @var callable|null */ public $normalizer; diff --git a/src/Symfony/Component/Validator/Constraints/Sequentially.php b/src/Symfony/Component/Validator/Constraints/Sequentially.php index 0ee6fb1f17d99..4a57c98ab479f 100644 --- a/src/Symfony/Component/Validator/Constraints/Sequentially.php +++ b/src/Symfony/Component/Validator/Constraints/Sequentially.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\Constraint; + /** * Use this constraint to sequentially validate nested constraints. * Validation for the nested constraints collection will stop at first violation. @@ -20,7 +22,7 @@ #[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class Sequentially extends Composite { - public $constraints = []; + public array|Constraint $constraints = []; public function __construct(mixed $constraints = null, array $groups = null, mixed $payload = null) { diff --git a/src/Symfony/Component/Validator/Constraints/Time.php b/src/Symfony/Component/Validator/Constraints/Time.php index 35e2dcd6133ff..b78a7d3e98dea 100644 --- a/src/Symfony/Component/Validator/Constraints/Time.php +++ b/src/Symfony/Component/Validator/Constraints/Time.php @@ -27,7 +27,7 @@ class Time extends Constraint self::INVALID_TIME_ERROR => 'INVALID_TIME_ERROR', ]; - public $message = 'This value is not a valid time.'; + public string $message = 'This value is not a valid time.'; public function __construct( array $options = null, diff --git a/src/Symfony/Component/Validator/Constraints/Timezone.php b/src/Symfony/Component/Validator/Constraints/Timezone.php index 9c82c98b5ccdc..5fc5701cffd82 100644 --- a/src/Symfony/Component/Validator/Constraints/Timezone.php +++ b/src/Symfony/Component/Validator/Constraints/Timezone.php @@ -26,10 +26,10 @@ class Timezone extends Constraint public const TIMEZONE_IDENTIFIER_IN_COUNTRY_ERROR = 'c4a22222-dc92-4fc0-abb0-d95b268c7d0b'; public const TIMEZONE_IDENTIFIER_INTL_ERROR = '45863c26-88dc-41ba-bf53-c73bd1f7e90d'; - public $zone = \DateTimeZone::ALL; - public $countryCode; - public $intlCompatible = false; - public $message = 'This value is not a valid timezone.'; + public int $zone = \DateTimeZone::ALL; + public ?string $countryCode = null; + public bool $intlCompatible = false; + public string $message = 'This value is not a valid timezone.'; protected const ERROR_NAMES = [ self::TIMEZONE_IDENTIFIER_ERROR => 'TIMEZONE_IDENTIFIER_ERROR', diff --git a/src/Symfony/Component/Validator/Constraints/Traverse.php b/src/Symfony/Component/Validator/Constraints/Traverse.php index ab862cd79cf87..cac8f4b544c9c 100644 --- a/src/Symfony/Component/Validator/Constraints/Traverse.php +++ b/src/Symfony/Component/Validator/Constraints/Traverse.php @@ -20,7 +20,7 @@ #[\Attribute(\Attribute::TARGET_CLASS)] class Traverse extends Constraint { - public $traverse = true; + public bool $traverse = true; public function __construct(bool|array $traverse = null) { diff --git a/src/Symfony/Component/Validator/Constraints/Type.php b/src/Symfony/Component/Validator/Constraints/Type.php index eabb22d43604a..de94a458b7c31 100644 --- a/src/Symfony/Component/Validator/Constraints/Type.php +++ b/src/Symfony/Component/Validator/Constraints/Type.php @@ -25,8 +25,8 @@ class Type extends Constraint self::INVALID_TYPE_ERROR => 'INVALID_TYPE_ERROR', ]; - public $message = 'This value should be of type {{ type }}.'; - public $type; + public string $message = 'This value should be of type {{ type }}.'; + public string|array|null $type = null; public function __construct(string|array|null $type, string $message = null, array $groups = null, mixed $payload = null, array $options = []) { diff --git a/src/Symfony/Component/Validator/Constraints/Ulid.php b/src/Symfony/Component/Validator/Constraints/Ulid.php index 19055ee0a794d..bbee1417b334e 100644 --- a/src/Symfony/Component/Validator/Constraints/Ulid.php +++ b/src/Symfony/Component/Validator/Constraints/Ulid.php @@ -31,7 +31,7 @@ class Ulid extends Constraint self::TOO_LARGE_ERROR => 'TOO_LARGE_ERROR', ]; - public $message = 'This is not a valid ULID.'; + public string $message = 'This is not a valid ULID.'; public function __construct( array $options = null, diff --git a/src/Symfony/Component/Validator/Constraints/Unique.php b/src/Symfony/Component/Validator/Constraints/Unique.php index ae6fb286c046d..e80c2d3e85510 100644 --- a/src/Symfony/Component/Validator/Constraints/Unique.php +++ b/src/Symfony/Component/Validator/Constraints/Unique.php @@ -28,7 +28,7 @@ class Unique extends Constraint self::IS_NOT_UNIQUE => 'IS_NOT_UNIQUE', ]; - public $message = 'This collection should contain only unique elements.'; + public string $message = 'This collection should contain only unique elements.'; /** @var callable|null */ public $normalizer; diff --git a/src/Symfony/Component/Validator/Constraints/Url.php b/src/Symfony/Component/Validator/Constraints/Url.php index fb75b234b3ac0..65cbffc0ad136 100644 --- a/src/Symfony/Component/Validator/Constraints/Url.php +++ b/src/Symfony/Component/Validator/Constraints/Url.php @@ -26,9 +26,9 @@ class Url extends Constraint self::INVALID_URL_ERROR => 'INVALID_URL_ERROR', ]; - public $message = 'This value is not a valid URL.'; - public $protocols = ['http', 'https']; - public $relativeProtocol = false; + public string $message = 'This value is not a valid URL.'; + public array $protocols = ['http', 'https']; + public bool $relativeProtocol = false; /** @var callable|null */ public $normalizer; diff --git a/src/Symfony/Component/Validator/Constraints/Uuid.php b/src/Symfony/Component/Validator/Constraints/Uuid.php index f31b472f1c069..f497b00dc7df3 100644 --- a/src/Symfony/Component/Validator/Constraints/Uuid.php +++ b/src/Symfony/Component/Validator/Constraints/Uuid.php @@ -67,19 +67,15 @@ class Uuid extends Constraint /** * Message to display when validation fails. - * - * @var string */ - public $message = 'This is not a valid UUID.'; + public string $message = 'This is not a valid UUID.'; /** * Strict mode only allows UUIDs that meet the formal definition and formatting per RFC 4122. * * Set this to `false` to allow legacy formats with different dash positioning or wrapping characters - * - * @var bool */ - public $strict = true; + public bool $strict = true; /** * Array of allowed versions (see version constants above). @@ -88,7 +84,7 @@ class Uuid extends Constraint * * @var int[] */ - public $versions = self::ALL_VERSIONS; + public array $versions = self::ALL_VERSIONS; /** @var callable|null */ public $normalizer; diff --git a/src/Symfony/Component/Validator/Constraints/Valid.php b/src/Symfony/Component/Validator/Constraints/Valid.php index a924c304ed300..95422310a9570 100644 --- a/src/Symfony/Component/Validator/Constraints/Valid.php +++ b/src/Symfony/Component/Validator/Constraints/Valid.php @@ -19,7 +19,7 @@ #[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class Valid extends Constraint { - public $traverse = true; + public bool $traverse = true; public function __construct(array $options = null, array $groups = null, $payload = null, bool $traverse = null) { diff --git a/src/Symfony/Component/Validator/Constraints/When.php b/src/Symfony/Component/Validator/Constraints/When.php index a28ee8b4af16e..5dc9a8ed159bc 100644 --- a/src/Symfony/Component/Validator/Constraints/When.php +++ b/src/Symfony/Component/Validator/Constraints/When.php @@ -22,9 +22,9 @@ #[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class When extends Composite { - public $expression; - public $constraints = []; - public $values = []; + public string|Expression $expression; + public array|Constraint $constraints = []; + public array $values = []; public function __construct(string|Expression|array $expression, array|Constraint $constraints = null, array $values = null, array $groups = null, $payload = null, array $options = []) { diff --git a/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php b/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php index 565c04bd6b016..4c2998116056e 100644 --- a/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php +++ b/src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php @@ -39,15 +39,15 @@ */ class LazyLoadingMetadataFactory implements MetadataFactoryInterface { - protected $loader; - protected $cache; + protected ?LoaderInterface $loader; + protected ?CacheItemPoolInterface $cache; /** * The loaded metadata, indexed by class name. * * @var ClassMetadata[] */ - protected $loadedClasses = []; + protected array $loadedClasses = []; public function __construct(LoaderInterface $loader = null, CacheItemPoolInterface $cache = null) { diff --git a/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php index 30dfff3a28069..1d6ffb7889489 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/AbstractLoader.php @@ -33,7 +33,7 @@ abstract class AbstractLoader implements LoaderInterface */ public const DEFAULT_NAMESPACE = '\\Symfony\\Component\\Validator\\Constraints\\'; - protected $namespaces = []; + protected array $namespaces = []; /** * @var array diff --git a/src/Symfony/Component/Validator/Mapping/Loader/FileLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/FileLoader.php index 0fc01729884ca..9932ab244c107 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/FileLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/FileLoader.php @@ -23,7 +23,7 @@ */ abstract class FileLoader extends AbstractLoader { - protected $file; + protected string $file; /** * Creates a new loader. diff --git a/src/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php b/src/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php index d9721483af749..7a0cb8c473c84 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/LoaderChain.php @@ -25,7 +25,7 @@ */ class LoaderChain implements LoaderInterface { - protected $loaders; + protected array $loaders; /** * @param LoaderInterface[] $loaders The metadata loaders to use diff --git a/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php index 0d15e5f6ec557..d7548cd940042 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php @@ -21,7 +21,7 @@ */ class StaticMethodLoader implements LoaderInterface { - protected $methodName; + protected string $methodName; /** * Creates a new loader. diff --git a/src/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php index bf36b15f3712f..e5196e48d7c12 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php @@ -26,9 +26,9 @@ class XmlFileLoader extends FileLoader /** * The XML nodes of the mapping file. * - * @var \SimpleXMLElement[]|null + * @var \SimpleXMLElement[] */ - protected $classes; + protected array $classes; public function __construct(string $file) { diff --git a/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php index aa30b9542b8d6..8dfd6a84eadb0 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php @@ -24,12 +24,7 @@ */ class YamlFileLoader extends FileLoader { - /** - * An array of YAML class descriptions. - * - * @var array - */ - protected $classes; + protected array $classes; public function __construct(string $file) { diff --git a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php index 3a4437b1dbe79..f808e49ba26e9 100644 --- a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php @@ -30,6 +30,7 @@ use Symfony\Component\Validator\Context\ExecutionContext; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Mapping\MetadataInterface; use Symfony\Component\Validator\Mapping\PropertyMetadata; use Symfony\Component\Validator\Validator\ContextualValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; @@ -44,24 +45,22 @@ */ abstract class ConstraintValidatorTestCase extends TestCase { - /** - * @var ExecutionContextInterface - */ - protected $context; + protected ExecutionContextInterface $context; /** * @var T */ - protected $validator; - - protected $group; - protected $metadata; - protected $object; - protected $value; - protected $root; - protected $propertyPath; - protected $constraint; - protected $defaultTimezone; + protected ConstraintValidatorInterface $validator; + + protected string $group; + protected ?MetadataInterface $metadata; + protected mixed $object; + protected mixed $value; + protected mixed $root; + protected string $propertyPath; + protected Constraint $constraint; + protected ?string $defaultTimezone = null; + private string $defaultLocale; private array $expectedViolations; private int $call; diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php index a362e96ceec88..b1ed596734439 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php @@ -24,22 +24,6 @@ */ class CollectionTest extends TestCase { - public function testRejectInvalidFieldsOption() - { - $this->expectException(ConstraintDefinitionException::class); - new Collection([ - 'fields' => 'foo', - ]); - } - - public function testRejectNonConstraints() - { - $this->expectException(ConstraintDefinitionException::class); - new Collection([ - 'foo' => 'bar', - ]); - } - public function testRejectValidConstraint() { $this->expectException(ConstraintDefinitionException::class); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php index 3e646cfa39572..180b00cd3235e 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php @@ -264,66 +264,6 @@ public static function provideMaxPixelsConstraints(): iterable ]; } - public function testInvalidMinWidth() - { - $this->expectException(ConstraintDefinitionException::class); - $constraint = new Image([ - 'minWidth' => '1abc', - ]); - - $this->validator->validate($this->image, $constraint); - } - - public function testInvalidMaxWidth() - { - $this->expectException(ConstraintDefinitionException::class); - $constraint = new Image([ - 'maxWidth' => '1abc', - ]); - - $this->validator->validate($this->image, $constraint); - } - - public function testInvalidMinHeight() - { - $this->expectException(ConstraintDefinitionException::class); - $constraint = new Image([ - 'minHeight' => '1abc', - ]); - - $this->validator->validate($this->image, $constraint); - } - - public function testInvalidMaxHeight() - { - $this->expectException(ConstraintDefinitionException::class); - $constraint = new Image([ - 'maxHeight' => '1abc', - ]); - - $this->validator->validate($this->image, $constraint); - } - - public function testInvalidMinPixels() - { - $this->expectException(ConstraintDefinitionException::class); - $constraint = new Image([ - 'minPixels' => '1abc', - ]); - - $this->validator->validate($this->image, $constraint); - } - - public function testInvalidMaxPixels() - { - $this->expectException(ConstraintDefinitionException::class); - $constraint = new Image([ - 'maxPixels' => '1abc', - ]); - - $this->validator->validate($this->image, $constraint); - } - /** * @dataProvider provideMinRatioConstraints */ @@ -407,26 +347,6 @@ public function testMaxRatioUsesInputMoreDecimals() $this->assertNoViolation(); } - public function testInvalidMinRatio() - { - $this->expectException(ConstraintDefinitionException::class); - $constraint = new Image([ - 'minRatio' => '1abc', - ]); - - $this->validator->validate($this->image, $constraint); - } - - public function testInvalidMaxRatio() - { - $this->expectException(ConstraintDefinitionException::class); - $constraint = new Image([ - 'maxRatio' => '1abc', - ]); - - $this->validator->validate($this->image, $constraint); - } - /** * @dataProvider provideAllowSquareConstraints */ diff --git a/src/Symfony/Component/Validator/Validator/RecursiveValidator.php b/src/Symfony/Component/Validator/Validator/RecursiveValidator.php index a6897c85a735d..bd303eba1525c 100644 --- a/src/Symfony/Component/Validator/Validator/RecursiveValidator.php +++ b/src/Symfony/Component/Validator/Validator/RecursiveValidator.php @@ -28,10 +28,10 @@ */ class RecursiveValidator implements ValidatorInterface { - protected $contextFactory; - protected $metadataFactory; - protected $validatorFactory; - protected $objectInitializers; + protected ExecutionContextFactoryInterface $contextFactory; + protected MetadataFactoryInterface $metadataFactory; + protected ConstraintValidatorFactoryInterface $validatorFactory; + protected array $objectInitializers; /** * Creates a new validator. diff --git a/src/Symfony/Component/VarDumper/Caster/CutArrayStub.php b/src/Symfony/Component/VarDumper/Caster/CutArrayStub.php index 0e4fb363d2d41..5912e13d80466 100644 --- a/src/Symfony/Component/VarDumper/Caster/CutArrayStub.php +++ b/src/Symfony/Component/VarDumper/Caster/CutArrayStub.php @@ -18,7 +18,7 @@ */ class CutArrayStub extends CutStub { - public $preservedSubset; + public array $preservedSubset; public function __construct(array $value, array $preservedKeys) { diff --git a/src/Symfony/Component/VarDumper/Caster/EnumStub.php b/src/Symfony/Component/VarDumper/Caster/EnumStub.php index 7a4e98a21b4d1..02ed1745eabba 100644 --- a/src/Symfony/Component/VarDumper/Caster/EnumStub.php +++ b/src/Symfony/Component/VarDumper/Caster/EnumStub.php @@ -20,7 +20,7 @@ */ class EnumStub extends Stub { - public $dumpKeys = true; + public bool $dumpKeys = true; public function __construct(array $values, bool $dumpKeys = true) { diff --git a/src/Symfony/Component/VarDumper/Caster/FrameStub.php b/src/Symfony/Component/VarDumper/Caster/FrameStub.php index 878675528f7e7..9968c1101bbeb 100644 --- a/src/Symfony/Component/VarDumper/Caster/FrameStub.php +++ b/src/Symfony/Component/VarDumper/Caster/FrameStub.php @@ -18,8 +18,8 @@ */ class FrameStub extends EnumStub { - public $keepArgs; - public $inTraceStub; + public bool $keepArgs; + public bool $inTraceStub; public function __construct(array $frame, bool $keepArgs = true, bool $inTraceStub = false) { diff --git a/src/Symfony/Component/VarDumper/Caster/LinkStub.php b/src/Symfony/Component/VarDumper/Caster/LinkStub.php index df95f8b0efa78..b65038551255b 100644 --- a/src/Symfony/Component/VarDumper/Caster/LinkStub.php +++ b/src/Symfony/Component/VarDumper/Caster/LinkStub.php @@ -18,7 +18,7 @@ */ class LinkStub extends ConstStub { - public $inVendor = false; + public bool $inVendor = false; private static array $vendorRoots; private static array $composerRoots = []; diff --git a/src/Symfony/Component/VarDumper/Caster/TraceStub.php b/src/Symfony/Component/VarDumper/Caster/TraceStub.php index 5eea1c876680f..f28561fb5f275 100644 --- a/src/Symfony/Component/VarDumper/Caster/TraceStub.php +++ b/src/Symfony/Component/VarDumper/Caster/TraceStub.php @@ -20,10 +20,10 @@ */ class TraceStub extends Stub { - public $keepArgs; - public $sliceOffset; - public $sliceLength; - public $numberingOffset; + public bool $keepArgs; + public int $sliceOffset; + public ?int $sliceLength; + public int $numberingOffset; public function __construct(array $trace, bool $keepArgs = true, int $sliceOffset = 0, int $sliceLength = null, int $numberingOffset = 0) { diff --git a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php index 943cf672f2c22..4fbcc6228b661 100644 --- a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php @@ -21,7 +21,7 @@ */ abstract class AbstractCloner implements ClonerInterface { - public static $defaultCasters = [ + public static array $defaultCasters = [ '__PHP_Incomplete_Class' => ['Symfony\Component\VarDumper\Caster\Caster', 'castPhpIncompleteClass'], 'Symfony\Component\VarDumper\Caster\CutStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'], @@ -197,9 +197,9 @@ abstract class AbstractCloner implements ClonerInterface 'FFI\CType' => ['Symfony\Component\VarDumper\Caster\FFICaster', 'castCTypeOrCData'], ]; - protected $maxItems = 2500; - protected $maxString = -1; - protected $minDepth = 1; + protected int $maxItems = 2500; + protected int $maxString = -1; + protected int $minDepth = 1; /** * @var array> diff --git a/src/Symfony/Component/VarDumper/Cloner/Cursor.php b/src/Symfony/Component/VarDumper/Cloner/Cursor.php index 1fd796d675008..8923007fffba7 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Cursor.php +++ b/src/Symfony/Component/VarDumper/Cloner/Cursor.php @@ -23,21 +23,21 @@ class Cursor public const HASH_OBJECT = Stub::TYPE_OBJECT; public const HASH_RESOURCE = Stub::TYPE_RESOURCE; - public $depth = 0; - public $refIndex = 0; - public $softRefTo = 0; - public $softRefCount = 0; - public $softRefHandle = 0; - public $hardRefTo = 0; - public $hardRefCount = 0; - public $hardRefHandle = 0; - public $hashType; - public $hashKey; - public $hashKeyIsBinary; - public $hashIndex = 0; - public $hashLength = 0; - public $hashCut = 0; - public $stop = false; - public $attr = []; - public $skipChildren = false; + public int $depth = 0; + public int $refIndex = 0; + public int $softRefTo = 0; + public int $softRefCount = 0; + public int $softRefHandle = 0; + public int $hardRefTo = 0; + public int $hardRefCount = 0; + public int $hardRefHandle = 0; + public int $hashType; + public string|int|null $hashKey = null; + public bool $hashKeyIsBinary; + public int $hashIndex = 0; + public int $hashLength = 0; + public int $hashCut = 0; + public bool $stop = false; + public array $attr = []; + public bool $skipChildren = false; } diff --git a/src/Symfony/Component/VarDumper/Cloner/Stub.php b/src/Symfony/Component/VarDumper/Cloner/Stub.php index 0c2a4b9d0a5cf..43c64c0afe032 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Stub.php +++ b/src/Symfony/Component/VarDumper/Cloner/Stub.php @@ -31,14 +31,14 @@ class Stub public const ARRAY_ASSOC = 1; public const ARRAY_INDEXED = 2; - public $type = self::TYPE_REF; - public $class = ''; - public $value; - public $cut = 0; - public $handle = 0; - public $refCount = 0; - public $position = 0; - public $attr = []; + public int $type = self::TYPE_REF; + public string|int|null $class = ''; + public mixed $value; + public int $cut = 0; + public int $handle = 0; + public int $refCount = 0; + public int $position = 0; + public array $attr = []; private static array $defaultProperties = []; diff --git a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php index 549be0efb9f08..79d97666ca865 100644 --- a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php @@ -29,14 +29,14 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface /** @var callable|resource|string|null */ public static $defaultOutput = 'php://output'; - protected $line = ''; + protected string $line = ''; /** @var callable|null */ protected $lineDumper; /** @var resource|null */ protected $outputStream; - protected $decimalPoint = '.'; - protected $indentPad = ' '; - protected $flags; + protected string $decimalPoint = '.'; + protected string $indentPad = ' '; + protected int $flags; private string $charset = ''; diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index 3d4da312ed862..946468ef38666 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -21,13 +21,13 @@ */ class CliDumper extends AbstractDumper { - public static $defaultColors; + public static bool $defaultColors; /** @var callable|resource|string|null */ public static $defaultOutput = 'php://stdout'; - protected $colors; - protected $maxStringWidth = 0; - protected $styles = [ + protected bool $colors; + protected int $maxStringWidth = 0; + protected array $styles = [ // See http://en.wikipedia.org/wiki/ANSI_escape_code#graphics 'default' => '0;38;5;208', 'num' => '1;38;5;38', @@ -43,8 +43,8 @@ class CliDumper extends AbstractDumper 'index' => '38;5;38', ]; - protected static $controlCharsRx = '/[\x00-\x1F\x7F]+/'; - protected static $controlCharsMap = [ + protected static string $controlCharsRx = '/[\x00-\x1F\x7F]+/'; + protected static array $controlCharsMap = [ "\t" => '\t', "\n" => '\n', "\v" => '\v', @@ -52,10 +52,10 @@ class CliDumper extends AbstractDumper "\r" => '\r', "\033" => '\e', ]; - protected static $unicodeCharsRx = "/[\u{00A0}\u{00AD}\u{034F}\u{061C}\u{115F}\u{1160}\u{17B4}\u{17B5}\u{180E}\u{2000}-\u{200F}\u{202F}\u{205F}\u{2060}-\u{2064}\u{206A}-\u{206F}\u{3000}\u{2800}\u{3164}\u{FEFF}\u{FFA0}\u{1D159}\u{1D173}-\u{1D17A}]/u"; + protected static string $unicodeCharsRx = "/[\u{00A0}\u{00AD}\u{034F}\u{061C}\u{115F}\u{1160}\u{17B4}\u{17B5}\u{180E}\u{2000}-\u{200F}\u{202F}\u{205F}\u{2060}-\u{2064}\u{206A}-\u{206F}\u{3000}\u{2800}\u{3164}\u{FEFF}\u{FFA0}\u{1D159}\u{1D173}-\u{1D17A}]/u"; - protected $collapseNextHash = false; - protected $expandNextHash = false; + protected bool $collapseNextHash = false; + protected bool $expandNextHash = false; private array $displayOptions = [ 'fileLinkFormat' => null, diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index fe6fdecae9855..ab766516ddaab 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -59,14 +59,13 @@ class HtmlDumper extends CliDumper ], ]; - protected $dumpHeader; - protected $dumpPrefix = '
';
-    protected $dumpSuffix = '
'; - protected $dumpId = 'sf-dump'; - protected $colors = true; + protected ?string $dumpHeader = null; + protected string $dumpPrefix = '
';
+    protected string $dumpSuffix = '
'; + protected string $dumpId; + protected bool $colors = true; protected $headerIsDumped = false; - protected $lastDepth = -1; - protected $styles; + protected int $lastDepth = -1; private array $displayOptions = [ 'maxDepth' => 1, diff --git a/src/Symfony/Component/VarExporter/Internal/Hydrator.php b/src/Symfony/Component/VarExporter/Internal/Hydrator.php index 6d73bc40b3f33..86c03095b5a4f 100644 --- a/src/Symfony/Component/VarExporter/Internal/Hydrator.php +++ b/src/Symfony/Component/VarExporter/Internal/Hydrator.php @@ -24,19 +24,13 @@ class Hydrator public static array $simpleHydrators = []; public static array $propertyScopes = []; - public $registry; - public $values; - public $properties; - public $value; - public $wakeups; - - public function __construct(?Registry $registry, ?Values $values, array $properties, $value, array $wakeups) - { - $this->registry = $registry; - $this->values = $values; - $this->properties = $properties; - $this->value = $value; - $this->wakeups = $wakeups; + public function __construct( + public readonly Registry $registry, + public readonly ?Values $values, + public readonly array $properties, + public readonly mixed $value, + public readonly array $wakeups, + ) { } public static function hydrate($objects, $values, $properties, $value, $wakeups) diff --git a/src/Symfony/Component/VarExporter/Internal/Registry.php b/src/Symfony/Component/VarExporter/Internal/Registry.php index db05bbb852568..9c41684c16c6a 100644 --- a/src/Symfony/Component/VarExporter/Internal/Registry.php +++ b/src/Symfony/Component/VarExporter/Internal/Registry.php @@ -27,11 +27,9 @@ class Registry public static array $cloneable = []; public static array $instantiableWithoutConstructor = []; - public $classes = []; - - public function __construct(array $classes) - { - $this->classes = $classes; + public function __construct( + public readonly array $classes, + ) { } public static function unserialize($objects, $serializables) diff --git a/src/Symfony/Component/VarExporter/Internal/Values.php b/src/Symfony/Component/VarExporter/Internal/Values.php index 21ae04e68b10a..4f20a821c9113 100644 --- a/src/Symfony/Component/VarExporter/Internal/Values.php +++ b/src/Symfony/Component/VarExporter/Internal/Values.php @@ -18,10 +18,8 @@ */ class Values { - public $values; - - public function __construct(array $values) - { - $this->values = $values; + public function __construct( + public readonly array $values, + ) { } } diff --git a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php index 0521a14639c46..6a36ad8cb8eec 100644 --- a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php +++ b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php @@ -27,7 +27,7 @@ class GraphvizDumper implements DumperInterface { // All values should be strings - protected static $defaultOptions = [ + protected static array $defaultOptions = [ 'graph' => ['ratio' => 'compress', 'rankdir' => 'LR'], 'node' => ['fontsize' => '9', 'fontname' => 'Arial', 'color' => '#333333', 'fillcolor' => 'lightblue', 'fixedsize' => 'false', 'width' => '1'], 'edge' => ['fontsize' => '9', 'fontname' => 'Arial', 'color' => '#333333', 'arrowhead' => 'normal', 'arrowsize' => '0.5'], diff --git a/src/Symfony/Component/Workflow/Event/Event.php b/src/Symfony/Component/Workflow/Event/Event.php index 524c4f18b71d4..7bbdad25fad6d 100644 --- a/src/Symfony/Component/Workflow/Event/Event.php +++ b/src/Symfony/Component/Workflow/Event/Event.php @@ -23,7 +23,8 @@ */ class Event extends BaseEvent { - protected $context; + protected array $context; + private object $subject; private Marking $marking; private ?Transition $transition; diff --git a/src/Symfony/Contracts/Service/ServiceSubscriberTrait.php b/src/Symfony/Contracts/Service/ServiceSubscriberTrait.php index f3b450cd6caaa..7fad1e8f47b36 100644 --- a/src/Symfony/Contracts/Service/ServiceSubscriberTrait.php +++ b/src/Symfony/Contracts/Service/ServiceSubscriberTrait.php @@ -23,8 +23,7 @@ */ trait ServiceSubscriberTrait { - /** @var ContainerInterface */ - protected $container; + protected ContainerInterface $container; public static function getSubscribedServices(): array { diff --git a/src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php b/src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php index ba370265bac85..ebd8e4de9b632 100644 --- a/src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php +++ b/src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php @@ -141,8 +141,7 @@ class Service3 class ParentTestService2 { - /** @var ContainerInterface */ - protected $container; + protected ContainerInterface $container; public function setContainer(ContainerInterface $container) {