8000 [Console] Fix all core commands to return proper int values · symfony/symfony@9db466d · GitHub
[go: up one dir, main page]

Skip to content

Commit 9db466d

Browse files
committed
[Console] Fix all core commands to return proper int values
1 parent 26b5242 commit 9db466d

18 files changed

+43
-11
lines changed

src/Symfony/Bridge/Twig/Command/DebugCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
111111

112112
switch ($input->getOption('format')) {
113113
case 'text':
114-
return $name ? $this->displayPathsText($io, $name) : $this->displayGeneralText($io, $filter);
114+
$name ? $this->displayPathsText($io, $name) : $this->displayGeneralText($io, $filter);
115+
break;
115116
case 'json':
116-
return $name ? $this->displayPathsJson($io, $name) : $this->displayGeneralJson($io, $filter);
117+
$name ? $this->displayPathsJson($io, $name) : $this->displayGeneralJson($io, $filter);
118+
break;
117119
default:
118120
throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $input->getOption('format')));
119121
}
122+
123+
return 0;
120124
}
121125

122126
private function displayPathsText(SymfonyStyle $io, string $name)

src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
100100
}
101101

102102
$io->table([], $rows);
103+
104+
return 0;
103105
}
104106

105107
private static function formatPath(string $path, string $baseDir): string

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
175175
}
176176

177177
$io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully cleared.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
178+
179+
return 0;
178180
}
179181

180182
private function warmup(string $warmupDir, string $realCacheDir, bool $enableOptionalWarmers = true)

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9999
}
100100

101101
$io->success('Cache was successfully cleared.');
102+
103+
return 0;
102104
}
103105
}

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolDeleteCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
6969
if (!$cachePool->hasItem($key)) {
7070
$io->note(sprintf('Cache item "%s" does not exist in cache pool "%s".', $key, $pool));
7171

72-
return;
72+
return 0;
7373
}
7474

7575
if (!$cachePool->deleteItem($key)) {
7676
throw new \Exception(sprintf('Cache item "%s" could not be deleted.', $key));
7777
}
7878

7979
$io->success(sprintf('Cache item "%s" was successfully deleted.', $key));
80+
81+
return 0;
8082
}
8183
}

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolListCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5858
$io->table(['Pool name'], array_map(function ($pool) {
5959
return [$pool];
6060
}, $this->poolNames));
61+
62+
return 0;
6163
}
6264
}

src/Symfony/Bundle/FrameworkBundle/Command/CachePoolPruneCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6767
}
6868

6969
$io->success('Successfully pruned cache pool(s).');
70+
71+
return 0;
7072
}
7173
}

src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8080
$this->cacheWarmer->warmUp($kernel->getContainer()->getParameter('kernel.cache_dir'));
8181

8282
$io->success(sprintf('Cache for the "%s" environment (debug=%s) was successfully warmed.', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
83+
84+
return 0;
8385
}
8486
}

src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7373
$errorIo->comment('Provide the name of a bundle as the first argument of this command to dump its configuration. (e.g. <comment>debug:config FrameworkBundle</comment>)');
7474
$errorIo->comment('For dumping a specific option, add its path as the second argument of this command. (e.g. <comment>debug:config FrameworkBundle serializer</comment> to dump the <comment>framework.serializer</comment> configuration)');
7575

76-
return;
76+
return 0;
7777
}
7878

7979
$extension = $this->findExtension($name);
@@ -101,20 +101,22 @@ protected function execute(InputInterface $input, OutputInterface $output)
101101

102102
$io->writeln(Yaml::dump([$extensionAlias => $config], 10));
103103

104-
return;
104+
return 0;
105105
}
106106

107107
try {
108108
$config = $this->getConfigForPath($config, $path, $extensionAlias);
109109
} catch (LogicException $e) {
110110
$errorIo->error($e->getMessage());
111111

112-
return;
112+
return 1;
113113
}
114114

115115
$io->title(sprintf('Current configuration for "%s.%s"', $extensionAlias, $path));
116116

117117
$io->writeln(Yaml::dump($config, 10));
118+
119+
return 0;
118120
}
119121

120122
private function compileContainer(): ContainerBuilder

src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
184184
$errorIo->comment('To search for a specific service, re-run this command with a search term. (e.g. <comment>debug:container log</comment>)');
185185
}
186186
}
187+
188+
return 0;
187189
}
188190

189191
/**

src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7878
if (!$this->dispatcher->hasListeners($event)) {
7979
$io->getErrorStyle()->warning(sprintf('The event "%s" does not have any registered listeners.', $event));
8080

81-
return;
81+
return 0;
8282
}
8383

8484
$options = ['event' => $event];
@@ -89,5 +89,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8989
$options['raw_text'] = $input->getOption('raw');
9090
$options['output'] = $io;
9191
$helper->describe($io, $this->dispatcher, $options);
92+
93+
return 0;
9294
}
9395
}

src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
105105
'output' => $io,
106106
]);
107107
}
108+
109+
return 0;
108110
}
109111

110112
private function findRouteNameContaining(string $name, RouteCollection $routes): array

src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
246246

247247
$io->getErrorStyle()->warning($outputMessage);
248248

249-
return;
249+
return 0;
250250
}
251251

252252
// Load the fallback catalogues
@@ -295,6 +295,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
295295
}
296296

297297
$io->table($headers, $rows);
298+
299+
return 0;
298300
}
299301

300302
private function formatState(int $state): string

src/Symfony/Bundle/FrameworkBundle/Command/WorkflowDumpCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9797
],
9898
];
9999
$output->writeln($dumper->dump($workflow->getDefinition(), $marking, $options));
100+
101+
return 0;
100102
}
101103
}

src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
123123

124124
$this->displayLog($input, $output, $clientId, $record);
125125
}
126+
127+
return 0;
126128
}
127129

128130
private function getLogs($socket)

src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
164164
return 1;
165165
}
166166

167-
return null;
167+
return 0;
168168
}
169169
}

src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
103103
}
104104
}
105105

106-
return null;
106+
return 0;
107107
}
108108
}

src/Symfony/Bundle/WebServerBundle/Command/ServerStopCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
7777
return 1;
7878
}
7979

80-
return null;
80+
return 0;
8181
}
8282
}

0 commit comments

Comments
 (0)
0