diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php index 6627630675b53..90d6ce8750887 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php @@ -50,7 +50,7 @@ public function configureOptions(OptionsResolver $resolver) * * @return ORMQueryBuilderLoader */ - public function getLoader(ObjectManager $manager, $queryBuilder, string $class) + public function getLoader(ObjectManager $manager, object $queryBuilder, string $class) { if (!$queryBuilder instanceof QueryBuilder) { throw new \TypeError(sprintf('Expected an instance of "%s", but got "%s".', QueryBuilder::class, get_debug_type($queryBuilder))); @@ -76,7 +76,7 @@ public function getBlockPrefix() * @internal This method is public to be usable as callback. It should not * be used in user code. */ - public function getQueryBuilderPartsForCachingHash($queryBuilder): ?array + public function getQueryBuilderPartsForCachingHash(object $queryBuilder): ?array { if (!$queryBuilder instanceof QueryBuilder) { throw new \TypeError(sprintf('Expected an instance of "%s", but got "%s".', QueryBuilder::class, get_debug_type($queryBuilder))); diff --git a/src/Symfony/Bridge/Twig/Node/DumpNode.php b/src/Symfony/Bridge/Twig/Node/DumpNode.php index 16718e8a75986..68c00556f86bf 100644 --- a/src/Symfony/Bridge/Twig/Node/DumpNode.php +++ b/src/Symfony/Bridge/Twig/Node/DumpNode.php @@ -21,7 +21,7 @@ final class DumpNode extends Node { private $varPrefix; - public function __construct($varPrefix, ?Node $values, int $lineno, string $tag = null) + public function __construct(string $varPrefix, ?Node $values, int $lineno, string $tag = null) { $nodes = []; if (null !== $values) { diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/CachePoolClearerCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/CachePoolClearerCacheWarmer.php index fa87952621c87..0e5997996004f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/CachePoolClearerCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/CachePoolClearerCacheWarmer.php @@ -39,7 +39,7 @@ public function __construct(Psr6CacheClearer $poolClearer, array $pools = []) * * @return string[] */ - public function warmUp($cacheDirectory): array + public function warmUp(string $cacheDirectory): array { foreach ($this->pools as $pool) { if ($this->poolClearer->hasPool($pool)) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index 0ce23600686dc..490d8cbb61f3e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -109,7 +109,7 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI /** * {@inheritdoc} */ - public function find($name) + public function find(string $name) { $this->registerCommands(); @@ -119,7 +119,7 @@ public function find($name) /** * {@inheritdoc} */ - public function get($name) + public function get(string $name) { $this->registerCommands(); @@ -135,7 +135,7 @@ public function get($name) /** * {@inheritdoc} */ - public function all($namespace = null) + public function all(string $namespace = null) { $this->registerCommands(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php index 72116ef4022ad..6d8f036c5572b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php @@ -113,7 +113,7 @@ abstract protected function describeContainerTags(ContainerBuilder $builder, arr * * @param Definition|Alias|object $service */ - abstract protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null); + abstract protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null); /** * Describes container services. diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php index ce4e66ca04541..db21717548ab5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php @@ -67,7 +67,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio $this->writeData($data, $options); } - protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null) + protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null) { if (!isset($options['id'])) { throw new \InvalidArgumentException('An "id" option must be provided.'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php index 96170d32ad1b6..fb768e50e2448 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php @@ -88,7 +88,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio } } - protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null) + protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null) { if (!isset($options['id'])) { throw new \InvalidArgumentException('An "id" option must be provided.'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index adc524ce6202b..66a4fafff2dae 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -141,7 +141,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio } } - protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null) + protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null) { if (!isset($options['id'])) { throw new \InvalidArgumentException('An "id" option must be provided.'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php index 9d52aa2e19b33..e255bae4a92d7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php @@ -53,7 +53,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio $this->writeDocument($this->getContainerTagsDocument($builder, isset($options['show_hidden']) && $options['show_hidden'])); } - protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null) + protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null) { if (!isset($options['id'])) { throw new \InvalidArgumentException('An "id" option must be provided.'); @@ -255,7 +255,7 @@ private function getContainerTagsDocument(ContainerBuilder $builder, bool $showH return $dom; } - private function getContainerServiceDocument($service, string $id, ContainerBuilder $builder = null, bool $showArguments = false): \DOMDocument + private function getContainerServiceDocument(object $service, string $id, ContainerBuilder $builder = null, bool $showArguments = false): \DOMDocument { $dom = new \DOMDocument('1.0', 'UTF-8'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php index 61049b607a288..0caa8e62df363 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php @@ -396,7 +396,7 @@ protected function isCsrfTokenValid(string $id, ?string $token): bool * * @param object|Envelope $message The message or the message pre-wrapped in an envelope */ - protected function dispatchMessage($message, array $stamps = []): Envelope + protected function dispatchMessage(object $message, array $stamps = []): Envelope { if (!$this->container->has('messenger.default_bus')) { $message = class_exists(Envelope::class) ? 'You need to define the "messenger.default_bus" configuration option.' : 'Try running "composer require symfony/messenger".'; diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php index b726ca48e100a..0539c1ee734ca 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php @@ -24,7 +24,7 @@ class ControllerResolver extends ContainerControllerResolver /** * {@inheritdoc} */ - protected function instantiateController($class): object + protected function instantiateController(string $class): object { $controller = parent::instantiateController($class); diff --git a/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php b/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php index 4a7d72213c8b9..2c2f8b5c4a358 100644 --- a/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php +++ b/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php @@ -112,7 +112,7 @@ public function enableReboot() /** * @param UserInterface $user */ - public function loginUser($user, string $firewallContext = 'main'): self + public function loginUser(object $user, string $firewallContext = 'main'): self { if (!interface_exists(UserInterface::class)) { throw new \LogicException(sprintf('"%s" requires symfony/security-core to be installed.', __METHOD__)); diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php b/src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php index 6e5a71b8fadfd..e708b70ca712e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php @@ -24,10 +24,8 @@ class AnnotatedRouteControllerLoader extends AnnotationClassLoader { /** * Configures the _controller default parameter of a given Route instance. - * - * @param object $annot The annotation class instance */ - protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot) + protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot) { if ('__invoke' === $method->getName()) { $route->setDefault('_controller', $class->getName()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php b/src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php index 48f2b68e11e32..3874d78538f53 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php @@ -112,7 +112,7 @@ public static function assertRequestAttributeValueSame(string $name, string $exp self::assertThat(self::getRequest(), new ResponseConstraint\RequestAttributeValueSame($name, $expectedValue), $message); } - public static function assertRouteSame($expectedRoute, array $parameters = [], string $message = ''): void + public static function assertRouteSame(string $expectedRoute, array $parameters = [], string $message = ''): void { $constraint = new ResponseConstraint\RequestAttributeValueSame('_route', $expectedRoute); $constraints = []; diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginFactory.php index 393c553907364..7458a35b0e6be 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginFactory.php @@ -75,7 +75,7 @@ protected function getListenerId() /** * {@inheritdoc} */ - protected function isRememberMeAware($config) + protected function isRememberMeAware(array $config) { return false; } diff --git a/src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php b/src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php index dca8ccde565c1..1a78dd2f4aa72 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php +++ b/src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php @@ -29,7 +29,7 @@ final class FirewallConfig private $listeners; private $switchUser; - public function __construct(string $name, string $userChecker, string $requestMatcher = null, bool $securityEnabled = true, bool $stateless = false, string $provider = null, string $context = null, string $entryPoint = null, string $accessDeniedHandler = null, string $accessDeniedUrl = null, array $listeners = [], $switchUser = null) + public function __construct(string $name, string $userChecker, string $requestMatcher = null, bool $securityEnabled = true, bool $stateless = false, string $provider = null, string $context = null, string $entryPoint = null, string $accessDeniedHandler = null, string $accessDeniedUrl = null, array $listeners = [], array $switchUser = null) { $this->name = $name; $this->userChecker = $userChecker; diff --git a/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php b/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php index a6b34e26ef547..c2af599cff3fe 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php @@ -235,7 +235,7 @@ private function hasHashOrNonce(array $directives): bool return false; } - private function getDirectiveFallback(array $directiveSet, $type) + private function getDirectiveFallback(array $directiveSet, string $type) { if (\in_array($type, ['script-src-elem', 'style-src-elem'], true) || !isset($directiveSet['default-src'])) { // Let the browser fallback on it's own diff --git a/src/Symfony/Component/BrowserKit/Tests/TestClient.php b/src/Symfony/Component/BrowserKit/Tests/TestClient.php index 64e4937ea58fb..bad2d47e22e32 100644 --- a/src/Symfony/Component/BrowserKit/Tests/TestClient.php +++ b/src/Symfony/Component/BrowserKit/Tests/TestClient.php @@ -24,12 +24,12 @@ public function setNextResponse(Response $response) $this->nextResponse = $response; } - public function setNextScript($script) + public function setNextScript(string $script) { $this->nextScript = $script; } - protected function doRequest($request): Response + protected function doRequest(object $request): Response { if (null === $this->nextResponse) { return new Response(); @@ -41,7 +41,7 @@ protected function doRequest($request): Response return $response; } - protected function getScript($request) + protected function getScript(object $request) { $r = new \ReflectionClass(Response::class); $path = $r->getFileName(); diff --git a/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php b/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php index 377f5dc1896db..184418b7b4477 100644 --- a/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php +++ b/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php @@ -47,12 +47,12 @@ public function setNextResponse(Response $response) $this->nextResponse = $response; } - public function setNextScript($script) + public function setNextScript(string $script) { $this->nextScript = $script; } - protected function doRequest($request): Response + protected function doRequest(object $request): Response { if (null === $this->nextResponse) { return parent::doRequest($request); @@ -64,7 +64,7 @@ protected function doRequest($request): Response return $response; } - protected function getScript($request) + protected function getScript(object $request) { $r = new \ReflectionClass(Response::class); $path = $r->getFileName(); diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index d7930b2325828..4571749fe5f9b 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -32,9 +32,9 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface protected $removeExtraKeys = true; protected $normalizeKeys = true; - public function setNormalizeKeys($normalizeKeys) + public function setNormalizeKeys(bool $normalizeKeys) { - $this->normalizeKeys = (bool) $normalizeKeys; + $this->normalizeKeys = $normalizeKeys; } /** diff --git a/src/Symfony/Component/Config/Definition/BaseNode.php b/src/Symfony/Component/Config/Definition/BaseNode.php index db1955e96a5e4..5526697b0a151 100644 --- a/src/Symfony/Component/Config/Definition/BaseNode.php +++ b/src/Symfony/Component/Config/Definition/BaseNode.php @@ -187,8 +187,6 @@ public function addEquivalentValue($originalValue, $equivalentValue) /** * Set this node as required. - * - * @param bool $boolean Required node */ public function setRequired(bool $boolean) { diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php index 0d9c91fea4667..cee551b422ed3 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php @@ -105,8 +105,6 @@ public function end() /** * Creates the node. * - * @param bool $forceRootNode Whether to force this node as the root node - * * @return NodeInterface */ public function getNode(bool $forceRootNode = false) diff --git a/src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php b/src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php index fcaaf49435f9d..ceb5e239bf017 100644 --- a/src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php +++ b/src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php @@ -22,7 +22,7 @@ class InvalidConfigurationException extends Exception private $path; private $containsHints = false; - public function setPath($path) + public function setPath(string $path) { $this->path = $path; } diff --git a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php index 190ab991acd3d..d47370132e63d 100644 --- a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php +++ b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php @@ -181,7 +181,7 @@ private function safelyUnserialize(string $file) /** * @internal */ - public static function handleUnserializeCallback($class) + public static function handleUnserializeCallback(string $class) { trigger_error('Class not found: '.$class); } diff --git a/src/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php index b02d6ce6df2d4..e68d9a68a8703 100644 --- a/src/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php @@ -264,7 +264,7 @@ protected function getPrototypeNodeWithDefaultChildren() * * @dataProvider getDataForKeyRemovedLeftValueOnly */ - public function testMappedAttributeKeyIsRemovedLeftValueOnly($value, $children, array $expected) + public function testMappedAttributeKeyIsRemovedLeftValueOnly($value, array $children, array $expected) { $node = new PrototypedArrayNode('root'); $node->setKeyAttribute('id', true); diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php b/src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php index cb5106844324c..df1bcd45374d4 100644 --- a/src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php +++ b/src/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php @@ -16,7 +16,7 @@ class NodeBuilder extends BaseNodeBuilder { - public function barNode($name): NodeDefinition + public function barNode(?string $name): NodeDefinition { return $this->node($name, 'bar'); } diff --git a/src/Symfony/Component/Config/Tests/Resource/ResourceStub.php b/src/Symfony/Component/Config/Tests/Resource/ResourceStub.php index 4073566d19f2a..3cf8cfdbfa3dc 100644 --- a/src/Symfony/Component/Config/Tests/Resource/ResourceStub.php +++ b/src/Symfony/Component/Config/Tests/Resource/ResourceStub.php @@ -27,7 +27,7 @@ public function __toString(): string return 'stub'; } - public function isFresh($timestamp): bool + public function isFresh(int $timestamp): bool { return $this->fresh; } diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php index a7a8ae980d597..c845c76ed3ced 100644 --- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php +++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php @@ -150,7 +150,7 @@ public function getDataForConvertDomToArray(): array /** * @dataProvider getDataForPhpize */ - public function testPhpize($expected, $value) + public function testPhpize($expected, string $value) { $this->assertSame($expected, XmlUtils::phpize($value)); } diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index 5eb8bf10fd158..eeeea038a4d51 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -376,7 +376,7 @@ public function getNativeDefinition() * Adds an argument. * * @param int|null $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL - * @param mixed $default The default value (for InputArgument::OPTIONAL mode only) + * @param mixed $default The default value (for InputArgument::OPTIONAL mode only) * * @throws InvalidArgumentException When argument mode is not valid * diff --git a/src/Symfony/Component/Console/Descriptor/Descriptor.php b/src/Symfony/Component/Console/Descriptor/Descriptor.php index 2ecc59e4e27e4..a3648301fec88 100644 --- a/src/Symfony/Component/Console/Descriptor/Descriptor.php +++ b/src/Symfony/Component/Console/Descriptor/Descriptor.php @@ -34,7 +34,7 @@ abstract class Descriptor implements DescriptorInterface /** * {@inheritdoc} */ - public function describe(OutputInterface $output, $object, array $options = []) + public function describe(OutputInterface $output, object $object, array $options = []) { $this->output = $output; diff --git a/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php index 3748335ea388e..4f0df65197f0a 100644 --- a/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php @@ -31,7 +31,7 @@ class MarkdownDescriptor extends Descriptor /** * {@inheritdoc} */ - public function describe(OutputInterface $output, $object, array $options = []) + public function describe(OutputInterface $output, object $object, array $options = []) { $decorated = $output->isDecorated(); $output->setDecorated(false); diff --git a/src/Symfony/Component/Console/Input/InputOption.php b/src/Symfony/Component/Console/Input/InputOption.php index 2bb86cd2b0701..1bba552e32bf0 100644 --- a/src/Symfony/Component/Console/Input/InputOption.php +++ b/src/Symfony/Component/Console/Input/InputOption.php @@ -48,11 +48,9 @@ class InputOption private $description; /** - * @param string $name The option name - * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param int|null $mode The option mode: One of the VALUE_* constants - * @param string $description A description text - * @param mixed $default The default value (must be null for self::VALUE_NONE) + * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the VALUE_* constants + * @param mixed $default The default value (must be null for self::VALUE_NONE) * * @throws InvalidArgumentException If option mode is invalid or incompatible */ diff --git a/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php b/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php index c19edbf95e9d7..ec9fece860813 100644 --- a/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php +++ b/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php @@ -92,7 +92,7 @@ public function addContent(string $input) /** * {@inheritdoc} */ - protected function doWrite($message, $newline) + protected function doWrite(string $message, bool $newline) { if (!$this->isDecorated()) { parent::doWrite($message, $newline); diff --git a/src/Symfony/Component/Console/Output/TrimmedBufferOutput.php b/src/Symfony/Component/Console/Output/TrimmedBufferOutput.php index a03aa835f0086..370f9888d7dd8 100644 --- a/src/Symfony/Component/Console/Output/TrimmedBufferOutput.php +++ b/src/Symfony/Component/Console/Output/TrimmedBufferOutput.php @@ -54,7 +54,7 @@ public function fetch() /** * {@inheritdoc} */ - protected function doWrite($message, $newline) + protected function doWrite(string $message, bool $newline) { $this->buffer .= $message; diff --git a/src/Symfony/Component/Console/Question/Question.php b/src/Symfony/Component/Console/Question/Question.php index 0b5eefd546e54..85613fc6eea63 100644 --- a/src/Symfony/Component/Console/Question/Question.php +++ b/src/Symfony/Component/Console/Question/Question.php @@ -95,13 +95,11 @@ public function isHidden() /** * Sets whether the user response must be hidden or not. * - * @param bool $hidden - * * @return $this * * @throws LogicException In case the autocompleter is also used */ - public function setHidden($hidden) + public function setHidden(bool $hidden) { if ($this->autocompleterCallback) { throw new LogicException('A hidden question cannot use the autocompleter.'); @@ -125,11 +123,9 @@ public function isHiddenFallback() /** * Sets whether to fallback on non-hidden question if the response can not be hidden. * - * @param bool $fallback - * * @return $this */ - public function setHiddenFallback($fallback) + public function setHiddenFallback(bool $fallback) { $this->hiddenFallback = (bool) $fallback; diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index 4fa6650756df6..668288f5cec3b 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -264,7 +264,7 @@ public function definitionList(...$list) /** * {@inheritdoc} */ - public function ask(string $question, string $default = null, $validator = null) + public function ask(string $question, string $default = null, callable $validator = null) { $question = new Question($question, $default); $question->setValidator($validator); @@ -275,7 +275,7 @@ public function ask(string $question, string $default = null, $validator = null) /** * {@inheritdoc} */ - public function askHidden(string $question, $validator = null) + public function askHidden(string $question, callable $validator = null) { $question = new Question($question); diff --git a/src/Symfony/Component/CssSelector/XPath/Translator.php b/src/Symfony/Component/CssSelector/XPath/Translator.php index 13e1adacd583e..3fab76ad699a7 100644 --- a/src/Symfony/Component/CssSelector/XPath/Translator.php +++ b/src/Symfony/Component/CssSelector/XPath/Translator.php @@ -203,7 +203,7 @@ public function addPseudoClass(XPathExpr $xpath, string $pseudoClass): XPathExpr /** * @throws ExpressionErrorException */ - public function addAttributeMatching(XPathExpr $xpath, string $operator, string $attribute, $value): XPathExpr + public function addAttributeMatching(XPathExpr $xpath, string $operator, string $attribute, ?string $value): XPathExpr { if (!isset($this->attributeMatchingTranslators[$operator])) { throw new ExpressionErrorException(sprintf('Attribute matcher operator "%s" not supported.', $operator)); diff --git a/src/Symfony/Component/DependencyInjection/ChildDefinition.php b/src/Symfony/Component/DependencyInjection/ChildDefinition.php index c8f88be3e64c9..d51fdd2ef69e8 100644 --- a/src/Symfony/Component/DependencyInjection/ChildDefinition.php +++ b/src/Symfony/Component/DependencyInjection/ChildDefinition.php @@ -44,11 +44,9 @@ public function getParent() /** * Sets the Definition to inherit from. * - * @param string $parent - * * @return $this */ - public function setParent($parent) + public function setParent(string $parent) { $this->parent = $parent; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php index 308abc656611d..1225514c24f21 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php @@ -12,6 +12,7 @@ namespace Symfony\Component\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Reference; /** * This is a directed graph of your services. @@ -73,7 +74,7 @@ public function clear() /** * Connects 2 nodes together in the Graph. */ - public function connect(?string $sourceId, $sourceValue, ?string $destId, $destValue = null, $reference = null, bool $lazy = false, bool $weak = false, bool $byConstructor = false) + public function connect(?string $sourceId, $sourceValue, ?string $destId, $destValue = null, Reference $reference = null, bool $lazy = false, bool $weak = false, bool $byConstructor = false) { if (null === $sourceId || null === $destId) { return; diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 4c6482063c206..4554e3bce8855 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -107,8 +107,6 @@ public function getParameterBag() /** * Gets a parameter. * - * @param string $name The parameter name - * * @return mixed * * @throws InvalidArgumentException if the parameter is not defined @@ -119,10 +117,6 @@ public function getParameter(string $name) } /** - * Checks if a parameter exists. - * - * @param string $name The parameter name - * * @return bool The presence of parameter in container */ public function hasParameter(string $name) @@ -210,9 +204,6 @@ public function has($id) /** * Gets a service. * - * @param string $id The service identifier - * @param int $invalidBehavior The behavior when the service does not exist - * * @return object|null The associated service * * @throws ServiceCircularReferenceException When a circular reference is detected @@ -286,8 +277,6 @@ private function make(string $id, int $invalidBehavior) /** * Returns true if the given service has actually been initialized. * - * @param string $id The service identifier - * * @return bool true if service has already been initialized, false otherwise */ public function initialized(string $id) @@ -345,11 +334,9 @@ public function getRemovedIds() /** * Camelizes a string. * - * @param string $id A string to camelize - * * @return string The camelized string */ - public static function camelize($id) + public static function camelize(string $id) { return strtr(ucwords(strtr($id, ['_' => ' ', '.' => '_ ', '\\' => '_ '])), [' ' => '']); } @@ -357,11 +344,9 @@ public static function camelize($id) /** * A string to underscore. * - * @param string $id The string to underscore - * * @return string The underscored string */ - public static function underscore($id) + public static function underscore(string $id) { return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], str_replace('_', '.', $id))); } @@ -369,7 +354,7 @@ public static function underscore($id) /** * Creates a service by requiring its factory file. */ - protected function load($file) + protected function load(string $file) { return require $file; } @@ -377,13 +362,11 @@ protected function load($file) /** * Fetches a variable from the environment. * - * @param string $name The name of the environment variable - * * @return mixed The value to use for the provided environment variable name * * @throws EnvNotFoundException When the environment variable is not found and has no default value */ - protected function getEnv($name) + protected function getEnv(string $name) { if (isset($this->resolving[$envName = "env($name)"])) { throw new ParameterCircularReferenceException(array_keys($this->resolving)); diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index bf79613b731a8..98c4b52d6f43c 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -519,11 +519,6 @@ public function has($id) } /** - * Gets a service. - * - * @param string $id The service identifier - * @param int $invalidBehavior The behavior when the service does not exist - * * @return object|null The associated service * * @throws InvalidArgumentException when no definitions are available @@ -829,11 +824,6 @@ public function setAlias(string $alias, $id) return $this->aliasDefinitions[$alias] = $id; } - /** - * Removes an alias. - * - * @param string $alias The alias to remove - */ public function removeAlias(string $alias) { if (isset($this->aliasDefinitions[$alias])) { @@ -843,8 +833,6 @@ public function removeAlias(string $alias) } /** - * Returns true if an alias exists under the given identifier. - * * @return bool true if the alias exists, false otherwise */ public function hasAlias(string $id) @@ -861,8 +849,6 @@ public function getAliases() } /** - * Gets an alias. - * * @return Alias An Alias instance * * @throws InvalidArgumentException if the alias does not exist @@ -1520,7 +1506,7 @@ public static function hash($value) /** * {@inheritdoc} */ - protected function getEnv($name) + protected function getEnv(string $name) { $value = parent::getEnv($name); $bag = $this->getParameterBag(); @@ -1549,7 +1535,7 @@ protected function getEnv($name) } } - private function callMethod($service, array $call, array &$inlineServices) + private function callMethod(object $service, array $call, array &$inlineServices) { foreach (self::getServiceConditionals($call[1]) as $s) { if (!$this->has($s)) { diff --git a/src/Symfony/Component/DependencyInjection/ContainerInterface.php b/src/Symfony/Component/DependencyInjection/ContainerInterface.php index 657c9c1ae11ea..2135dcdd3671c 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerInterface.php +++ b/src/Symfony/Component/DependencyInjection/ContainerInterface.php @@ -65,22 +65,14 @@ public function has($id); public function initialized(string $id); /** - * Gets a parameter. - * - * @param string $name The parameter name - * - * @return mixed The parameter value + * @return mixed * * @throws InvalidArgumentException if the parameter is not defined */ public function getParameter(string $name); /** - * Checks if a parameter exists. - * - * @param string $name The parameter name - * - * @return bool The presence of parameter in container + * @return bool */ public function hasParameter(string $name); diff --git a/src/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php b/src/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php index 8af993b8a4898..5d38310141d1b 100644 --- a/src/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php +++ b/src/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php @@ -84,14 +84,14 @@ public function getSourceKey() return $this->sourceKey; } - public function setSourceId($sourceId) + public function setSourceId(?string $sourceId) { $this->sourceId = $sourceId; $this->updateRepr(); } - public function setSourceKey($sourceKey) + public function setSourceKey(?string $sourceKey) { $this->sourceKey = $sourceKey; diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index ef13cd989dd38..a874715f9da31 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -716,13 +716,11 @@ private function parseCallable($callable, string $parameter, string $id, string /** * Loads a YAML file. * - * @param string $file - * * @return array The file content * * @throws InvalidArgumentException when the given file is not a local file or when it does not exist */ - protected function loadFile($file) + protected function loadFile(string $file) { if (!class_exists(\Symfony\Component\Yaml\Parser::class)) { throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.'); diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 79fae3eac8e63..ce409e7c54ef8 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -1094,11 +1094,9 @@ public function getIterator() } /** - * @param \DOMElement $node - * * @return array */ - protected function sibling($node, string $siblingDir = 'nextSibling') + protected function sibling(\DOMNode $node, string $siblingDir = 'nextSibling') { $nodes = []; diff --git a/src/Symfony/Component/Dotenv/Dotenv.php b/src/Symfony/Component/Dotenv/Dotenv.php index ba560032a6eb1..ade7fa5978a0b 100644 --- a/src/Symfony/Component/Dotenv/Dotenv.php +++ b/src/Symfony/Component/Dotenv/Dotenv.php @@ -71,7 +71,7 @@ public function setProdEnvs(array $prodEnvs): self * * @return $this */ - public function usePutenv($usePutenv = true): self + public function usePutenv(bool $usePutenv = true): self { $this->usePutenv = $usePutenv; diff --git a/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php b/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php index 4ba3d9440328d..bcb31b0f6af65 100644 --- a/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php +++ b/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php @@ -63,7 +63,7 @@ class FlattenException /** * @return static */ - public static function create(\Exception $exception, $statusCode = null, array $headers = []): self + public static function create(\Exception $exception, int $statusCode = null, array $headers = []): self { return static::createFromThrowable($exception, $statusCode, $headers); } @@ -131,11 +131,9 @@ public function getStatusCode(): int } /** - * @param int $code - * * @return $this */ - public function setStatusCode($code): self + public function setStatusCode(int $code): self { $this->statusCode = $code; @@ -163,11 +161,9 @@ public function getClass(): string } /** - * @param string $class - * * @return $this */ - public function setClass($class): self + public function setClass(string $class): self { $this->class = false !== strpos($class, "@anonymous\0") ? (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous' : $class; @@ -180,11 +176,9 @@ public function getFile(): string } /** - * @param string $file - * * @return $this */ - public function setFile($file): self + public function setFile(string $file): self { $this->file = $file; @@ -197,11 +191,9 @@ public function getLine(): int } /** - * @param int $line - * * @return $this */ - public function setLine($line): self + public function setLine(int $line): self { $this->line = $line; @@ -226,11 +218,9 @@ public function getMessage(): string } /** - * @param string $message - * * @return $this */ - public function setMessage($message): self + public function setMessage(string $message): self { if (false !== strpos($message, "@anonymous\0")) { $message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) { @@ -308,13 +298,10 @@ public function setTraceFromThrowable(\Throwable $throwable): self } /** - * @param array $trace - * @param string|null $file - * @param int|null $line * * @return $this */ - public function setTrace($trace, $file, $line): self + public function setTrace(array $trace, ?string $file, ?int $line): self { $this->trace = []; $this->trace[] = [ diff --git a/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php b/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php index 88c707c9a360b..9251e02e67ea8 100644 --- a/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php +++ b/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php @@ -25,11 +25,10 @@ interface EventDispatcherInterface extends ContractsEventDispatcherInterface /** * Adds an event listener that listens on the specified events. * - * @param callable $listener The listener - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) + * @param int $priority The higher this value, the earlier an event + * listener will be triggered in the chain (defaults to 0) */ - public function addListener(string $eventName, $listener, int $priority = 0); + public function addListener(string $eventName, callable $listener, int $priority = 0); /** * Adds an event subscriber. @@ -41,10 +40,8 @@ public function addSubscriber(EventSubscriberInterface $subscriber); /** * Removes an event listener from the specified events. - * - * @param callable $listener The listener to remove */ - public function removeListener(string $eventName, $listener); + public function removeListener(string $eventName, callable $listener); public function removeSubscriber(EventSubscriberInterface $subscriber); @@ -60,11 +57,9 @@ public function getListeners(string $eventName = null); * * Returns null if the event or the listener does not exist. * - * @param callable $listener The listener - * * @return int|null The event listener priority */ - public function getListenerPriority(string $eventName, $listener); + public function getListenerPriority(string $eventName, callable $listener); /** * Checks whether an event has any registered listeners. diff --git a/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php b/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php index 1644b2e2a8339..a8d68f924241a 100644 --- a/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php +++ b/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php @@ -96,7 +96,7 @@ protected function getKeyValuePairs() return $pairs; } - protected function compileArguments(Compiler $compiler, $withKeys = true) + protected function compileArguments(Compiler $compiler, bool $withKeys = true) { $first = true; foreach ($this->getKeyValuePairs() as $pair) { diff --git a/src/Symfony/Component/ExpressionLanguage/Token.php b/src/Symfony/Component/ExpressionLanguage/Token.php index d1cb270d75c83..2474218da27c0 100644 --- a/src/Symfony/Component/ExpressionLanguage/Token.php +++ b/src/Symfony/Component/ExpressionLanguage/Token.php @@ -54,11 +54,9 @@ public function __toString() /** * Tests the current token for a type and/or a value. * - * @param string $type The type to test - * * @return bool */ - public function test($type, string $value = null) + public function test(string $type, string $value = null) { return $this->type === $type && (null === $value || $this->value == $value); } diff --git a/src/Symfony/Component/ExpressionLanguage/TokenStream.php b/src/Symfony/Component/ExpressionLanguage/TokenStream.php index 8d5a1cbd51515..130513bbf8d21 100644 --- a/src/Symfony/Component/ExpressionLanguage/TokenStream.php +++ b/src/Symfony/Component/ExpressionLanguage/TokenStream.php @@ -56,12 +56,9 @@ public function next() } /** - * Tests a token. - * - * @param array|int $type The type to test * @param string|null $message The syntax error message */ - public function expect($type, string $value = null, string $message = null) + public function expect(string $type, string $value = null, string $message = null) { $token = $this->current; if (!$token->test($type, $value)) { diff --git a/src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php b/src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php index 3c66d8b9ac452..d9298bd924338 100644 --- a/src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php +++ b/src/Symfony/Component/Filesystem/Tests/Fixtures/MockStream/MockStream.php @@ -26,7 +26,7 @@ class MockStream * @param string $opened_path If the path is opened successfully, and STREAM_USE_PATH is set in options, * opened_path should be set to the full path of the file/resource that was actually opened */ - public function stream_open($path, $mode, $options, &$opened_path): bool + public function stream_open(string $path, string $mode, int $options, string &$opened_path = null): bool { return true; } @@ -37,7 +37,7 @@ public function stream_open($path, $mode, $options, &$opened_path): bool * * @return array File stats */ - public function url_stat($path, $flags): array + public function url_stat(string $path, int $flags): array { return []; } diff --git a/src/Symfony/Component/HttpClient/CurlHttpClient.php b/src/Symfony/Component/HttpClient/CurlHttpClient.php index 9025c27fb5fda..2e9bb23429fed 100644 --- a/src/Symfony/Component/HttpClient/CurlHttpClient.php +++ b/src/Symfony/Component/HttpClient/CurlHttpClient.php @@ -512,7 +512,7 @@ private static function createRedirectResolver(array $options, string $host): \C }; } - private function findConstantName($opt): ?string + private function findConstantName(int $opt): ?string { $constants = array_filter(get_defined_constants(), static function ($v, $k) use ($opt) { return $v === $opt && 'C' === $k[0] && (0 === strpos($k, 'CURLOPT_') || 0 === strpos($k, 'CURLINFO_')); diff --git a/src/Symfony/Component/HttpClient/Response/TraceableResponse.php b/src/Symfony/Component/HttpClient/Response/TraceableResponse.php index d98b5c905a0f9..34edee254b89a 100644 --- a/src/Symfony/Component/HttpClient/Response/TraceableResponse.php +++ b/src/Symfony/Component/HttpClient/Response/TraceableResponse.php @@ -202,7 +202,7 @@ public static function stream(HttpClientInterface $client, iterable $responses, } } - private function checkStatusCode($code) + private function checkStatusCode(int $code) { if (500 <= $code) { throw new ServerException($this); diff --git a/src/Symfony/Component/HttpClient/ScopingHttpClient.php b/src/Symfony/Component/HttpClient/ScopingHttpClient.php index 691cbc3b087ea..fd720b3c2b4b9 100644 --- a/src/Symfony/Component/HttpClient/ScopingHttpClient.php +++ b/src/Symfony/Component/HttpClient/ScopingHttpClient.php @@ -43,7 +43,7 @@ public function __construct(HttpClientInterface $client, array $defaultOptionsBy } } - public static function forBaseUri(HttpClientInterface $client, string $baseUri, array $defaultOptions = [], $regexp = null): self + public static function forBaseUri(HttpClientInterface $client, string $baseUri, array $defaultOptions = [], string $regexp = null): self { if (null === $regexp) { $regexp = preg_quote(implode('', self::resolveUrl(self::parseUrl('.'), self::parseUrl($baseUri)))); diff --git a/src/Symfony/Component/HttpFoundation/FileBag.php b/src/Symfony/Component/HttpFoundation/FileBag.php index 346c21e983d01..68ce892731679 100644 --- a/src/Symfony/Component/HttpFoundation/FileBag.php +++ b/src/Symfony/Component/HttpFoundation/FileBag.php @@ -107,11 +107,9 @@ protected function convertFileInformation($file) * It's safe to pass an already converted array, in which case this method * just returns the original array unmodified. * - * @param array $data - * * @return array */ - protected function fixPhpFilesArray($data) + protected function fixPhpFilesArray(array $data) { $keys = array_keys($data); sort($keys); diff --git a/src/Symfony/Component/HttpFoundation/InputBag.php b/src/Symfony/Component/HttpFoundation/InputBag.php index 2c21748e08c7d..5421df572ee63 100644 --- a/src/Symfony/Component/HttpFoundation/InputBag.php +++ b/src/Symfony/Component/HttpFoundation/InputBag.php @@ -16,7 +16,7 @@ /** * InputBag is a container for user input values such as $_GET, $_POST, $_REQUEST, and $_COOKIE. * - * @author Saif Eddin Gmati + * @author Saif Eddin Gmati */ final class InputBag extends ParameterBag { diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 01f84670567a8..ae1546a115a81 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -462,7 +462,7 @@ public function getProtocolVersion(): string * * @final */ - public function setStatusCode(int $code, $text = null): object + public function setStatusCode(int $code, string $text = null): object { $this->statusCode = $code; if ($this->isInvalid()) { diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index d81919919ff46..ca81714771182 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -192,7 +192,7 @@ public function getDumpsCount(): int return $this->dataCount; } - public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1): array + public function getDumps(string $format, int $maxDepthLimit = -1, int $maxItemsPerDepth = -1): array { $data = fopen('php://memory', 'r+'); diff --git a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php index 3d781fa36a5ae..17449b411d1e0 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php @@ -29,7 +29,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte private $currentRequest; private $requestStack; - public function __construct($logger = null, string $containerPathPrefix = null, RequestStack $requestStack = null) + public function __construct(object $logger = null, string $containerPathPrefix = null, RequestStack $requestStack = null) { if (null !== $logger && $logger instanceof DebugLoggerInterface) { $this->logger = $logger; diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index 6f27f379af8a1..425715669ec77 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -214,12 +214,12 @@ public function getRequestHeaders() return new ParameterBag($this->data['request_headers']->getValue()); } - public function getRequestServer($raw = false) + public function getRequestServer(bool $raw = false) { return new ParameterBag($this->data['request_server']->getValue($raw)); } - public function getRequestCookies($raw = false) + public function getRequestCookies(bool $raw = false) { return new ParameterBag($this->data['request_cookies']->getValue($raw)); } diff --git a/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php index 3bbdbd3ce8574..ea45fdcb3f1fe 100644 --- a/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php +++ b/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php @@ -105,7 +105,7 @@ public function render($uri, Request $request, array $options = []) } } - protected function createSubRequest($uri, Request $request) + protected function createSubRequest(string $uri, Request $request) { $cookies = $request->cookies->all(); $server = $request->server->all(); diff --git a/src/Symfony/Component/Intl/Countries.php b/src/Symfony/Component/Intl/Countries.php index f3fae27c202d4..ad46c794dadd2 100644 --- a/src/Symfony/Component/Intl/Countries.php +++ b/src/Symfony/Component/Intl/Countries.php @@ -109,7 +109,7 @@ public static function getAlpha3Name(string $alpha3Code, string $displayLocale = * * @return string[] */ - public static function getNames($displayLocale = null): array + public static function getNames(?string $displayLocale = null): array { return self::asort(self::readEntry(['Names'], $displayLocale), $displayLocale); } @@ -121,7 +121,7 @@ public static function getNames($displayLocale = null): array * * @return string[] */ - public static function getAlpha3Names($displayLocale = null): array + public static function getAlpha3Names(?string $displayLocale = null): array { $alpha2Names = self::getNames($displayLocale); $alpha3Names = []; diff --git a/src/Symfony/Component/Intl/Languages.php b/src/Symfony/Component/Intl/Languages.php index 847b07a67fc18..c7e0a1deee960 100644 --- a/src/Symfony/Component/Intl/Languages.php +++ b/src/Symfony/Component/Intl/Languages.php @@ -159,7 +159,7 @@ public static function getAlpha3Name(string $language, string $displayLocale = n * * @return string[] */ - public static function getAlpha3Names($displayLocale = null): array + public static function getAlpha3Names(string $displayLocale = null): array { $alpha2Names = self::getNames($displayLocale); $alpha3Names = []; diff --git a/src/Symfony/Component/Intl/Locales.php b/src/Symfony/Component/Intl/Locales.php index 1b2d0d2adf258..1be7cea90922e 100644 --- a/src/Symfony/Component/Intl/Locales.php +++ b/src/Symfony/Component/Intl/Locales.php @@ -67,7 +67,7 @@ public static function getName(string $locale, string $displayLocale = null): st /** * @return string[] */ - public static function getNames($displayLocale = null): array + public static function getNames(string $displayLocale = null): array { return self::asort(self::readEntry(['Names'], $displayLocale), $displayLocale); } diff --git a/src/Symfony/Component/Intl/Scripts.php b/src/Symfony/Component/Intl/Scripts.php index bb29f0095bee3..9c70b8b59bd87 100644 --- a/src/Symfony/Component/Intl/Scripts.php +++ b/src/Symfony/Component/Intl/Scripts.php @@ -51,7 +51,7 @@ public static function getName(string $script, string $displayLocale = null): st /** * @return string[] */ - public static function getNames($displayLocale = null): array + public static function getNames(string $displayLocale = null): array { return self::asort(self::readEntry(['Names'], $displayLocale), $displayLocale); } diff --git a/src/Symfony/Component/Intl/Util/IntlTestHelper.php b/src/Symfony/Component/Intl/Util/IntlTestHelper.php index d77d3e4da8ed2..8404194d5ee0a 100644 --- a/src/Symfony/Component/Intl/Util/IntlTestHelper.php +++ b/src/Symfony/Component/Intl/Util/IntlTestHelper.php @@ -30,7 +30,7 @@ class IntlTestHelper /** * Should be called before tests that work fine with the stub implementation. */ - public static function requireIntl(TestCase $testCase, $minimumIcuVersion = null) + public static function requireIntl(TestCase $testCase, string $minimumIcuVersion = null) { if (null === $minimumIcuVersion) { $minimumIcuVersion = Intl::getIcuStubVersion(); @@ -64,7 +64,7 @@ public static function requireIntl(TestCase $testCase, $minimumIcuVersion = null * Should be called before tests that require a feature-complete intl * implementation. */ - public static function requireFullIntl(TestCase $testCase, $minimumIcuVersion = null) + public static function requireFullIntl(TestCase $testCase, string $minimumIcuVersion = null) { // We only run tests if the intl extension is loaded... if (!Intl::isExtensionLoaded()) { diff --git a/src/Symfony/Component/Lock/Store/MongoDbStore.php b/src/Symfony/Component/Lock/Store/MongoDbStore.php index 39c1a2d113e26..a7d9b46bb641e 100644 --- a/src/Symfony/Component/Lock/Store/MongoDbStore.php +++ b/src/Symfony/Component/Lock/Store/MongoDbStore.php @@ -229,7 +229,7 @@ public function save(Key $key) * @throws LockStorageException * @throws LockExpiredException */ - public function putOffExpiration(Key $key, $ttl) + public function putOffExpiration(Key $key, float $ttl) { $key->reduceLifetime($ttl); diff --git a/src/Symfony/Component/Messenger/HandleTrait.php b/src/Symfony/Component/Messenger/HandleTrait.php index 72ac94ef27fd7..c0b5991fb45f0 100644 --- a/src/Symfony/Component/Messenger/HandleTrait.php +++ b/src/Symfony/Component/Messenger/HandleTrait.php @@ -34,7 +34,7 @@ trait HandleTrait * * @return mixed The handler returned value */ - private function handle($message) + private function handle(object $message) { if (!$this->messageBus instanceof MessageBusInterface) { throw new LogicException(sprintf('You must provide a "%s" instance in the "%s::$messageBus" property, "%s" given.', MessageBusInterface::class, static::class, get_debug_type($this->messageBus))); diff --git a/src/Symfony/Component/Messenger/MessageBus.php b/src/Symfony/Component/Messenger/MessageBus.php index 4819b7218abd6..1dbc3730a529a 100644 --- a/src/Symfony/Component/Messenger/MessageBus.php +++ b/src/Symfony/Component/Messenger/MessageBus.php @@ -59,11 +59,8 @@ public function getIterator(): \Traversable /** * {@inheritdoc} */ - public function dispatch($message, array $stamps = []): Envelope + public function dispatch(object $message, array $stamps = []): Envelope { - if (!\is_object($message)) { - throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object, but got "%s".', __METHOD__, get_debug_type($message))); - } $envelope = Envelope::wrap($message, $stamps); $middlewareIterator = $this->middlewareAggregate->getIterator(); diff --git a/src/Symfony/Component/Messenger/MessageBusInterface.php b/src/Symfony/Component/Messenger/MessageBusInterface.php index 4e61346bb7309..f1dbe0ad3800c 100644 --- a/src/Symfony/Component/Messenger/MessageBusInterface.php +++ b/src/Symfony/Component/Messenger/MessageBusInterface.php @@ -24,5 +24,5 @@ interface MessageBusInterface * @param object|Envelope $message The message or the message pre-wrapped in an envelope * @param StampInterface[] $stamps */ - public function dispatch($message, array $stamps = []): Envelope; + public function dispatch(object $message, array $stamps = []): Envelope; } diff --git a/src/Symfony/Component/Messenger/RoutableMessageBus.php b/src/Symfony/Component/Messenger/RoutableMessageBus.php index 8b7bedf7316e1..ece1478892698 100644 --- a/src/Symfony/Component/Messenger/RoutableMessageBus.php +++ b/src/Symfony/Component/Messenger/RoutableMessageBus.php @@ -34,7 +34,7 @@ public function __construct(ContainerInterface $busLocator, MessageBusInterface $this->fallbackBus = $fallbackBus; } - public function dispatch($envelope, array $stamps = []): Envelope + public function dispatch(object $envelope, array $stamps = []): Envelope { if (!$envelope instanceof Envelope) { throw new InvalidArgumentException('Messages passed to RoutableMessageBus::dispatch() must be inside an Envelope.'); diff --git a/src/Symfony/Component/Messenger/Tests/MessageBusTest.php b/src/Symfony/Component/Messenger/Tests/MessageBusTest.php index 703a47219a96f..fc0d638bb1ca3 100644 --- a/src/Symfony/Component/Messenger/Tests/MessageBusTest.php +++ b/src/Symfony/Component/Messenger/Tests/MessageBusTest.php @@ -32,13 +32,6 @@ public function testItHasTheRightInterface() $this->assertInstanceOf(MessageBusInterface::class, $bus); } - public function testItDispatchInvalidMessageType() - { - $this->expectException(\TypeError::class); - $this->expectExceptionMessage('Invalid argument provided to "Symfony\Component\Messenger\MessageBus::dispatch()": expected object, but got "string".'); - (new MessageBus())->dispatch('wrong'); - } - public function testItCallsMiddleware() { $message = new DummyMessage('Hello'); diff --git a/src/Symfony/Component/Messenger/TraceableMessageBus.php b/src/Symfony/Component/Messenger/TraceableMessageBus.php index 39edaa8c5b034..ba3aa6fc4209f 100644 --- a/src/Symfony/Component/Messenger/TraceableMessageBus.php +++ b/src/Symfony/Component/Messenger/TraceableMessageBus.php @@ -27,7 +27,7 @@ public function __construct(MessageBusInterface $decoratedBus) /** * {@inheritdoc} */ - public function dispatch($message, array $stamps = []): Envelope + public function dispatch(object $message, array $stamps = []): Envelope { $envelope = Envelope::wrap($message, $stamps); $context = [ diff --git a/src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php b/src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php index f7d909f2c599d..9be0bf178ea4f 100644 --- a/src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php +++ b/src/Symfony/Component/Messenger/Transport/Serialization/Normalizer/FlattenExceptionNormalizer.php @@ -32,7 +32,7 @@ final class FlattenExceptionNormalizer implements DenormalizerInterface, Context * * @throws InvalidArgumentException */ - public function normalize($object, $format = null, array $context = []) + public function normalize($object, string $format = null, array $context = []) { $normalized = [ 'message' => $object->getMessage(), @@ -54,7 +54,7 @@ public function normalize($object, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = null, array $context = []) + public function supportsNormalization($data, string $format = null, array $context = []) { return $data instanceof FlattenException && ($context[Serializer::MESSENGER_SERIALIZATION_CONTEXT] ?? false); } @@ -62,7 +62,7 @@ public function supportsNormalization($data, $format = null, array $context = [] /** * {@inheritdoc} */ - public function denormalize($data, $type, $format = null, array $context = []) + public function denormalize($data, string $type, string $format = null, array $context = []) { $object = new FlattenException(); @@ -93,7 +93,7 @@ public function denormalize($data, $type, $format = null, array $context = []) /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null, array $context = []) + public function supportsDenormalization($data, string $type, string $format = null, array $context = []) { return FlattenException::class === $type && ($context[Serializer::MESSENGER_SERIALIZATION_CONTEXT] ?? false); } diff --git a/src/Symfony/Component/Messenger/composer.json b/src/Symfony/Component/Messenger/composer.json index 704583c0df4ce..476d8c4e94949 100644 --- a/src/Symfony/Component/Messenger/composer.json +++ b/src/Symfony/Component/Messenger/composer.json @@ -32,7 +32,7 @@ "symfony/http-kernel": "^4.4|^5.0", "symfony/process": "^4.4|^5.0", "symfony/property-access": "^4.4|^5.0", - "symfony/serializer": "^4.4|^5.0", + "symfony/serializer": "^5.0", "symfony/service-contracts": "^1.1|^2", "symfony/stopwatch": "^4.4|^5.0", "symfony/validator": "^4.4|^5.0" @@ -40,7 +40,8 @@ "conflict": { "symfony/event-dispatcher": "<4.4", "symfony/framework-bundle": "<4.4", - "symfony/http-kernel": "<4.4" + "symfony/http-kernel": "<4.4", + "symfony/serializer": "<5.0" }, "suggest": { "enqueue/messenger-adapter": "For using the php-enqueue library as a transport." diff --git a/src/Symfony/Component/Mime/Address.php b/src/Symfony/Component/Mime/Address.php index 373d4236f8152..f52e3fb972465 100644 --- a/src/Symfony/Component/Mime/Address.php +++ b/src/Symfony/Component/Mime/Address.php @@ -98,19 +98,20 @@ public static function create($address): self if ($address instanceof self) { return $address; } - if (\is_string($address)) { - if (false === strpos($address, '<')) { - return new self($address); - } - if (!preg_match(self::FROM_STRING_PATTERN, $address, $matches)) { - throw new InvalidArgumentException(sprintf('Could not parse "%s" to a "%s" instance.', $address, self::class)); - } + if (!\is_string($address)) { + throw new InvalidArgumentException(sprintf('An address can be an instance of Address or a string ("%s" given).', get_debug_type($address))); + } + + if (false === strpos($address, '<')) { + return new self($address); + } - return new self($matches['addrSpec'], trim($matches['displayName'], ' \'"')); + if (!preg_match(self::FROM_STRING_PATTERN, $address, $matches)) { + throw new InvalidArgumentException(sprintf('Could not parse "%s" to a "%s" instance.', $address, self::class)); } - throw new InvalidArgumentException(sprintf('An address can be an instance of Address or a string ("%s" given).', get_debug_type($address))); + return new self($matches['addrSpec'], trim($matches['displayName'], ' \'"')); } /** diff --git a/src/Symfony/Component/Mime/Part/TextPart.php b/src/Symfony/Component/Mime/Part/TextPart.php index ff767cc36c4ec..686afbe2eb307 100644 --- a/src/Symfony/Component/Mime/Part/TextPart.php +++ b/src/Symfony/Component/Mime/Part/TextPart.php @@ -89,7 +89,7 @@ public function setDisposition(string $disposition) * * @return $this */ - public function setName($name) + public function setName(string $name) { $this->name = $name; diff --git a/src/Symfony/Component/OptionsResolver/OptionConfigurator.php b/src/Symfony/Component/OptionsResolver/OptionConfigurator.php index 47f5bea557b7b..62f03d064ace9 100644 --- a/src/Symfony/Component/OptionsResolver/OptionConfigurator.php +++ b/src/Symfony/Component/OptionsResolver/OptionConfigurator.php @@ -28,8 +28,6 @@ public function __construct(string $name, OptionsResolver $resolver) /** * Adds allowed types for this option. * - * @param string ...$types One or more accepted types - * * @return $this * * @throws AccessException If called from a lazy option or normalizer @@ -100,8 +98,6 @@ public function deprecated(string $package, string $version, $message = 'The opt /** * Sets the normalizer for this option. * - * @param \Closure $normalizer The normalizer - * * @return $this * * @throws AccessException If called from a lazy option or normalizer diff --git a/src/Symfony/Component/OptionsResolver/OptionsResolver.php b/src/Symfony/Component/OptionsResolver/OptionsResolver.php index 4b5b23c0e0865..506f95e99d1be 100644 --- a/src/Symfony/Component/OptionsResolver/OptionsResolver.php +++ b/src/Symfony/Component/OptionsResolver/OptionsResolver.php @@ -270,8 +270,6 @@ public function setDefaults(array $defaults) * Returns true if {@link setDefault()} was called for this option. * An option is also considered set if it was set to null. * - * @param string $option The option name - * * @return bool Whether a default value is set */ public function hasDefault(string $option) @@ -307,8 +305,6 @@ public function setRequired($optionNames) * * An option is required if it was passed to {@link setRequired()}. * - * @param string $option The name of the option - * * @return bool Whether the option is required */ public function isRequired(string $option) @@ -335,8 +331,6 @@ public function getRequiredOptions() * to {@link setDefault()}. This option must be passed explicitly to * {@link resolve()}, otherwise an exception will be thrown. * - * @param string $option The name of the option - * * @return bool Whether the option is missing */ public function isMissing(string $option) @@ -388,8 +382,6 @@ public function setDefined($optionNames) * Returns true for any option passed to {@link setDefault()}, * {@link setRequired()} or {@link setDefined()}. * - * @param string $option The option name - * * @return bool Whether the option is defined */ public function isDefined(string $option) @@ -502,8 +494,6 @@ public function isDeprecated(string $option): bool * * The resolved option value is set to the return value of the closure. * - * @param string $option The option name - * * @return $this * * @throws UndefinedOptionsException If the option is undefined @@ -668,7 +658,6 @@ public function addAllowedValues(string $option, $allowedValues) * acceptable. Additionally, fully-qualified class or interface names may * be passed. * - * @param string $option The option name * @param string|string[] $allowedTypes One or more accepted types * * @return $this @@ -703,7 +692,6 @@ public function setAllowedTypes(string $option, $allowedTypes) * acceptable. Additionally, fully-qualified class or interface names may * be passed. * - * @param string $option The option name * @param string|string[] $allowedTypes One or more accepted types * * @return $this @@ -905,8 +893,7 @@ public function resolve(array $options = []) /** * Returns the resolved value of an option. * - * @param string $option The option name - * @param bool $triggerDeprecation Whether to trigger the deprecation or not (true by default) + * @param bool $triggerDeprecation Whether to trigger the deprecation or not (true by default) * * @return mixed The option value * diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index 0c2b515832711..85c530ef2fe9a 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -623,10 +623,8 @@ private function getWriteInfo(string $class, string $property, $value): Property /** * Returns whether a property is writable in the given object. - * - * @param object $object The object to write to */ - private function isPropertyWritable($object, string $property): bool + private function isPropertyWritable(object $object, string $property): bool { if (!\is_object($object)) { return false; diff --git a/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php b/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php index e20045ed53cc6..5aa3afc79a40b 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php +++ b/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php @@ -63,8 +63,6 @@ public function append($path, int $offset = 0, int $length = 0) /** * Appends an index element to the current path. - * - * @param string $name The name of the appended index */ public function appendIndex(string $name) { @@ -74,8 +72,6 @@ public function appendIndex(string $name) /** * Appends a property element to the current path. - * - * @param string $name The name of the appended property */ public function appendProperty(string $name) { @@ -86,9 +82,6 @@ public function appendProperty(string $name) /** * Removes elements from the current path. * - * @param int $offset The offset at which to remove - * @param int $length The length of the removed piece - * * @throws OutOfBoundsException if offset is invalid */ public function remove(int $offset, int $length = 1) @@ -141,9 +134,6 @@ public function replace(int $offset, int $length, $path, int $pathOffset = 0, in /** * Replaces a property element by an index element. * - * @param int $offset The offset at which to replace - * @param string $name The new name of the element. Optional - * * @throws OutOfBoundsException If the offset is invalid */ public function replaceByIndex(int $offset, string $name = null) @@ -162,9 +152,6 @@ public function replaceByIndex(int $offset, string $name = null) /** * Replaces an index element by a property element. * - * @param int $offset The offset at which to replace - * @param string $name The new name of the element. Optional - * * @throws OutOfBoundsException If the offset is invalid */ public function replaceByProperty(int $offset, string $name = null) diff --git a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestSingularAndPluralProps.php b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestSingularAndPluralProps.php index 128ba33cb6058..76261d6c3f539 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestSingularAndPluralProps.php +++ b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestSingularAndPluralProps.php @@ -28,10 +28,7 @@ public function getEmail(): ?string return $this->email; } - /** - * @param string|null $email - */ - public function setEmail($email) + public function setEmail(?string $email) { $this->email = $email; } @@ -41,18 +38,12 @@ public function getEmails(): array return $this->emails; } - /** - * @param string $email - */ - public function addEmail($email) + public function addEmail(string $email) { $this->emails[] = $email; } - /** - * @param string $email - */ - public function removeEmail($email) + public function removeEmail(string $email) { $this->emails = array_diff($this->emails, [$email]); } diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ConstructorExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ConstructorExtractor.php index 702251cde3ab5..86dc43f13b9f5 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ConstructorExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ConstructorExtractor.php @@ -34,7 +34,7 @@ public function __construct(iterable $extractors = []) /** * {@inheritdoc} */ - public function getTypes($class, $property, array $context = []) + public function getTypes(string $class, string $property, array $context = []) { foreach ($this->extractors as $extractor) { $value = $extractor->getTypesFromConstructor($class, $property); diff --git a/src/Symfony/Component/RateLimiter/Exception/RateLimitExceededException.php b/src/Symfony/Component/RateLimiter/Exception/RateLimitExceededException.php index 0cb10c750befe..c75b3eeec4f62 100644 --- a/src/Symfony/Component/RateLimiter/Exception/RateLimitExceededException.php +++ b/src/Symfony/Component/RateLimiter/Exception/RateLimitExceededException.php @@ -22,7 +22,7 @@ class RateLimitExceededException extends \RuntimeException { private $rateLimit; - public function __construct(RateLimit $rateLimit, $code = 0, \Throwable $previous = null) + public function __construct(RateLimit $rateLimit, int $code = 0, \Throwable $previous = null) { parent::__construct('Rate Limit Exceeded', $code, $previous); diff --git a/src/Symfony/Component/Routing/Annotation/Route.php b/src/Symfony/Component/Routing/Annotation/Route.php index f51b74c38727c..e938f45b6daee 100644 --- a/src/Symfony/Component/Routing/Annotation/Route.php +++ b/src/Symfony/Component/Routing/Annotation/Route.php @@ -132,7 +132,7 @@ public function __construct( } } - public function setPath($path) + public function setPath(string $path) { $this->path = $path; } @@ -152,7 +152,7 @@ public function getLocalizedPaths(): array return $this->localizedPaths; } - public function setHost($pattern) + public function setHost(string $pattern) { $this->host = $pattern; } @@ -162,7 +162,7 @@ public function getHost() return $this->host; } - public function setName($name) + public function setName(string $name) { $this->name = $name; } @@ -172,7 +172,7 @@ public function getName() return $this->name; } - public function setRequirements($requirements) + public function setRequirements(array $requirements) { $this->requirements = $requirements; } @@ -182,7 +182,7 @@ public function getRequirements() return $this->requirements; } - public function setOptions($options) + public function setOptions(array $options) { $this->options = $options; } @@ -192,7 +192,7 @@ public function getOptions() return $this->options; } - public function setDefaults($defaults) + public function setDefaults(array $defaults) { $this->defaults = $defaults; } @@ -222,7 +222,7 @@ public function getMethods() return $this->methods; } - public function setCondition($condition) + public function setCondition(?string $condition) { $this->condition = $condition; } diff --git a/src/Symfony/Component/Routing/Loader/Configurator/RouteConfigurator.php b/src/Symfony/Component/Routing/Loader/Configurator/RouteConfigurator.php index fcb377182e359..bb6ce267a78a7 100644 --- a/src/Symfony/Component/Routing/Loader/Configurator/RouteConfigurator.php +++ b/src/Symfony/Component/Routing/Loader/Configurator/RouteConfigurator.php @@ -24,7 +24,7 @@ class RouteConfigurator protected $parentConfigurator; - public function __construct(RouteCollection $collection, $route, string $name = '', CollectionConfigurator $parentConfigurator = null, array $prefixes = null) + public function __construct(RouteCollection $collection, RouteCollection $route, string $name = '', CollectionConfigurator $parentConfigurator = null, array $prefixes = null) { $this->collection = $collection; $this->route = $route; diff --git a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php index 355b4f486c8bd..7f1cb08182a87 100644 --- a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php @@ -69,10 +69,6 @@ public function load($file, string $type = null) /** * Parses a node from a loaded XML file. * - * @param \DOMElement $node Element to parse - * @param string $path Full path of the XML file being processed - * @param string $file Loaded file name - * * @throws \InvalidArgumentException When the XML is invalid */ protected function parseNode(RouteCollection $collection, \DOMElement $node, string $path, string $file) @@ -104,9 +100,6 @@ public function supports($resource, string $type = null) /** * Parses a route and adds it to the RouteCollection. * - * @param \DOMElement $node Element to parse that represents a Route - * @param string $path Full path of the XML file being processed - * * @throws \InvalidArgumentException When the XML is invalid */ protected function parseRoute(RouteCollection $collection, \DOMElement $node, string $path) @@ -144,10 +137,6 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, st /** * Parses an import and adds the routes in the resource to the RouteCollection. * - * @param \DOMElement $node Element to parse that represents a Route - * @param string $path Full path of the XML file being processed - * @param string $file Loaded file name - * * @throws \InvalidArgumentException When the XML is invalid */ protected function parseImport(RouteCollection $collection, \DOMElement $node, string $path, string $file) @@ -220,10 +209,6 @@ protected function parseImport(RouteCollection $collection, \DOMElement $node, s } /** - * Loads an XML file. - * - * @param string $file An XML file path - * * @return \DOMDocument * * @throws \InvalidArgumentException When loading of XML file fails because of syntax errors diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php index b236e4b54e8f6..4a0e479d310b3 100644 --- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -106,10 +106,6 @@ public function supports($resource, string $type = null) /** * Parses a route and adds it to the RouteCollection. - * - * @param string $name Route name - * @param array $config Route definition - * @param string $path Full path of the YAML file being processed */ protected function parseRoute(RouteCollection $collection, string $name, array $config, string $path) { @@ -154,10 +150,6 @@ protected function parseRoute(RouteCollection $collection, string $name, array $ /** * Parses an import and adds the routes in the resource to the RouteCollection. - * - * @param array $config Route definition - * @param string $path Full path of the YAML file being processed - * @param string $file Loaded file name */ protected function parseImport(RouteCollection $collection, array $config, string $path, string $file) { diff --git a/src/Symfony/Component/Routing/Route.php b/src/Symfony/Component/Routing/Route.php index d4d4b3af804d1..466f18d9f35cc 100644 --- a/src/Symfony/Component/Routing/Route.php +++ b/src/Symfony/Component/Routing/Route.php @@ -120,8 +120,6 @@ public function getPath() } /** - * Sets the pattern for the path. - * * @return $this */ public function setPath(string $pattern) @@ -145,8 +143,6 @@ public function getHost() } /** - * Sets the pattern for the host. - * * @return $this */ public function setHost(?string $pattern) @@ -270,8 +266,6 @@ public function setOption(string $name, $value) } /** - * Get an option value. - * * @return mixed The option value or null when not given */ public function getOption(string $name) @@ -280,8 +274,6 @@ public function getOption(string $name) } /** - * Checks if an option has been set. - * * @return bool true if the option is set, false otherwise */ public function hasOption(string $name) @@ -325,8 +317,6 @@ public function addDefaults(array $defaults) } /** - * Gets a default value. - * * @return mixed The default value or null when not given */ public function getDefault(string $name) @@ -335,8 +325,6 @@ public function getDefault(string $name) } /** - * Checks if a default value is set for the given variable. - * * @return bool true if the default value is set, false otherwise */ public function hasDefault(string $name) @@ -399,8 +387,6 @@ public function addRequirements(array $requirements) } /** - * Returns the requirement for the given key. - * * @return string|null The regex or null when not given */ public function getRequirement(string $key) @@ -409,8 +395,6 @@ public function getRequirement(string $key) } /** - * Checks if a requirement is set for the given key. - * * @return bool true if a requirement is specified, false otherwise */ public function hasRequirement(string $key) @@ -419,8 +403,6 @@ public function hasRequirement(string $key) } /** - * Sets a requirement for the given key. - * * @return $this */ public function setRequirement(string $key, string $regex) @@ -444,8 +426,6 @@ public function getCondition() } /** - * Sets the condition. - * * @return $this */ public function setCondition(?string $condition) diff --git a/src/Symfony/Component/Security/Http/Authenticator/Passport/Credentials/CustomCredentials.php b/src/Symfony/Component/Security/Http/Authenticator/Passport/Credentials/CustomCredentials.php index f0407107e6d4d..18c8587c8b36b 100644 --- a/src/Symfony/Component/Security/Http/Authenticator/Passport/Credentials/CustomCredentials.php +++ b/src/Symfony/Component/Security/Http/Authenticator/Passport/Credentials/CustomCredentials.php @@ -32,7 +32,7 @@ class CustomCredentials implements CredentialsInterface * @param callable $customCredentialsChecker the check function. If this function does not return `true`, a * BadCredentialsException is thrown. You may also throw a more * specific exception in the function. - * @param $credentials + * @param mixed $credentials */ public function __construct(callable $customCredentialsChecker, $credentials) { diff --git a/src/Symfony/Component/Serializer/Annotation/Groups.php b/src/Symfony/Component/Serializer/Annotation/Groups.php index 0c71e177d7433..628968f8b8f21 100644 --- a/src/Symfony/Component/Serializer/Annotation/Groups.php +++ b/src/Symfony/Component/Serializer/Annotation/Groups.php @@ -42,8 +42,8 @@ public function __construct(array $groups) } foreach ($groups as $group) { - if (!\is_string($group)) { - throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a string or an array of strings.', static::class)); + if (!\is_string($group) || '' === $group) { + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a string or an array of non-empty strings.', static::class)); } } diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/UnwrappinDenormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/UnwrappinDenormalizerTest.php index 8d282656504fb..25063b8620d90 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/UnwrappinDenormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/UnwrappinDenormalizerTest.php @@ -34,9 +34,9 @@ protected function setUp(): void public function testSupportsNormalization() { - $this->assertTrue($this->denormalizer->supportsDenormalization([], new \stdClass(), 'any', [UnwrappingDenormalizer::UNWRAP_PATH => '[baz][inner]'])); - $this->assertFalse($this->denormalizer->supportsDenormalization([], new \stdClass(), 'any', [UnwrappingDenormalizer::UNWRAP_PATH => '[baz][inner]', 'unwrapped' => true])); - $this->assertFalse($this->denormalizer->supportsDenormalization([], new \stdClass(), 'any', [])); + $this->assertTrue($this->denormalizer->supportsDenormalization([], 'stdClass', 'any', [UnwrappingDenormalizer::UNWRAP_PATH => '[baz][inner]'])); + $this->assertFalse($this->denormalizer->supportsDenormalization([], 'stdClass', 'any', [UnwrappingDenormalizer::UNWRAP_PATH => '[baz][inner]', 'unwrapped' => true])); + $this->assertFalse($this->denormalizer->supportsDenormalization([], 'stdClass', 'any', [])); } public function testDenormalize() diff --git a/src/Symfony/Component/Templating/PhpEngine.php b/src/Symfony/Component/Templating/PhpEngine.php index ab6b7d30e3030..b2920ab8afecc 100644 --- a/src/Symfony/Component/Templating/PhpEngine.php +++ b/src/Symfony/Component/Templating/PhpEngine.php @@ -272,8 +272,6 @@ public function get(string $name) /** * Decorates the current template with another one. - * - * @param string $template The decorator logical name */ public function extend(string $template) { diff --git a/src/Symfony/Component/Translation/Extractor/ChainExtractor.php b/src/Symfony/Component/Translation/Extractor/ChainExtractor.php index 6b6e18277d04a..95dcf157c54c7 100644 --- a/src/Symfony/Component/Translation/Extractor/ChainExtractor.php +++ b/src/Symfony/Component/Translation/Extractor/ChainExtractor.php @@ -29,8 +29,6 @@ class ChainExtractor implements ExtractorInterface /** * Adds a loader to the translation extractor. - * - * @param string $format The format of the loader */ public function addExtractor(string $format, ExtractorInterface $extractor) { diff --git a/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php b/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php index f8c1c82a23128..e8ab05ea5e1c0 100644 --- a/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php +++ b/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php @@ -30,8 +30,6 @@ public function extract($resource, MessageCatalogue $catalogue); /** * Sets the prefix that should be used for new found messages. - * - * @param string $prefix The prefix */ public function setPrefix(string $prefix); } diff --git a/src/Symfony/Component/Translation/Loader/CsvFileLoader.php b/src/Symfony/Component/Translation/Loader/CsvFileLoader.php index 25ac2f5662395..8d5d4db9a721f 100644 --- a/src/Symfony/Component/Translation/Loader/CsvFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/CsvFileLoader.php @@ -27,7 +27,7 @@ class CsvFileLoader extends FileLoader /** * {@inheritdoc} */ - protected function loadResource($resource) + protected function loadResource(string $resource) { $messages = []; diff --git a/src/Symfony/Component/Translation/Loader/FileLoader.php b/src/Symfony/Component/Translation/Loader/FileLoader.php index 2ffba392d54d1..4725ea6d62a7d 100644 --- a/src/Symfony/Component/Translation/Loader/FileLoader.php +++ b/src/Symfony/Component/Translation/Loader/FileLoader.php @@ -55,11 +55,9 @@ public function load($resource, string $locale, string $domain = 'messages') } /** - * @param string $resource - * * @return array * * @throws InvalidResourceException if stream content has an invalid format */ - abstract protected function loadResource($resource); + abstract protected function loadResource(string $resource); } diff --git a/src/Symfony/Component/Translation/Loader/IniFileLoader.php b/src/Symfony/Component/Translation/Loader/IniFileLoader.php index 11d9b272e0a39..7398f777814ab 100644 --- a/src/Symfony/Component/Translation/Loader/IniFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/IniFileLoader.php @@ -21,7 +21,7 @@ class IniFileLoader extends FileLoader /** * {@inheritdoc} */ - protected function loadResource($resource) + protected function loadResource(string $resource) { return parse_ini_file($resource, true); } diff --git a/src/Symfony/Component/Translation/Loader/JsonFileLoader.php b/src/Symfony/Component/Translation/Loader/JsonFileLoader.php index 8a8996b0d209e..5aefba07229f6 100644 --- a/src/Symfony/Component/Translation/Loader/JsonFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/JsonFileLoader.php @@ -23,7 +23,7 @@ class JsonFileLoader extends FileLoader /** * {@inheritdoc} */ - protected function loadResource($resource) + protected function loadResource(string $resource) { $messages = []; if ($data = file_get_contents($resource)) { diff --git a/src/Symfony/Component/Translation/Loader/MoFileLoader.php b/src/Symfony/Component/Translation/Loader/MoFileLoader.php index accd023ab50c6..654331a2b136c 100644 --- a/src/Symfony/Component/Translation/Loader/MoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/MoFileLoader.php @@ -41,7 +41,7 @@ class MoFileLoader extends FileLoader * * {@inheritdoc} */ - protected function loadResource($resource) + protected function loadResource(string $resource) { $stream = fopen($resource, 'r'); diff --git a/src/Symfony/Component/Translation/Loader/PhpFileLoader.php b/src/Symfony/Component/Translation/Loader/PhpFileLoader.php index c361d5293cc0f..85f10902b152d 100644 --- a/src/Symfony/Component/Translation/Loader/PhpFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/PhpFileLoader.php @@ -23,7 +23,7 @@ class PhpFileLoader extends FileLoader /** * {@inheritdoc} */ - protected function loadResource($resource) + protected function loadResource(string $resource) { if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) || filter_var(ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN))) { self::$cache = null; diff --git a/src/Symfony/Component/Translation/Loader/PoFileLoader.php b/src/Symfony/Component/Translation/Loader/PoFileLoader.php index 5e460fbfb84ff..ee143e20323cf 100644 --- a/src/Symfony/Component/Translation/Loader/PoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/PoFileLoader.php @@ -60,7 +60,7 @@ class PoFileLoader extends FileLoader * * {@inheritdoc} */ - protected function loadResource($resource) + protected function loadResource(string $resource) { $stream = fopen($resource, 'r'); diff --git a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php index b03c7b77d0209..8588e186ad1a8 100644 --- a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php @@ -29,7 +29,7 @@ class YamlFileLoader extends FileLoader /** * {@inheritdoc} */ - protected function loadResource($resource) + protected function loadResource(string $resource) { if (null === $this->yamlParser) { if (!class_exists(\Symfony\Component\Yaml\Parser::class)) { diff --git a/src/Symfony/Component/Translation/MetadataAwareInterface.php b/src/Symfony/Component/Translation/MetadataAwareInterface.php index d157a072eb845..bd9a39bc72faa 100644 --- a/src/Symfony/Component/Translation/MetadataAwareInterface.php +++ b/src/Symfony/Component/Translation/MetadataAwareInterface.php @@ -25,9 +25,6 @@ interface MetadataAwareInterface * domain and then by key. Passing an empty key will return an array with all * metadata for the given domain. * - * @param string $key The key - * @param string $domain The domain name - * * @return mixed The value that was set or an array with the domains/keys or null */ public function getMetadata(string $key = '', string $domain = 'messages'); @@ -35,20 +32,15 @@ public function getMetadata(string $key = '', string $domain = 'messages'); /** * Adds metadata to a message domain. * - * @param string $key The key - * @param mixed $value The value - * @param string $domain The domain name + * @param mixed $value */ - public function setMetadata(string $key, $value, string $domain = 'messages'); + public function setMetadata(string $key, mixed $value, string $domain = 'messages'); /** * Deletes metadata for the given key and domain. * * Passing an empty domain will delete all metadata. Passing an empty key will * delete all metadata for the given domain. - * - * @param string $key The key - * @param string $domain The domain name */ public function deleteMetadata(string $key = '', string $domain = 'messages'); } diff --git a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php index 2de3164876450..2d890c8c3616a 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatorCacheTest.php @@ -320,7 +320,7 @@ private function createFailingLoader(): LoaderInterface class StaleResource implements SelfCheckingResourceInterface { - public function isFresh($timestamp): bool + public function isFresh(int $timestamp): bool { return false; } diff --git a/src/Symfony/Component/Translation/Writer/TranslationWriter.php b/src/Symfony/Component/Translation/Writer/TranslationWriter.php index e0260b7a30593..0a349b824689f 100644 --- a/src/Symfony/Component/Translation/Writer/TranslationWriter.php +++ b/src/Symfony/Component/Translation/Writer/TranslationWriter.php @@ -27,10 +27,8 @@ class TranslationWriter implements TranslationWriterInterface /** * Adds a dumper to the writer. - * - * @param string $format The format of the dumper */ - public function addDumper($format, DumperInterface $dumper) + public function addDumper(string $format, DumperInterface $dumper) { $this->dumpers[$format] = $dumper; } diff --git a/src/Symfony/Component/Validator/Constraint.php b/src/Symfony/Component/Validator/Constraint.php index 4a9af65ef77b5..97a2518c5fd8f 100644 --- a/src/Symfony/Component/Validator/Constraint.php +++ b/src/Symfony/Component/Validator/Constraint.php @@ -61,13 +61,11 @@ abstract class Constraint /** * Returns the name of the given error code. * - * @param string $errorCode The error code - * * @return string The name of the error code * * @throws InvalidArgumentException If the error code does not exist */ - public static function getErrorName($errorCode) + public static function getErrorName(string $errorCode) { if (!isset(static::$errorNames[$errorCode])) { throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, static::class)); @@ -203,8 +201,6 @@ public function __set(string $option, $value) * this method will be called at most once per constraint instance and * option name. * - * @param string $option The option name - * * @return mixed The value of the option * * @throws InvalidOptionsException If an invalid option name is given @@ -223,8 +219,6 @@ public function __get(string $option) } /** - * @param string $option The option name - * * @return bool */ public function __isset(string $option) @@ -234,10 +228,8 @@ public function __isset(string $option) /** * Adds the given group if this constraint is in the Default group. - * - * @param string $group */ - public function addImplicitGroupName($group) + public function addImplicitGroupName(string $group) { if (\in_array(self::DEFAULT_GROUP, $this->groups) && !\in_array($group, $this->groups)) { $this->groups[] = $group; diff --git a/src/Symfony/Component/Validator/Constraints/Composite.php b/src/Symfony/Component/Validator/Constraints/Composite.php index 0d9bb8ecfe663..b24da39d22855 100644 --- a/src/Symfony/Component/Validator/Constraints/Composite.php +++ b/src/Symfony/Component/Validator/Constraints/Composite.php @@ -114,10 +114,8 @@ public function __construct($options = null) * {@inheritdoc} * * Implicit group names are forwarded to nested constraints. - * - * @param string $group */ - public function addImplicitGroupName($group) + public function addImplicitGroupName(string $group) { parent::addImplicitGroupName($group); diff --git a/src/Symfony/Component/Validator/Constraints/IsbnValidator.php b/src/Symfony/Component/Validator/Constraints/IsbnValidator.php index 78671004984b5..d015a1df7af50 100644 --- a/src/Symfony/Component/Validator/Constraints/IsbnValidator.php +++ b/src/Symfony/Component/Validator/Constraints/IsbnValidator.php @@ -95,7 +95,7 @@ public function validate($value, Constraint $constraint) } } - protected function validateIsbn10($isbn) + protected function validateIsbn10(string $isbn) { // Choose an algorithm so that ERROR_INVALID_CHARACTERS is preferred // over ERROR_TOO_SHORT/ERROR_TOO_LONG @@ -135,7 +135,7 @@ protected function validateIsbn10($isbn) return 0 === $checkSum % 11 ? true : Isbn::CHECKSUM_FAILED_ERROR; } - protected function validateIsbn13($isbn) + protected function validateIsbn13(string $isbn) { // Error priority: // 1. ERROR_INVALID_CHARACTERS @@ -169,7 +169,7 @@ protected function validateIsbn13($isbn) return 0 === $checkSum % 10 ? true : Isbn::CHECKSUM_FAILED_ERROR; } - protected function getMessage($constraint, $type = null) + protected function getMessage(Isbn $constraint, string $type = null) { if (null !== $constraint->message) { return $constraint->message; diff --git a/src/Symfony/Component/Validator/Constraints/Valid.php b/src/Symfony/Component/Validator/Constraints/Valid.php index 312ab884486c3..9ee69fdd47bc1 100644 --- a/src/Symfony/Component/Validator/Constraints/Valid.php +++ b/src/Symfony/Component/Validator/Constraints/Valid.php @@ -37,7 +37,7 @@ public function __get(string $option) /** * {@inheritdoc} */ - public function addImplicitGroupName($group) + public function addImplicitGroupName(string $group) { if (null !== $this->groups) { parent::addImplicitGroupName($group); diff --git a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php index 3f30ebb45bdba..3a4d2a198d2bd 100644 --- a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php @@ -91,7 +91,7 @@ protected function tearDown(): void $this->restoreDefaultTimezone(); } - protected function setDefaultTimezone($defaultTimezone) + protected function setDefaultTimezone(?string $defaultTimezone) { // Make sure this method can not be called twice before calling // also restoreDefaultTimezone() @@ -168,7 +168,7 @@ protected function createContext() return $context; } - protected function setGroup($group) + protected function setGroup(?string $group) { $this->group = $group; $this->context->setGroup($group); @@ -207,7 +207,7 @@ protected function setRoot($root) $this->validator->initialize($this->context); } - protected function setPropertyPath($propertyPath) + protected function setPropertyPath(string $propertyPath) { $this->propertyPath = $propertyPath; $this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath); @@ -219,7 +219,7 @@ protected function expectNoValidate() $validator->expectNoValidate(); } - protected function expectValidateAt($i, $propertyPath, $value, $group) + protected function expectValidateAt(int $i, string $propertyPath, $value, $group) { $validator = $this->context->getValidator()->inContext($this->context); $validator->expectValidation($i, $propertyPath, $value, $group, function ($passedConstraints) { @@ -254,7 +254,7 @@ protected function expectFailingValueValidation(int $i, $value, array $constrain }, $violation); } - protected function expectValidateValueAt($i, $propertyPath, $value, $constraints, $group = null) + protected function expectValidateValueAt(int $i, string $propertyPath, $value, $constraints, $group = null) { $contextualValidator = $this->context->getValidator()->inContext($this->context); $contextualValidator->expectValidation($i, $propertyPath, $value, $group, function ($passedConstraints) use ($constraints) { @@ -332,7 +332,7 @@ public function atPath(string $path) return $this; } - public function setParameter(string $key, $value) + public function setParameter(string $key, string $value) { $this->parameters[$key] = $value; @@ -443,11 +443,11 @@ public function __construct(ExecutionContextInterface $context) $this->context = $context; } - public function atPath($path) + public function atPath(string $path) { } - public function doAtPath($path) + public function doAtPath(string $path) { Assert::assertFalse($this->expectNoValidate, 'No validation calls have been expected.'); @@ -485,20 +485,20 @@ public function doValidate($value, $constraints = null, $groups = null) return $this; } - public function validateProperty($object, $propertyName, $groups = null) + public function validateProperty(object $object, string $propertyName, $groups = null) { } - public function doValidateProperty($object, $propertyName, $groups = null) + public function doValidateProperty(object $object, string $propertyName, $groups = null) { return $this; } - public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) + public function validatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null) { } - public function doValidatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) + public function doValidatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null) { return $this; } @@ -517,7 +517,7 @@ public function expectNoValidate() $this->expectNoValidate = true; } - public function expectValidation($call, $propertyPath, $value, $group, $constraints, ConstraintViolationInterface $violation = null) + public function expectValidation(string $call, string $propertyPath, $value, $group, callable $constraints, ConstraintViolationInterface $violation = null) { $this->expectedAtPath[$call] = $propertyPath; $this->expectedValidate[$call] = [$value, $group, $constraints, $violation]; diff --git a/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php b/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php index a8fce8da44f7c..31a88d115ac2f 100644 --- a/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php +++ b/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php @@ -28,8 +28,6 @@ interface ContextualValidatorInterface * If called multiple times, the path will always be reset to the context's * original path with the given path appended to it. * - * @param string $path The path to append - * * @return $this */ public function atPath(string $path); diff --git a/src/Symfony/Component/Validator/Validator/RecursiveValidator.php b/src/Symfony/Component/Validator/Validator/RecursiveValidator.php index 2c961895de178..d57c90847b829 100644 --- a/src/Symfony/Component/Validator/Validator/RecursiveValidator.php +++ b/src/Symfony/Component/Validator/Validator/RecursiveValidator.php @@ -97,7 +97,7 @@ public function validate($value, $constraints = null, $groups = null) /** * {@inheritdoc} */ - public function validateProperty($object, string $propertyName, $groups = null) + public function validateProperty(object $object, string $propertyName, $groups = null) { return $this->startContext($object) ->validateProperty($object, $propertyName, $groups) diff --git a/src/Symfony/Component/Validator/Validator/TraceableValidator.php b/src/Symfony/Component/Validator/Validator/TraceableValidator.php index 74a922fa4e1e2..fb0a196d89313 100644 --- a/src/Symfony/Component/Validator/Validator/TraceableValidator.php +++ b/src/Symfony/Component/Validator/Validator/TraceableValidator.php @@ -105,7 +105,7 @@ public function validate($value, $constraints = null, $groups = null) /** * {@inheritdoc} */ - public function validateProperty($object, string $propertyName, $groups = null) + public function validateProperty(object $object, string $propertyName, $groups = null) { return $this->validator->validateProperty($object, $propertyName, $groups); } diff --git a/src/Symfony/Component/Validator/ValidatorBuilder.php b/src/Symfony/Component/Validator/ValidatorBuilder.php index ce600242b5e76..ade30465a342f 100644 --- a/src/Symfony/Component/Validator/ValidatorBuilder.php +++ b/src/Symfony/Component/Validator/ValidatorBuilder.php @@ -115,7 +115,7 @@ public function addObjectInitializers(array $initializers) * * @return $this */ - public function addXmlMapping($path) + public function addXmlMapping(string $path) { if (null !== $this->metadataFactory) { throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); @@ -151,7 +151,7 @@ public function addXmlMappings(array $paths) * * @return $this */ - public function addYamlMapping($path) + public function addYamlMapping(string $path) { if (null !== $this->metadataFactory) { throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); @@ -185,7 +185,7 @@ public function addYamlMappings(array $paths) * * @return $this */ - public function addMethodMapping($methodName) + public function addMethodMapping(string $methodName) { if (null !== $this->metadataFactory) { throw new ValidatorException('You cannot add custom mappings after setting a custom metadata factory. Configure your metadata factory instead.'); @@ -341,7 +341,7 @@ public function setTranslator(TranslatorInterface $translator) * * @return $this */ - public function setTranslationDomain($translationDomain) + public function setTranslationDomain(?string $translationDomain) { $this->translationDomain = $translationDomain; diff --git a/src/Symfony/Component/VarDumper/Caster/DOMCaster.php b/src/Symfony/Component/VarDumper/Caster/DOMCaster.php index 5644e489f3614..4dd16e0ee7461 100644 --- a/src/Symfony/Component/VarDumper/Caster/DOMCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/DOMCaster.php @@ -82,7 +82,7 @@ public static function castLength($dom, array $a, Stub $stub, bool $isNested) return $a; } - public static function castImplementation($dom, array $a, Stub $stub, bool $isNested) + public static function castImplementation(\DOMImplementation $dom, array $a, Stub $stub, bool $isNested) { $a += [ Caster::PREFIX_VIRTUAL.'Core' => '1.0', diff --git a/src/Symfony/Component/VarDumper/Caster/RdKafkaCaster.php b/src/Symfony/Component/VarDumper/Caster/RdKafkaCaster.php index c3e4eb9f341c6..db4bba8d38d40 100644 --- a/src/Symfony/Component/VarDumper/Caster/RdKafkaCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/RdKafkaCaster.php @@ -31,7 +31,7 @@ */ class RdKafkaCaster { - public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, $isNested) + public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -51,7 +51,7 @@ public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, return $a; } - public static function castTopic(Topic $c, array $a, Stub $stub, $isNested) + public static function castTopic(Topic $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -75,7 +75,7 @@ public static function castTopicPartition(TopicPartition $c, array $a) return $a; } - public static function castMessage(Message $c, array $a, Stub $stub, $isNested) + public static function castMessage(Message $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -86,7 +86,7 @@ public static function castMessage(Message $c, array $a, Stub $stub, $isNested) return $a; } - public static function castConf(Conf $c, array $a, Stub $stub, $isNested) + public static function castConf(Conf $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -97,7 +97,7 @@ public static function castConf(Conf $c, array $a, Stub $stub, $isNested) return $a; } - public static function castTopicConf(TopicConf $c, array $a, Stub $stub, $isNested) + public static function castTopicConf(TopicConf $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -108,7 +108,7 @@ public static function castTopicConf(TopicConf $c, array $a, Stub $stub, $isNest return $a; } - public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, $isNested) + public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -121,14 +121,14 @@ public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, $isNested) return $a; } - public static function castCollectionMetadata(CollectionMetadata $c, array $a, Stub $stub, $isNested) + public static function castCollectionMetadata(CollectionMetadata $c, array $a, Stub $stub, bool $isNested) { $a += iterator_to_array($c); return $a; } - public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub, $isNested) + public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -140,7 +140,7 @@ public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub, return $a; } - public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stub $stub, $isNested) + public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -153,7 +153,7 @@ public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stu return $a; } - public static function castBrokerMetadata(BrokerMetadata $c, array $a, Stub $stub, $isNested) + public static function castBrokerMetadata(BrokerMetadata $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; diff --git a/src/Symfony/Component/VarDumper/Caster/ResourceCaster.php b/src/Symfony/Component/VarDumper/Caster/ResourceCaster.php index 81b7b1a98a384..6ae908524f6c1 100644 --- a/src/Symfony/Component/VarDumper/Caster/ResourceCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ResourceCaster.php @@ -60,7 +60,7 @@ public static function castStreamContext($stream, array $a, Stub $stub, bool $is return @stream_context_get_params($stream) ?: $a; } - public static function castGd($gd, array $a, Stub $stub, $isNested) + public static function castGd($gd, array $a, Stub $stub, bool $isNested) { $a['size'] = imagesx($gd).'x'.imagesy($gd); $a['trueColor'] = imageistruecolor($gd); diff --git a/src/Symfony/Component/VarDumper/Caster/SplCaster.php b/src/Symfony/Component/VarDumper/Caster/SplCaster.php index 11f1723d964a4..07f445116f660 100644 --- a/src/Symfony/Component/VarDumper/Caster/SplCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/SplCaster.php @@ -39,7 +39,7 @@ public static function castArrayIterator(\ArrayIterator $c, array $a, Stub $stub return self::castSplArray($c, $a, $stub, $isNested); } - public static function castHeap(\Iterator $c, array $a, Stub $stub, $isNested) + public static function castHeap(\Iterator $c, array $a, Stub $stub, bool $isNested) { $a += [ Caster::PREFIX_VIRTUAL.'heap' => iterator_to_array(clone $c), diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index ab919e155850e..97cda3380981e 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -324,7 +324,7 @@ public function leaveHash(Cursor $cursor, int $type, $class, bool $hasChild, int * @param bool $hasChild When the dump of the hash has child item * @param int $cut The number of items the hash has been cut by */ - protected function dumpEllipsis(Cursor $cursor, $hasChild, $cut) + protected function dumpEllipsis(Cursor $cursor, bool $hasChild, int $cut) { if ($cut) { $this->line .= ' …'; @@ -428,7 +428,7 @@ protected function dumpKey(Cursor $cursor) * * @return string The value with style decoration */ - protected function style($style, $value, $attr = []) + protected function style(string $style, string $value, array $attr = []) { if (null === $this->colors) { $this->colors = $this->supportsColors(); diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index 45285189805bc..aebbcfbe657c7 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -116,21 +116,16 @@ public function setDisplayOptions(array $displayOptions) /** * Sets an HTML header that will be dumped once in the output stream. - * - * @param string $header An HTML string */ - public function setDumpHeader($header) + public function setDumpHeader(string $header) { $this->dumpHeader = $header; } /** * Sets an HTML prefix and suffix that will encapse every single dump. - * - * @param string $prefix The prepended HTML string - * @param string $suffix The appended HTML string */ - public function setDumpBoundaries($prefix, $suffix) + public function setDumpBoundaries(string $prefix, string $suffix) { $this->dumpPrefix = $prefix; $this->dumpSuffix = $suffix; @@ -851,7 +846,7 @@ public function leaveHash(Cursor $cursor, int $type, $class, bool $hasChild, int /** * {@inheritdoc} */ - protected function style($style, $value, $attr = []) + protected function style(string $style, string $value, array $attr = []) { if ('' === $value) { return ''; pFad - Phonifier reborn

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

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


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy