minor #33302 Add more return types after fixing a typo in my script (nicolas-grekas)
This PR was merged into the 4.4 branch.
Discussion
----------
Add more return types after fixing a typo in my script
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
65d942010c
Add more return types after fixing a typo in my script
This commit is contained in:
commit
0fa1246e30
@ -31,10 +31,7 @@ class BaseUser
|
||||
$this->username = $username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
@ -153,8 +153,8 @@ class ClassThatInheritLogger extends Logger
|
||||
return parent::getLogs();
|
||||
}
|
||||
|
||||
public function countErrors()
|
||||
public function countErrors(): int
|
||||
{
|
||||
parent::countErrors();
|
||||
return parent::countErrors();
|
||||
}
|
||||
}
|
||||
|
@ -104,8 +104,8 @@ class ClassThatInheritDebugProcessor extends DebugProcessor
|
||||
return parent::getLogs();
|
||||
}
|
||||
|
||||
public function countErrors()
|
||||
public function countErrors(): int
|
||||
{
|
||||
parent::countErrors();
|
||||
return parent::countErrors();
|
||||
}
|
||||
}
|
||||
|
@ -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)%"');
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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. <comment>config:dump-reference FrameworkBundle profiler.matcher</comment> to dump the <comment>framework.profiler.matcher</comment> 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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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__);
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -137,11 +137,9 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function getUsageIndex()
|
||||
public function getUsageIndex(): int
|
||||
{
|
||||
return $this->usageIndex;
|
||||
}
|
||||
|
@ -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']);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -188,7 +188,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
|
||||
return IntlGlobals::getErrorMessage();
|
||||
}
|
||||
|
||||
protected function getIntlErrorCode()
|
||||
protected function getIntlErrorCode(): int
|
||||
{
|
||||
return IntlGlobals::getErrorCode();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -178,7 +178,7 @@ class NumberFormatterTest extends AbstractNumberFormatterTest
|
||||
return IntlGlobals::getErrorMessage();
|
||||
}
|
||||
|
||||
protected function getIntlErrorCode()
|
||||
protected function getIntlErrorCode(): int
|
||||
{
|
||||
return IntlGlobals::getErrorCode();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -31,7 +31,7 @@ class Exporter
|
||||
* @param int &$objectsCount
|
||||
* @param bool &$valuesAreStatic
|
||||
*
|
||||
* @return int
|
||||
* @return array
|
||||
*
|
||||
* @throws NotInstantiableTypeException When a value cannot be serialized
|
||||
*/
|
||||
|
@ -601,7 +601,7 @@ class EventDispatcherMock implements \Symfony\Component\EventDispatcher\EventDis
|
||||
{
|
||||
}
|
||||
|
||||
public function getListenerPriority($eventName, $listener)
|
||||
public function getListenerPriority($eventName, $listener): ?int
|
||||
{
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user