From a40048e740e591eeca3d25df84fda5030b77dce2 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Sat, 27 Oct 2018 20:16:21 +0200 Subject: [PATCH] [FrameworkBundle] Display a proper warning for deprecated --env and --no-debug options --- .../Bundle/FrameworkBundle/Console/Application.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php index 1246f37b09300..e885dfeaa5b56 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php @@ -63,11 +63,16 @@ public function getKernel() 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();