diff --git a/UPGRADE-4.4.md b/UPGRADE-4.4.md
index 63456df5a9d5a..5f08a1599b08b 100644
--- a/UPGRADE-4.4.md
+++ b/UPGRADE-4.4.md
@@ -10,6 +10,7 @@ Console
-------
* Deprecated finding hidden commands using an abbreviation, use the full name instead
+ * Deprecated returning `null` from `Command::execute()`, return `0` instead
Debug
-----
diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md
index 52bccb7f24f0e..ab1af5848978f 100644
--- a/UPGRADE-5.0.md
+++ b/UPGRADE-5.0.md
@@ -37,6 +37,7 @@ Console
* Removed the `getHorizontalBorderChar()` method in favor of the `getBorderChars()` method in `TableStyle`.
* Removed the `setVerticalBorderChar()` method in favor of the `setVerticalBorderChars()` method in `TableStyle`.
* Removed the `getVerticalBorderChar()` method in favor of the `getBorderChars()` method in `TableStyle`.
+ * Removed support for returning `null` from `Command::execute()`, return `0` instead
* The `ProcessHelper::run()` method takes the command as an array of arguments.
Before:
diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php
index 7a6ef63609a29..b3a2c44df3139 100644
--- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php
+++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php
@@ -111,12 +111,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
switch ($input->getOption('format')) {
case 'text':
- return $name ? $this->displayPathsText($io, $name) : $this->displayGeneralText($io, $filter);
+ $name ? $this->displayPathsText($io, $name) : $this->displayGeneralText($io, $filter);
+ break;
case 'json':
- return $name ? $this->displayPathsJson($io, $name) : $this->displayGeneralJson($io, $filter);
+ $name ? $this->displayPathsJson($io, $name) : $this->displayGeneralJson($io, $filter);
+ break;
default:
throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $input->getOption('format')));
}
+
+ return 0;
}
private function displayPathsText(SymfonyStyle $io, string $name)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
index cf3e946f6a6a5..0ca4172de4075 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
@@ -54,7 +54,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
@@ -100,6 +100,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$io->table([], $rows);
+
+ return 0;
}
private static function formatPath(string $path, string $baseDir): string
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
index 24aa8171ca5ef..6711e456b10a0 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
@@ -72,7 +72,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$fs = $this->filesystem;
$io = new SymfonyStyle($input, $output);
@@ -175,6 +175,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully cleared.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
+
+ return 0;
}
private function warmup(string $warmupDir, string $realCacheDir, bool $enableOptionalWarmers = true)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php
index dc42910d34325..50aacd9bbd73d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php
@@ -60,7 +60,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$kernel = $this->getApplication()->getKernel();
@@ -99,5 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$io->success('Cache was successfully cleared.');
+
+ return 0;
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolDeleteCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolDeleteCommand.php
index 656f9a9de302d..2a7a2fe513040 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolDeleteCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolDeleteCommand.php
@@ -59,7 +59,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$pool = $input->getArgument('pool');
@@ -69,7 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!$cachePool->hasItem($key)) {
$io->note(sprintf('Cache item "%s" does not exist in cache pool "%s".', $key, $pool));
- return;
+ return 0;
}
if (!$cachePool->deleteItem($key)) {
@@ -77,5 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$io->success(sprintf('Cache item "%s" was successfully deleted.', $key));
+
+ return 0;
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolListCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolListCommand.php
index 4f399ab61556a..7b725411d5015 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolListCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolListCommand.php
@@ -51,12 +51,14 @@ protected function configure()
/**
* {@inheritdoc}
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$io->table(['Pool name'], array_map(function ($pool) {
return [$pool];
}, $this->poolNames));
+
+ return 0;
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolPruneCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolPruneCommand.php
index 74b53063784b7..65f3ff6b5802e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolPruneCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolPruneCommand.php
@@ -57,7 +57,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
@@ -67,5 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$io->success('Successfully pruned cache pool(s).');
+
+ return 0;
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php
index 04b5d2f7c6b9f..0a87acf264191 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php
@@ -66,7 +66,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
@@ -80,5 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->cacheWarmer->warmUp($kernel->getContainer()->getParameter('kernel.cache_dir'));
$io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully warmed.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
+
+ return 0;
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php
index faadcb96b3aea..2aa631eb76e44 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php
@@ -63,7 +63,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$errorIo = $io->getErrorStyle();
@@ -73,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$errorIo->comment('Provide the name of a bundle as the first argument of this command to dump its configuration. (e.g. debug:config FrameworkBundle)');
$errorIo->comment('For dumping a specific option, add its path as the second argument of this command. (e.g. debug:config FrameworkBundle serializer to dump the framework.serializer configuration)');
- return;
+ return 0;
}
$extension = $this->findExtension($name);
@@ -101,7 +101,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$io->writeln(Yaml::dump([$extensionAlias => $config], 10));
- return;
+ return 0;
}
try {
@@ -115,6 +115,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$io->title(sprintf('Current configuration for "%s.%s"', $extensionAlias, $path));
$io->writeln(Yaml::dump($config, 10));
+
+ return 0;
}
private function compileContainer(): ContainerBuilder
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
index dc8ea90ab4eb7..ef3a70d33ef1c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
@@ -114,7 +114,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
if ($input->getOption('show-private')) {
@trigger_error('The "--show-private" option no longer has any effect and is deprecated since Symfony 4.1.', E_USER_DEPRECATED);
@@ -184,6 +184,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$errorIo->comment('To search for a specific service, re-run this command with a search term. (e.g. debug:container log)');
}
}
+
+ return 0;
}
/**
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php
index e61f543e7f780..ad49cdeeaa87f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php
@@ -69,7 +69,7 @@ protected function configure()
*
* @throws \LogicException
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
@@ -78,7 +78,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!$this->dispatcher->hasListeners($event)) {
$io->getErrorStyle()->warning(sprintf('The event "%s" does not have any registered listeners.', $event));
- return;
+ return 0;
}
$options = ['event' => $event];
@@ -89,5 +89,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$options['raw_text'] = $input->getOption('raw');
$options['output'] = $io;
$helper->describe($io, $this->dispatcher, $options);
+
+ return 0;
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
index bad3fa0598a56..9724e5122e2c6 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
@@ -73,7 +73,7 @@ protected function configure()
*
* @throws InvalidArgumentException When route does not exist
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$name = $input->getArgument('name');
@@ -105,6 +105,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
'output' => $io,
]);
}
+
+ return 0;
}
private function findRouteNameContaining(string $name, RouteCollection $routes): array
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
index 85c1e52905758..124274d47427a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
@@ -124,7 +124,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
@@ -246,7 +246,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$io->getErrorStyle()->warning($outputMessage);
- return;
+ return 0;
}
// Load the fallback catalogues
@@ -295,6 +295,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$io->table($headers, $rows);
+
+ return 0;
}
private function formatState(int $state): string
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php
index ff91dc781837c..cec930da1c0da 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php
@@ -59,7 +59,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$container = $this->getApplication()->getKernel()->getContainer();
$serviceId = $input->getArgument('name');
@@ -97,5 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
],
];
$output->writeln($dumper->dump($workflow->getDefinition(), $marking, $options));
+
+ return 0;
}
}
diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php
index e8d51108ccab5..ff9e32f589b8f 100644
--- a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php
+++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php
@@ -123,6 +123,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->displayLog($input, $output, $clientId, $record);
}
+
+ return 0;
}
private function getLogs($socket)
diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php
index 86edd88af9e25..fb83cb28ed993 100644
--- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php
+++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php
@@ -164,6 +164,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}
- return null;
+ return 0;
}
}
diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php
index 21e808ec8a3ae..31edcee42d5cd 100644
--- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php
+++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php
@@ -103,6 +103,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
}
- return null;
+ return 0;
}
}
diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php
index 8d7eb0b2eab93..b64107f8c2c7a 100644
--- a/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php
+++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php
@@ -77,6 +77,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
return 1;
}
- return null;
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/CHANGELOG.md b/src/Symfony/Component/Console/CHANGELOG.md
index d1b8a324c6024..7d0c234e46b2f 100644
--- a/src/Symfony/Component/Console/CHANGELOG.md
+++ b/src/Symfony/Component/Console/CHANGELOG.md
@@ -10,6 +10,7 @@ CHANGELOG
* `Application` implements `ResetInterface`
* marked all dispatched event classes as `@final`
* added support for displaying table horizontally
+ * deprecated returning `null` from `Command::execute()`, return `0` instead
4.3.0
-----
diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php
index 6bb3692cf3d3f..460b917945056 100644
--- a/src/Symfony/Component/Console/Command/Command.php
+++ b/src/Symfony/Component/Console/Command/Command.php
@@ -150,7 +150,7 @@ protected function configure()
* execute() method, you set the code to execute by passing
* a Closure to the setCode() method.
*
- * @return int|void void or 0 if everything went fine, or an exit code
+ * @return int 0 if everything went fine, or an exit code
*
* @throws LogicException When this abstract method is not implemented
*
@@ -253,6 +253,10 @@ public function run(InputInterface $input, OutputInterface $output)
$statusCode = ($this->code)($input, $output);
} else {
$statusCode = $this->execute($input, $output);
+
+ if (!\is_int($statusCode)) {
+ @trigger_error(sprintf('A non numeric or nullable $statusCode returned by Command::execute() is deprecated since Symfony 4.4, return an integer value instead.'), E_USER_DEPRECATED);
+ }
}
return is_numeric($statusCode) ? (int) $statusCode : 0;
diff --git a/src/Symfony/Component/Console/Command/HelpCommand.php b/src/Symfony/Component/Console/Command/HelpCommand.php
index 23847766b6fdc..b32be4c95cce4 100644
--- a/src/Symfony/Component/Console/Command/HelpCommand.php
+++ b/src/Symfony/Component/Console/Command/HelpCommand.php
@@ -77,5 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
]);
$this->command = null;
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Command/ListCommand.php b/src/Symfony/Component/Console/Command/ListCommand.php
index 15c8a1218d0d6..8af952652872a 100644
--- a/src/Symfony/Component/Console/Command/ListCommand.php
+++ b/src/Symfony/Component/Console/Command/ListCommand.php
@@ -74,6 +74,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
'raw_text' => $input->getOption('raw'),
'namespace' => $input->getArgument('namespace'),
]);
+
+ return 0;
}
private function createDefinition(): InputDefinition
diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php
index dd30a95741376..f778e4f57449b 100644
--- a/src/Symfony/Component/Console/Tests/ApplicationTest.php
+++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php
@@ -1837,9 +1837,11 @@ public function __construct()
class LazyCommand extends Command
{
- public function execute(InputInterface $input, OutputInterface $output)
+ public function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln('lazy-command called');
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php
index 0c84d4175b445..c51a47c6853dc 100644
--- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php
+++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php
@@ -300,20 +300,6 @@ public function testRunWithInvalidOption()
$tester->execute(['--bar' => true]);
}
- public function testRunReturnsIntegerExitCode()
- {
- $command = new \TestCommand();
- $exitCode = $command->run(new StringInput(''), new NullOutput());
- $this->assertSame(0, $exitCode, '->run() returns integer exit code (treats null as 0)');
-
- $command = $this->getMockBuilder('TestCommand')->setMethods(['execute'])->getMock();
- $command->expects($this->once())
- ->method('execute')
- ->willReturn('2.3');
- $exitCode = $command->run(new StringInput(''), new NullOutput());
- $this->assertSame(2, $exitCode, '->run() returns integer exit code (casts numeric to int)');
- }
-
public function testRunWithApplication()
{
$command = new \TestCommand();
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/BarHiddenCommand.php b/src/Symfony/Component/Console/Tests/Fixtures/BarHiddenCommand.php
index d500f8731f7d9..58af8d816c386 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/BarHiddenCommand.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/BarHiddenCommand.php
@@ -15,7 +15,8 @@ protected function configure()
;
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Foo1Command.php b/src/Symfony/Component/Console/Tests/Fixtures/Foo1Command.php
index 6069576d1540d..c4fc0e811227d 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/Foo1Command.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/Foo1Command.php
@@ -18,9 +18,11 @@ protected function configure()
;
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->input = $input;
$this->output = $output;
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Foo2Command.php b/src/Symfony/Component/Console/Tests/Fixtures/Foo2Command.php
index 0d9884013ebd7..b3b6e6c06c934 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/Foo2Command.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/Foo2Command.php
@@ -15,7 +15,8 @@ protected function configure()
;
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php b/src/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php
index adb3a2d809f71..d6ca5cd15c59b 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php
@@ -14,7 +14,7 @@ protected function configure()
;
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
try {
try {
@@ -25,5 +25,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
} catch (\Exception $e) {
throw new \Exception('Third exception comment>', 404, $e);
}
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/FooCommand.php b/src/Symfony/Component/Console/Tests/Fixtures/FooCommand.php
index 314460044789d..fac25f21ec317 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/FooCommand.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/FooCommand.php
@@ -23,11 +23,13 @@ protected function interact(InputInterface $input, OutputInterface $output)
$output->writeln('interact called');
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->input = $input;
$this->output = $output;
$output->writeln('called');
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/FooHiddenCommand.php b/src/Symfony/Component/Console/Tests/Fixtures/FooHiddenCommand.php
index 75fbf7804ddc3..68e495b7610f9 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/FooHiddenCommand.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/FooHiddenCommand.php
@@ -15,7 +15,8 @@ protected function configure()
;
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/FooOptCommand.php b/src/Symfony/Component/Console/Tests/Fixtures/FooOptCommand.php
index c9054671f94c5..dea6d4d162fbf 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/FooOptCommand.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/FooOptCommand.php
@@ -25,12 +25,14 @@ protected function interact(InputInterface $input, OutputInterface $output)
$output->writeln('interact called');
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->input = $input;
$this->output = $output;
$output->writeln('called');
$output->writeln($this->input->getOption('fooopt'));
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/FooSubnamespaced1Command.php b/src/Symfony/Component/Console/Tests/Fixtures/FooSubnamespaced1Command.php
index 95a4e6152484f..c9fad78e152f8 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/FooSubnamespaced1Command.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/FooSubnamespaced1Command.php
@@ -18,9 +18,11 @@ protected function configure()
;
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->input = $input;
$this->output = $output;
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/FooSubnamespaced2Command.php b/src/Symfony/Component/Console/Tests/Fixtures/FooSubnamespaced2Command.php
index 08c5ff725fe0d..dea20a49c508d 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/FooSubnamespaced2Command.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/FooSubnamespaced2Command.php
@@ -18,9 +18,11 @@ protected function configure()
;
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->input = $input;
$this->output = $output;
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/FooWithoutAliasCommand.php b/src/Symfony/Component/Console/Tests/Fixtures/FooWithoutAliasCommand.php
index e301cc5f5b3ab..3d125500c4ed5 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/FooWithoutAliasCommand.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/FooWithoutAliasCommand.php
@@ -14,8 +14,10 @@ protected function configure()
;
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln('called');
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/FoobarCommand.php b/src/Symfony/Component/Console/Tests/Fixtures/FoobarCommand.php
index 968162804cee9..ab3c9ff0c9db6 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/FoobarCommand.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/FoobarCommand.php
@@ -17,9 +17,11 @@ protected function configure()
;
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->input = $input;
$this->output = $output;
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/TestAmbiguousCommandRegistering.php b/src/Symfony/Component/Console/Tests/Fixtures/TestAmbiguousCommandRegistering.php
index bece09fcdde82..71badf3428140 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/TestAmbiguousCommandRegistering.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/TestAmbiguousCommandRegistering.php
@@ -15,8 +15,10 @@ protected function configure()
;
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->write('test-ambiguous');
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/TestAmbiguousCommandRegistering2.php b/src/Symfony/Component/Console/Tests/Fixtures/TestAmbiguousCommandRegistering2.php
index 9dde48624546d..127ea56a95f49 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/TestAmbiguousCommandRegistering2.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/TestAmbiguousCommandRegistering2.php
@@ -14,8 +14,10 @@ protected function configure()
;
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->write('test-ambiguous2');
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Fixtures/TestCommand.php b/src/Symfony/Component/Console/Tests/Fixtures/TestCommand.php
index eb7ccb33f6ca5..4fb0410b72944 100644
--- a/src/Symfony/Component/Console/Tests/Fixtures/TestCommand.php
+++ b/src/Symfony/Component/Console/Tests/Fixtures/TestCommand.php
@@ -19,6 +19,8 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('execute called');
+
+ return 0;
}
protected function interact(InputInterface $input, OutputInterface $output)
diff --git a/src/Symfony/Component/ErrorRenderer/Command/DebugCommand.php b/src/Symfony/Component/ErrorRenderer/Command/DebugCommand.php
index eac8f557e3b48..58cb57b68cbf5 100644
--- a/src/Symfony/Component/ErrorRenderer/Command/DebugCommand.php
+++ b/src/Symfony/Component/ErrorRenderer/Command/DebugCommand.php
@@ -95,6 +95,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$io->newLine();
$io->table(['Format', 'Class'], $tableRows);
}
+
+ return 0;
}
private function formatClassLink(string $class): string
diff --git a/src/Symfony/Component/Form/Command/DebugCommand.php b/src/Symfony/Component/Form/Command/DebugCommand.php
index 341329b70b09a..a6bf74ac9c83b 100644
--- a/src/Symfony/Component/Form/Command/DebugCommand.php
+++ b/src/Symfony/Component/Form/Command/DebugCommand.php
@@ -152,6 +152,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$options['format'] = $input->getOption('format');
$options['show_deprecated'] = $input->getOption('show-deprecated');
$helper->describe($io, $object, $options);
+
+ return 0;
}
private function getFqcnTypeClass(InputInterface $input, SymfonyStyle $io, string $shortClassName)
diff --git a/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php b/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php
index 07534f2d4bc3f..4e99703870247 100644
--- a/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php
+++ b/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php
@@ -227,6 +227,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$worker->run([
'sleep' => $input->getOption('sleep') * 1000000,
]);
+
+ return 0;
}
private function convertToBytes(string $memoryLimit): int
diff --git a/src/Symfony/Component/Messenger/Command/DebugCommand.php b/src/Symfony/Component/Messenger/Command/DebugCommand.php
index 1cb6771bc3b83..2c8c546c23509 100644
--- a/src/Symfony/Component/Messenger/Command/DebugCommand.php
+++ b/src/Symfony/Component/Messenger/Command/DebugCommand.php
@@ -96,6 +96,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$io->warning(sprintf('No handled message found in bus "%s".', $bus));
}
}
+
+ return 0;
}
private function formatConditions(array $options): string
diff --git a/src/Symfony/Component/Messenger/Command/FailedMessagesRemoveCommand.php b/src/Symfony/Component/Messenger/Command/FailedMessagesRemoveCommand.php
index a15791476cb50..52a93f5519b68 100644
--- a/src/Symfony/Component/Messenger/Command/FailedMessagesRemoveCommand.php
+++ b/src/Symfony/Component/Messenger/Command/FailedMessagesRemoveCommand.php
@@ -61,6 +61,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$shouldForce = $input->getOption('force');
$this->removeSingleMessage($input->getArgument('id'), $receiver, $io, $shouldForce);
+
+ return 0;
}
private function removeSingleMessage(string $id, ReceiverInterface $receiver, SymfonyStyle $io, bool $shouldForce)
diff --git a/src/Symfony/Component/Messenger/Command/FailedMessagesRetryCommand.php b/src/Symfony/Component/Messenger/Command/FailedMessagesRetryCommand.php
index a3957ed54198d..c8981b59adc89 100644
--- a/src/Symfony/Component/Messenger/Command/FailedMessagesRetryCommand.php
+++ b/src/Symfony/Component/Messenger/Command/FailedMessagesRetryCommand.php
@@ -110,11 +110,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->runInteractive($io, $shouldForce);
- return;
+ return 0;
}
$this->retrySpecificIds($ids, $io, $shouldForce);
$io->success('All done!');
+
+ return 0;
}
private function runInteractive(SymfonyStyle $io, bool $shouldForce)
diff --git a/src/Symfony/Component/Messenger/Command/FailedMessagesShowCommand.php b/src/Symfony/Component/Messenger/Command/FailedMessagesShowCommand.php
index 47491e8a2a245..d5ffc8d164188 100644
--- a/src/Symfony/Component/Messenger/Command/FailedMessagesShowCommand.php
+++ b/src/Symfony/Component/Messenger/Command/FailedMessagesShowCommand.php
@@ -71,6 +71,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
$this->showMessage($id, $io);
}
+
+ return 0;
}
private function listMessages(SymfonyStyle $io, int $max)
diff --git a/src/Symfony/Component/Messenger/Command/SetupTransportsCommand.php b/src/Symfony/Component/Messenger/Command/SetupTransportsCommand.php
index 1adac92a25419..6f60a2c43438e 100644
--- a/src/Symfony/Component/Messenger/Command/SetupTransportsCommand.php
+++ b/src/Symfony/Component/Messenger/Command/SetupTransportsCommand.php
@@ -76,5 +76,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$io->note(sprintf('The "%s" transport does not support setup.', $transportName));
}
}
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/Messenger/Command/StopWorkersCommand.php b/src/Symfony/Component/Messenger/Command/StopWorkersCommand.php
index 1e262763ead4c..293b9f2422a07 100644
--- a/src/Symfony/Component/Messenger/Command/StopWorkersCommand.php
+++ b/src/Symfony/Component/Messenger/Command/StopWorkersCommand.php
@@ -68,5 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->restartSignalCachePool->save($cacheItem);
$io->success('Signal successfully sent to stop any running workers.');
+
+ return 0;
}
}
diff --git a/src/Symfony/Component/VarDumper/Command/ServerDumpCommand.php b/src/Symfony/Component/VarDumper/Command/ServerDumpCommand.php
index eb807e35e8b42..c8a61da98c5b6 100644
--- a/src/Symfony/Component/VarDumper/Command/ServerDumpCommand.php
+++ b/src/Symfony/Component/VarDumper/Command/ServerDumpCommand.php
@@ -75,7 +75,7 @@ protected function configure()
;
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$format = $input->getOption('format');