diff --git a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php index 101c61f07882a..f8984bd627a09 100644 --- a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php +++ b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php @@ -133,7 +133,7 @@ public function format(array $record) /** * @internal */ - public function echoLine($line, $depth, $indentPad) + public function echoLine(string $line, int $depth, string $indentPad) { if (-1 !== $depth) { fwrite($this->outputBuffer, $line); @@ -143,7 +143,7 @@ public function echoLine($line, $depth, $indentPad) /** * @internal */ - public function castObject($v, array $a, Stub $s, $isNested) + public function castObject($v, array $a, Stub $s, bool $isNested) { if ($this->options['multiline']) { return $a; diff --git a/src/Symfony/Component/BrowserKit/CookieJar.php b/src/Symfony/Component/BrowserKit/CookieJar.php index bc9b781bb2b7d..3a585bed668f3 100644 --- a/src/Symfony/Component/BrowserKit/CookieJar.php +++ b/src/Symfony/Component/BrowserKit/CookieJar.php @@ -106,9 +106,8 @@ public function clear() * Updates the cookie jar from a response Set-Cookie headers. * * @param string[] $setCookies Set-Cookie headers from an HTTP response - * @param string $uri The base URL */ - public function updateFromSetCookie(array $setCookies, $uri = null) + public function updateFromSetCookie(array $setCookies, string $uri = null) { $cookies = []; @@ -133,8 +132,6 @@ public function updateFromSetCookie(array $setCookies, $uri = null) /** * Updates the cookie jar from a Response object. - * - * @param string $uri The base URL */ public function updateFromResponse(Response $response, string $uri = null) { diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index ea0453e7e951c..d7a3f0d80432a 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -332,11 +332,9 @@ protected function normalizeValue($value) /** * Remaps multiple singular values to a single plural value. * - * @param array $value The source values - * * @return array The remapped values */ - protected function remapXml($value) + protected function remapXml(array $value) { foreach ($this->xmlRemappings as list($singular, $plural)) { if (!isset($value[$singular])) { diff --git a/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php b/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php index 6c14beee4b6f9..32f32e0a6b424 100644 --- a/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php +++ b/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php @@ -31,7 +31,7 @@ public function dump(ConfigurationInterface $configuration, string $namespace = return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree(), $namespace); } - public function dumpNode(NodeInterface $node, $namespace = null) + public function dumpNode(NodeInterface $node, string $namespace = null) { $this->reference = ''; $this->writeNode($node, 0, true, $namespace); diff --git a/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php b/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php index c53481bd96a63..757963d42a9be 100644 --- a/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php +++ b/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php @@ -33,7 +33,7 @@ public function dump(ConfigurationInterface $configuration) return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree()); } - public function dumpAtPath(ConfigurationInterface $configuration, $path) + public function dumpAtPath(ConfigurationInterface $configuration, string $path) { $rootNode = $node = $configuration->getConfigTreeBuilder()->buildTree(); diff --git a/src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php b/src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php index 3dbc57b15317f..fcaaf49435f9d 100644 --- a/src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php +++ b/src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php @@ -34,10 +34,8 @@ public function getPath() /** * Adds extra information that is suffixed to the original exception message. - * - * @param string $hint */ - public function addHint($hint) + public function addHint(string $hint) { if (!$this->containsHints) { $this->message .= "\nHint: ".$hint; diff --git a/src/Symfony/Component/Config/FileLocator.php b/src/Symfony/Component/Config/FileLocator.php index c817746d93702..965f940d45dcc 100644 --- a/src/Symfony/Component/Config/FileLocator.php +++ b/src/Symfony/Component/Config/FileLocator.php @@ -35,7 +35,7 @@ public function __construct($paths = []) */ public function locate(string $name, string $currentPath = null, bool $first = true) { - if ('' == $name) { + if ('' === $name) { throw new \InvalidArgumentException('An empty file name is not valid to be located.'); } diff --git a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php index c6ba668977a1c..5eb1488ee3fbd 100644 --- a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php +++ b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php @@ -128,7 +128,7 @@ public function __sleep(): array * * @internal */ - public static function throwOnRequiredClass($class, \Exception $previous = null) + public static function throwOnRequiredClass(string $class, \Exception $previous = null) { // If the passed class is the resource being checked, we shouldn't throw. if (null === $previous && self::$autoloadedClass === $class) { diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php index 1d9e86561b31b..97b159a0c1391 100644 --- a/src/Symfony/Component/Config/Util/XmlUtils.php +++ b/src/Symfony/Component/Config/Util/XmlUtils.php @@ -247,7 +247,7 @@ public static function phpize($value) } } - protected static function getXmlErrors($internalErrors) + protected static function getXmlErrors(bool $internalErrors) { $errors = []; foreach (libxml_get_errors() as $error) { diff --git a/src/Symfony/Component/Console/Question/ChoiceQuestion.php b/src/Symfony/Component/Console/Question/ChoiceQuestion.php index a4b302db3e18f..020b733f132ac 100644 --- a/src/Symfony/Component/Console/Question/ChoiceQuestion.php +++ b/src/Symfony/Component/Console/Question/ChoiceQuestion.php @@ -58,11 +58,9 @@ public function getChoices() * * When multiselect is set to true, multiple choices can be answered. * - * @param bool $multiselect - * * @return $this */ - public function setMultiselect($multiselect) + public function setMultiselect(bool $multiselect) { $this->multiselect = $multiselect; $this->setValidator($this->getDefaultValidator()); @@ -93,11 +91,9 @@ public function getPrompt() /** * Sets the prompt for choices. * - * @param string $prompt - * * @return $this */ - public function setPrompt($prompt) + public function setPrompt(string $prompt) { $this->prompt = $prompt; @@ -109,11 +105,9 @@ public function setPrompt($prompt) * * The error message has a string placeholder (%s) for the invalid value. * - * @param string $errorMessage - * * @return $this */ - public function setErrorMessage($errorMessage) + public function setErrorMessage(string $errorMessage) { $this->errorMessage = $errorMessage; $this->setValidator($this->getDefaultValidator()); diff --git a/src/Symfony/Component/Console/Question/Question.php b/src/Symfony/Component/Console/Question/Question.php index 6d02c4af0944f..a85851bc500bb 100644 --- a/src/Symfony/Component/Console/Question/Question.php +++ b/src/Symfony/Component/Console/Question/Question.php @@ -130,14 +130,11 @@ public function getAutocompleterValues() /** * Sets values for the autocompleter. * - * @param iterable|null $values - * * @return $this * - * @throws InvalidArgumentException * @throws LogicException */ - public function setAutocompleterValues($values) + public function setAutocompleterValues(?iterable $values) { if (\is_array($values)) { $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values); @@ -150,10 +147,8 @@ public function setAutocompleterValues($values) $callback = static function () use ($values, &$valueCache) { return $valueCache ?? $valueCache = iterator_to_array($values, false); }; - } elseif (null === $values) { - $callback = null; } else { - throw new InvalidArgumentException('Autocompleter values can be either an array, "null" or a "Traversable" object.'); + $callback = null; } return $this->setAutocompleterCallback($callback); @@ -212,13 +207,11 @@ public function getValidator() * * Null means an unlimited number of attempts. * - * @param int|null $attempts - * * @return $this * * @throws InvalidArgumentException in case the number of attempts is invalid */ - public function setMaxAttempts($attempts) + public function setMaxAttempts(?int $attempts) { if (null !== $attempts && $attempts < 1) { throw new InvalidArgumentException('Maximum number of attempts must be a positive value.'); @@ -267,7 +260,7 @@ public function getNormalizer() return $this->normalizer; } - protected function isAssoc($array) + protected function isAssoc(array $array) { return (bool) \count(array_filter(array_keys($array), 'is_string')); } diff --git a/src/Symfony/Component/Console/Tests/Question/QuestionTest.php b/src/Symfony/Component/Console/Tests/Question/QuestionTest.php index 59b714291a8e2..9b3cabfc1da33 100644 --- a/src/Symfony/Component/Console/Tests/Question/QuestionTest.php +++ b/src/Symfony/Component/Console/Tests/Question/QuestionTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Console\Tests\Question; use PHPUnit\Framework\TestCase; -use Symfony\Component\Console\Exception\InvalidArgumentException; use Symfony\Component\Console\Question\Question; class QuestionTest extends TestCase @@ -150,10 +149,7 @@ public function providerSetAutocompleterValuesInvalid() */ public function testSetAutocompleterValuesInvalid($values) { - self::expectException(InvalidArgumentException::class); - self::expectExceptionMessage( - 'Autocompleter values can be either an array, "null" or a "Traversable" object.' - ); + self::expectException(\TypeError::class); $this->question->setAutocompleterValues($values); } @@ -271,7 +267,7 @@ public function testGetSetMaxAttempts($attempts) public function providerSetMaxAttemptsInvalid() { - return [['Potato'], [0], [-1]]; + return [[0], [-1]]; } /** diff --git a/src/Symfony/Component/EventDispatcher/GenericEvent.php b/src/Symfony/Component/EventDispatcher/GenericEvent.php index 62bd59c903c08..34b95cedee817 100644 --- a/src/Symfony/Component/EventDispatcher/GenericEvent.php +++ b/src/Symfony/Component/EventDispatcher/GenericEvent.php @@ -50,13 +50,11 @@ public function getSubject() /** * Get argument by key. * - * @param string $key Key - * * @return mixed Contents of array key * * @throws \InvalidArgumentException if key is not found */ - public function getArgument($key) + public function getArgument(string $key) { if ($this->hasArgument($key)) { return $this->arguments[$key]; @@ -68,12 +66,11 @@ public function getArgument($key) /** * Add argument to event. * - * @param string $key Argument name - * @param mixed $value Value + * @param mixed $value Value * * @return $this */ - public function setArgument($key, $value) + public function setArgument(string $key, $value) { $this->arguments[$key] = $value; @@ -93,8 +90,6 @@ public function getArguments() /** * Set args property. * - * @param array $args Arguments - * * @return $this */ public function setArguments(array $args = []) @@ -107,11 +102,9 @@ public function setArguments(array $args = []) /** * Has argument. * - * @param string $key Key of arguments array - * * @return bool */ - public function hasArgument($key) + public function hasArgument(string $key) { return \array_key_exists($key, $this->arguments); } diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php index 325f61f11232e..2dfbbf17d60d1 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php @@ -158,7 +158,7 @@ public function reverseTransform($value) * * @throws TransformationFailedException in case the date formatter can not be constructed */ - protected function getIntlDateFormatter($ignoreTimezone = false) + protected function getIntlDateFormatter(bool $ignoreTimezone = false) { $dateFormat = $this->dateFormat; $timeFormat = $this->timeFormat; diff --git a/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php b/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php index 09a7383c23029..d402d311372b6 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php @@ -87,7 +87,7 @@ public function getBlockPrefix() * The pattern contains the placeholder "{{ widget }}" where the HTML tag should * be inserted */ - protected static function getPattern($currency) + protected static function getPattern(?string $currency) { if (!$currency) { return '{{ widget }}'; diff --git a/src/Symfony/Component/HttpFoundation/JsonResponse.php b/src/Symfony/Component/HttpFoundation/JsonResponse.php index f2a4e60b13b60..8489bc0b16133 100644 --- a/src/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/src/Symfony/Component/HttpFoundation/JsonResponse.php @@ -83,7 +83,7 @@ public static function create($data = null, int $status = 200, array $headers = * * @return static */ - public static function fromJsonString($data = null, int $status = 200, array $headers = []) + public static function fromJsonString(string $data = null, int $status = 200, array $headers = []) { return new static($data, $status, $headers, true); } diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php index b84991e31b82d..920903082e6a8 100644 --- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php +++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php @@ -153,7 +153,7 @@ public function execute() * * @internal */ - public function getResource($idx = 0) + public function getResource(int $idx = 0) { if (null === $this->results || $idx >= \count($this->results)) { return null; diff --git a/src/Symfony/Component/Ldap/Security/LdapUserProvider.php b/src/Symfony/Component/Ldap/Security/LdapUserProvider.php index 2a6620f270b96..48864761c165a 100644 --- a/src/Symfony/Component/Ldap/Security/LdapUserProvider.php +++ b/src/Symfony/Component/Ldap/Security/LdapUserProvider.php @@ -146,7 +146,7 @@ public function supportsClass(string $class) * * @return LdapUser */ - protected function loadUser($username, Entry $entry) + protected function loadUser(string $username, Entry $entry) { $password = null; $extraFields = []; diff --git a/src/Symfony/Component/Lock/Key.php b/src/Symfony/Component/Lock/Key.php index c53892ab6bed2..bc09b888887b1 100644 --- a/src/Symfony/Component/Lock/Key.php +++ b/src/Symfony/Component/Lock/Key.php @@ -60,7 +60,7 @@ public function resetLifetime() /** * @param float $ttl the expiration delay of locks in seconds */ - public function reduceLifetime($ttl) + public function reduceLifetime(float $ttl) { $newTime = microtime(true) + $ttl; diff --git a/src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php b/src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php index 623717fcafe07..f7b30a7b24216 100644 --- a/src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php +++ b/src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php @@ -30,7 +30,7 @@ abstract class AbstractStream private $debug = ''; - public function write(string $bytes, $debug = true): void + public function write(string $bytes, bool $debug = true): void { if ($debug) { foreach (explode("\n", trim($bytes)) as $line) { diff --git a/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php b/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php index 67817a3d86ab1..782e44677584d 100644 --- a/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php +++ b/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php @@ -63,7 +63,7 @@ public function getConfiguration(): array return $this->configuration; } - public static function buildConfiguration($dsn, array $options = []): array + public static function buildConfiguration(string $dsn, array $options = []): array { if (false === $components = parse_url($dsn)) { throw new InvalidArgumentException(sprintf('The given Doctrine Messenger DSN "%s" is invalid.', $dsn)); diff --git a/src/Symfony/Component/Messenger/Worker.php b/src/Symfony/Component/Messenger/Worker.php index d531b1af3f512..e872c9642bf83 100644 --- a/src/Symfony/Component/Messenger/Worker.php +++ b/src/Symfony/Component/Messenger/Worker.php @@ -178,7 +178,7 @@ public function stop(): void $this->shouldStop = true; } - private function dispatchEvent($event) + private function dispatchEvent(object $event): void { if (null === $this->eventDispatcher) { return; diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 2f6cc944545cb..db9e7a2735eac 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -602,7 +602,7 @@ public function getIncrementalOutput() * * @return \Generator */ - public function getIterator($flags = 0) + public function getIterator(int $flags = 0) { $this->readPipesForOutput(__FUNCTION__, false); @@ -995,13 +995,11 @@ public function getIdleTimeout() * * To disable the timeout, set this value to null. * - * @param int|float|null $timeout The timeout in seconds - * * @return $this * * @throws InvalidArgumentException if the timeout is negative */ - public function setTimeout($timeout) + public function setTimeout(?float $timeout) { $this->timeout = $this->validateTimeout($timeout); @@ -1009,18 +1007,16 @@ public function setTimeout($timeout) } /** - * Sets the process idle timeout (max. time since last output). + * Sets the process idle timeout (max. time since last output) in seconds. * * To disable the timeout, set this value to null. * - * @param int|float|null $timeout The timeout in seconds - * * @return $this * * @throws LogicException if the output is disabled * @throws InvalidArgumentException if the timeout is negative */ - public function setIdleTimeout($timeout) + public function setIdleTimeout(?float $timeout) { if (null !== $timeout && $this->outputDisabled) { throw new LogicException('Idle timeout can not be set while the output is disabled.'); @@ -1048,7 +1044,7 @@ public function setTty(bool $tty) throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.'); } - $this->tty = (bool) $tty; + $this->tty = $tty; return $this; } diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index 642924dd924fb..476e75a413d47 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -131,7 +131,7 @@ public function getProperties(string $class, array $context = []): ?array /** * {@inheritdoc} */ - public function getTypes(string $class, $property, array $context = []): ?array + public function getTypes(string $class, string $property, array $context = []): ?array { if ($fromMutator = $this->extractFromMutator($class, $property)) { return $fromMutator; @@ -158,7 +158,7 @@ public function getTypes(string $class, $property, array $context = []): ?array /** * {@inheritdoc} */ - public function isReadable(string $class, $property, array $context = []): ?bool + public function isReadable(string $class, string $property, array $context = []): ?bool { if ($this->isAllowedProperty($class, $property)) { return true; @@ -172,7 +172,7 @@ public function isReadable(string $class, $property, array $context = []): ?bool /** * {@inheritdoc} */ - public function isWritable(string $class, $property, array $context = []): ?bool + public function isWritable(string $class, string $property, array $context = []): ?bool { if ($this->isAllowedProperty($class, $property)) { return true; diff --git a/src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php b/src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php index b64d267b4868c..f082377fa0082 100644 --- a/src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php +++ b/src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php @@ -39,7 +39,7 @@ public function __construct(string $message = '', array $messageData = [], int $ * @param string $messageKey The message or message key * @param array $messageData Data to be passed into the translator */ - public function setSafeMessage($messageKey, array $messageData = []) + public function setSafeMessage(string $messageKey, array $messageData = []) { $this->messageKey = $messageKey; $this->messageData = $messageData; diff --git a/src/Symfony/Component/Security/Core/Exception/UsernameNotFoundException.php b/src/Symfony/Component/Security/Core/Exception/UsernameNotFoundException.php index 31dd486eec12d..e1f816bc6b094 100644 --- a/src/Symfony/Component/Security/Core/Exception/UsernameNotFoundException.php +++ b/src/Symfony/Component/Security/Core/Exception/UsernameNotFoundException.php @@ -41,10 +41,8 @@ public function getUsername() /** * Set the username. - * - * @param string $username */ - public function setUsername($username) + public function setUsername(string $username) { $this->username = $username; } diff --git a/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php b/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php index 6d134c4ab3381..c6b721209f363 100644 --- a/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php +++ b/src/Symfony/Component/Security/Http/Logout/LogoutUrlGenerator.php @@ -47,7 +47,7 @@ public function __construct(RequestStack $requestStack = null, UrlGeneratorInter * @param string|null $csrfParameter The CSRF token parameter name * @param string|null $context The listener context */ - public function registerListener($key, $logoutPath, $csrfTokenId, $csrfParameter, CsrfTokenManagerInterface $csrfTokenManager = null, string $context = null) + public function registerListener(string $key, string $logoutPath, ?string $csrfTokenId, ?string $csrfParameter, CsrfTokenManagerInterface $csrfTokenManager = null, string $context = null) { $this->listeners[$key] = [$logoutPath, $csrfTokenId, $csrfParameter, $csrfTokenManager, $context]; } diff --git a/src/Symfony/Component/Translation/DataCollectorTranslator.php b/src/Symfony/Component/Translation/DataCollectorTranslator.php index fedc79ccd13b5..c46e058c9ecbd 100644 --- a/src/Symfony/Component/Translation/DataCollectorTranslator.php +++ b/src/Symfony/Component/Translation/DataCollectorTranslator.php @@ -106,7 +106,7 @@ public function getFallbackLocales() /** * Passes through all unknown calls onto the translator object. */ - public function __call($method, $args) + public function __call(string $method, array $args) { return $this->translator->{$method}(...$args); } diff --git a/src/Symfony/Component/Translation/Extractor/PhpExtractor.php b/src/Symfony/Component/Translation/Extractor/PhpExtractor.php index db9c2bda4e5e7..aa2ebc637dbb3 100644 --- a/src/Symfony/Component/Translation/Extractor/PhpExtractor.php +++ b/src/Symfony/Component/Translation/Extractor/PhpExtractor.php @@ -226,13 +226,11 @@ protected function parseTokens(array $tokens, MessageCatalogue $catalog, string } /** - * @param string $file - * * @return bool * * @throws \InvalidArgumentException */ - protected function canBeExtracted($file) + protected function canBeExtracted(string $file) { return $this->isFile($file) && 'php' === pathinfo($file, PATHINFO_EXTENSION); } diff --git a/src/Symfony/Component/Translation/LoggingTranslator.php b/src/Symfony/Component/Translation/LoggingTranslator.php index 2f09747956ffc..2c9e97c1e9052 100644 --- a/src/Symfony/Component/Translation/LoggingTranslator.php +++ b/src/Symfony/Component/Translation/LoggingTranslator.php @@ -99,7 +99,7 @@ public function getFallbackLocales() /** * Passes through all unknown calls onto the translator object. */ - public function __call($method, $args) + public function __call(string $method, array $args) { return $this->translator->{$method}(...$args); } diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php index 945e16bf321d1..0ecfee378b83d 100644 --- a/src/Symfony/Component/Translation/Translator.php +++ b/src/Symfony/Component/Translation/Translator.php @@ -86,7 +86,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA */ public function __construct(string $locale, MessageFormatterInterface $formatter = null, string $cacheDir = null, bool $debug = false) { - $this->setLocale($locale, false); + $this->setLocale($locale); if (null === $formatter) { $formatter = new MessageFormatter(); @@ -118,8 +118,6 @@ public function addLoader(string $format, LoaderInterface $loader) * * @param string $format The name of the loader (@see addLoader()) * @param mixed $resource The resource name - * @param string $locale The locale - * @param string $domain The domain * * @throws InvalidArgumentException If the locale contains invalid characters */ @@ -383,7 +381,7 @@ private function loadFallbackCatalogues(string $locale): void } } - protected function computeFallbackLocales($locale) + protected function computeFallbackLocales(string $locale) { if (null === $this->parentLocales) { $parentLocales = json_decode(file_get_contents(__DIR__.'/Resources/data/parents.json'), true); diff --git a/src/Symfony/Component/VarExporter/Internal/Exporter.php b/src/Symfony/Component/VarExporter/Internal/Exporter.php index 87b3156d41efd..de7c9fcbe3967 100644 --- a/src/Symfony/Component/VarExporter/Internal/Exporter.php +++ b/src/Symfony/Component/VarExporter/Internal/Exporter.php @@ -187,7 +187,7 @@ public static function prepare($values, $objectsPool, &$refsPool, &$objectsCount return $values; } - public static function export($value, $indent = '') + public static function export($value, string $indent = '') { switch (true) { case \is_int($value) || \is_float($value): return var_export($value, true); diff --git a/src/Symfony/Component/Workflow/Event/GuardEvent.php b/src/Symfony/Component/Workflow/Event/GuardEvent.php index 2004fa6162629..e287b004af969 100644 --- a/src/Symfony/Component/Workflow/Event/GuardEvent.php +++ b/src/Symfony/Component/Workflow/Event/GuardEvent.php @@ -40,7 +40,7 @@ public function isBlocked() return !$this->transitionBlockerList->isEmpty(); } - public function setBlocked($blocked) + public function setBlocked(bool $blocked) { if (!$blocked) { $this->transitionBlockerList->clear(); diff --git a/src/Symfony/Component/Workflow/Registry.php b/src/Symfony/Component/Workflow/Registry.php index c65f238f339a9..e9e73b1889ecc 100644 --- a/src/Symfony/Component/Workflow/Registry.php +++ b/src/Symfony/Component/Workflow/Registry.php @@ -65,11 +65,7 @@ public function all(object $subject): array return $matched; } - /** - * @param WorkflowSupportStrategyInterface $supportStrategy - * @param object $subject - */ - private function supports(WorkflowInterface $workflow, $supportStrategy, $subject, ?string $workflowName): bool + private function supports(WorkflowInterface $workflow, WorkflowSupportStrategyInterface $supportStrategy, object $subject, ?string $workflowName): bool { if (null !== $workflowName && $workflowName !== $workflow->getName()) { return false;