Skip to content

Commit e3aadcb

Browse files
author
Robin Chalas
committed
[FrameworkBundle] Display a proper warning for deprecated --env and --no-debug options
1 parent b6758e9 commit e3aadcb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/Console/Application.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,16 @@ public function getKernel()
6363
public function doRun(InputInterface $input, OutputInterface $output)
6464
{
6565
if ($input->hasParameterOption(array('-e', '--env'), true)) {
66-
@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);
66+
$notice = 'The "--env" option and its "-e" shortcut are deprecated since Symfony 4.2. Set the "APP_ENV" environment variable instead.';
67+
$io = (new SymfonyStyle($input, $output))->getErrorStyle();
68+
$io->warning($notice);
69+
@trigger_error($notice, E_USER_DEPRECATED);
6770
}
6871

6972
if ($input->hasParameterOption('--no-debug', true)) {
70-
@trigger_error('The "--no-debug" option is deprecated since Symfony 4.2. Set the "APP_DEBUG" environment variable to "0" instead.', E_USER_DEPRECATED);
73+
$notice = 'The "--no-debug" option is deprecated since Symfony 4.2. Set the "APP_DEBUG" environment variable to "0" instead.';
74+
($io ?? (new SymfonyStyle($input, $output))->getErrorStyle())->warning($notice);
75+
@trigger_error($notice, E_USER_DEPRECATED);
7176
}
7277

7378
$this->kernel->boot();

0 commit comments

Comments
 (0)