diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/BaseUser.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/BaseUser.php index 49c13e0d31..aa24cd6894 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/BaseUser.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/BaseUser.php @@ -31,10 +31,7 @@ class BaseUser $this->username = $username; } - /** - * @return int - */ - public function getId() + public function getId(): int { return $this->id; } diff --git a/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php index be4781d67f..3cf8d40e0b 100644 --- a/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php @@ -153,8 +153,8 @@ class ClassThatInheritLogger extends Logger return parent::getLogs(); } - public function countErrors() + public function countErrors(): int { - parent::countErrors(); + return parent::countErrors(); } } diff --git a/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php b/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php index ef859df0cd..7bd149c705 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Processor/DebugProcessorTest.php @@ -104,8 +104,8 @@ class ClassThatInheritDebugProcessor extends DebugProcessor return parent::getLogs(); } - public function countErrors() + public function countErrors(): int { - parent::countErrors(); + return parent::countErrors(); } } diff --git a/src/Symfony/Bundle/DebugBundle/Command/ServerDumpPlaceholderCommand.php b/src/Symfony/Bundle/DebugBundle/Command/ServerDumpPlaceholderCommand.php index ae69edfff7..7df85c70c9 100644 --- a/src/Symfony/Bundle/DebugBundle/Command/ServerDumpPlaceholderCommand.php +++ b/src/Symfony/Bundle/DebugBundle/Command/ServerDumpPlaceholderCommand.php @@ -43,7 +43,7 @@ class ServerDumpPlaceholderCommand extends Command $this->setDescription($this->replacedCommand->getDescription()); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { (new SymfonyStyle($input, $output))->getErrorStyle()->warning('In order to use the VarDumper server, set the "debug.dump_destination" config option to "tcp://%env(VAR_DUMPER_SERVER)%"'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index 111ed815c7..d38e89f0e9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -95,7 +95,7 @@ EOT /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { /** @var KernelInterface $kernel */ $kernel = $this->getApplication()->getKernel(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php index 05a5559171..60445e4063 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php @@ -74,7 +74,7 @@ EOF * * @throws \LogicException */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $errorIo = $io->getErrorStyle(); @@ -86,7 +86,7 @@ EOF 'For dumping a specific option, add its path as the second argument of this command. (e.g. config:dump-reference FrameworkBundle profiler.matcher to dump the framework.profiler.matcher configuration)', ]); - return null; + return 0; } $extension = $this->findExtension($name); @@ -130,6 +130,6 @@ EOF $io->writeln(null === $path ? $dumper->dump($configuration, $extension->getNamespace()) : $dumper->dumpAtPath($configuration, $path)); - return null; + return 0; } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php index a7bec8c146..04d391da17 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php @@ -69,7 +69,7 @@ EOF /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $errorIo = $io->getErrorStyle(); @@ -146,7 +146,7 @@ EOF $io->newLine(); - return null; + return 0; } private function getFileLink(string $class): string diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php index e7306b94b6..454767e6a8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php @@ -71,7 +71,7 @@ EOF /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); @@ -114,6 +114,6 @@ EOF return 1; } - return null; + return 0; } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php index 645bedfe0e..cc704ab5e4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php @@ -102,7 +102,7 @@ EOF /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $errorIo = $io->getErrorStyle(); @@ -236,7 +236,7 @@ EOF if (!\count($operation->getDomains())) { $errorIo->warning('No translation messages were found.'); - return null; + return 0; } $resultMessage = 'Translation files were successfully updated'; @@ -302,7 +302,7 @@ EOF $errorIo->success($resultMessage.'.'); - return null; + return 0; } private function filterCatalogue(MessageCatalogue $catalogue, string $domain): MessageCatalogue diff --git a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php index 01f2b82356..c80e3c4bb1 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php @@ -101,7 +101,7 @@ EOF /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $errorIo = $output instanceof ConsoleOutputInterface ? new SymfonyStyle($input, $output->getErrorOutput()) : $io; @@ -163,7 +163,7 @@ EOF $errorIo->success('Password encoding succeeded'); - return null; + return 0; } /** diff --git a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php index 237c726822..0e183ced99 100644 --- a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php +++ b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php @@ -131,6 +131,9 @@ trait FilesystemCommonTrait throw new \ErrorException($message, 0, $type, $file, $line); } + /** + * @return array + */ public function __sleep() { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index 18d683de93..1420eda667 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -150,7 +150,7 @@ class Command * execute() method, you set the code to execute by passing * a Closure to the setCode() method. * - * @return int|null null or 0 if everything went fine, or an error code + * @return int|void void or 0 if everything went fine, or an exit code * * @throws LogicException When this abstract method is not implemented * diff --git a/src/Symfony/Component/CssSelector/Node/Specificity.php b/src/Symfony/Component/CssSelector/Node/Specificity.php index 9b35cb4116..d0ac8aa1d7 100644 --- a/src/Symfony/Component/CssSelector/Node/Specificity.php +++ b/src/Symfony/Component/CssSelector/Node/Specificity.php @@ -53,10 +53,8 @@ class Specificity /** * Returns -1 if the object specificity is lower than the argument, * 0 if they are equal, and 1 if the argument is lower. - * - * @return int */ - public function compareTo(self $specificity) + public function compareTo(self $specificity): int { if ($this->a !== $specificity->a) { return $this->a > $specificity->a ? 1 : -1; diff --git a/src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php b/src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php index a3efdf31c6..09b58f00ed 100644 --- a/src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php +++ b/src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php @@ -124,7 +124,7 @@ final class LegacyEventDispatcherProxy implements EventDispatcherInterface /** * {@inheritdoc} */ - public function getListenerPriority($eventName, $listener) + public function getListenerPriority($eventName, $listener): ?int { return $this->dispatcher->getListenerPriority($eventName, $listener); } diff --git a/src/Symfony/Component/HttpFoundation/Session/Session.php b/src/Symfony/Component/HttpFoundation/Session/Session.php index 0c7e9cc5ca..9738189b40 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Session.php +++ b/src/Symfony/Component/HttpFoundation/Session/Session.php @@ -137,11 +137,9 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable } /** - * @return int - * * @internal */ - public function getUsageIndex() + public function getUsageIndex(): int { return $this->usageIndex; } diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php index 7c2cb9d192..968429b8f7 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php @@ -159,7 +159,7 @@ class ExceptionListenerTest extends TestCase class TestLogger extends Logger implements DebugLoggerInterface { - public function countErrors() + public function countErrors(): int { return \count($this->logs['critical']); } diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php index cf7a563b25..cee6b548a2 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php @@ -967,10 +967,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase abstract protected function getIntlErrorMessage(): string; - /** - * @return int - */ - abstract protected function getIntlErrorCode(); + abstract protected function getIntlErrorCode(): int; /** * @param int $errorCode diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php index 2c043e235f..10f95c013b 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php @@ -188,7 +188,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest return IntlGlobals::getErrorMessage(); } - protected function getIntlErrorCode() + protected function getIntlErrorCode(): int { return IntlGlobals::getErrorCode(); } diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php index a993ace5cb..50cccd993b 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php @@ -73,7 +73,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest return intl_get_error_message(); } - protected function getIntlErrorCode() + protected function getIntlErrorCode(): int { return intl_get_error_code(); } diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php index 6a6e4ef628..9802a66b9a 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php @@ -842,10 +842,7 @@ abstract class AbstractNumberFormatterTest extends TestCase abstract protected function getIntlErrorMessage(): string; - /** - * @return int - */ - abstract protected function getIntlErrorCode(); + abstract protected function getIntlErrorCode(): int; /** * @param int $errorCode diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php index 8faca56818..058e03756c 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php @@ -178,7 +178,7 @@ class NumberFormatterTest extends AbstractNumberFormatterTest return IntlGlobals::getErrorMessage(); } - protected function getIntlErrorCode() + protected function getIntlErrorCode(): int { return IntlGlobals::getErrorCode(); } diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php index 1209180e89..edec2e9639 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php @@ -49,7 +49,7 @@ class NumberFormatterTest extends AbstractNumberFormatterTest return intl_get_error_message(); } - protected function getIntlErrorCode() + protected function getIntlErrorCode(): int { return intl_get_error_code(); } diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php index 4f01c6f3ca..949770e88f 100644 --- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php +++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php @@ -73,11 +73,9 @@ final class ConnectionOptions * * @param string $name * - * @return int - * * @throws LdapException */ - public static function getOption($name) + public static function getOption($name): int { // Convert $constantName = self::getOptionName($name); diff --git a/src/Symfony/Component/Security/Core/Authorization/Voter/TraceableVoter.php b/src/Symfony/Component/Security/Core/Authorization/Voter/TraceableVoter.php index e5ce1f696b..d5fec633ab 100644 --- a/src/Symfony/Component/Security/Core/Authorization/Voter/TraceableVoter.php +++ b/src/Symfony/Component/Security/Core/Authorization/Voter/TraceableVoter.php @@ -34,7 +34,7 @@ class TraceableVoter implements VoterInterface $this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher); } - public function vote(TokenInterface $token, $subject, array $attributes) + public function vote(TokenInterface $token, $subject, array $attributes): int { $result = $this->voter->vote($token, $subject, $attributes); diff --git a/src/Symfony/Component/VarExporter/Internal/Exporter.php b/src/Symfony/Component/VarExporter/Internal/Exporter.php index c0b7fa17f4..1b0bda7118 100644 --- a/src/Symfony/Component/VarExporter/Internal/Exporter.php +++ b/src/Symfony/Component/VarExporter/Internal/Exporter.php @@ -31,7 +31,7 @@ class Exporter * @param int &$objectsCount * @param bool &$valuesAreStatic * - * @return int + * @return array * * @throws NotInstantiableTypeException When a value cannot be serialized */ diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php index 26f58a1fa5..58caa122ea 100644 --- a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php +++ b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php @@ -601,7 +601,7 @@ class EventDispatcherMock implements \Symfony\Component\EventDispatcher\EventDis { } - public function getListenerPriority($eventName, $listener) + public function getListenerPriority($eventName, $listener): ?int { }