[FrameworkBundle] Display a proper warning for deprecated --env and --no-debug options

This commit is contained in:
Robin Chalas 2018-10-27 20:16:21 +02:00
parent b6758e9614
commit a40048e740

View File

@ -63,11 +63,16 @@ class Application extends BaseApplication
public function doRun(InputInterface $input, OutputInterface $output)
{
if ($input->hasParameterOption(array('-e', '--env'), true)) {
@trigger_error('The "--env" option and its "-e" shortcut are deprecated since Symfony 4.2. Set the "APP_ENV" environment variable instead.', E_USER_DEPRECATED);
$notice = 'The "--env" option and its "-e" shortcut are deprecated since Symfony 4.2, set the "APP_ENV" environment variable instead.';
$io = (new SymfonyStyle($input, $output))->getErrorStyle();
$io->warning($notice);
@trigger_error($notice, E_USER_DEPRECATED);
}
if ($input->hasParameterOption('--no-debug', true)) {
@trigger_error('The "--no-debug" option is deprecated since Symfony 4.2. Set the "APP_DEBUG" environment variable to "0" instead.', E_USER_DEPRECATED);
$notice = 'The "--no-debug" option is deprecated since Symfony 4.2, set the "APP_DEBUG" environment variable to "0" instead.';
($io ?? (new SymfonyStyle($input, $output))->getErrorStyle())->warning($notice);
@trigger_error($notice, E_USER_DEPRECATED);
}
$this->kernel->boot();