From 1dff4bc454dfc487b224d44c481761cddfd0595e Mon Sep 17 00:00:00 2001 From: Domenico Graziano Date: Mon, 17 Aug 2020 15:40:27 +0100 Subject: [PATCH 1/5] Adds option to check EOL via about command --- .../FrameworkBundle/Command/AboutCommand.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php index 12c13024a105..d87c3cbf1d97 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Command; +use \RuntimeException; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\Helper; use Symfony\Component\Console\Helper\TableSeparator; @@ -46,11 +47,17 @@ protected function configure() The Environment section displays the current environment variables managed by Symfony Dotenv. It will not be shown if no variables were found. The values might be different between web and CLI. + +Passing eolCheck as an option you will get an error if the current symfony kernel is End of Maintenance and +End of Life (can be used in CI as check `php bin/console about --eolCheck` + EOT - ) - ; + )->addOption( + 'eolCheck' + ); } + /** * {@inheritdoc} */ @@ -61,6 +68,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int /** @var KernelInterface $kernel */ $kernel = $this->getApplication()->getKernel(); + if ($input->getOption('eolCheck')) { + if(self::isExpired(Kernel::END_OF_MAINTENANCE) && self::isExpired(Kernel::END_OF_LIFE)) { + throw new RuntimeException(sprintf('Symfony %s is not maintained anymore, see https://symfony.com/releases to upgrade', Kernel::VERSION)); + } + } + $rows = [ ['Symfony'], new TableSeparator(), From 38dd8afbb29d41f4343da552c061776033887446 Mon Sep 17 00:00:00 2001 From: Domenico Graziano Date: Mon, 17 Aug 2020 17:46:45 +0100 Subject: [PATCH 2/5] fix coding standard --- src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php index d87c3cbf1d97..ea40a0533679 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Command; -use \RuntimeException; +use RuntimeException; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\Helper; use Symfony\Component\Console\Helper\TableSeparator; @@ -69,8 +69,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $kernel = $this->getApplication()->getKernel(); if ($input->getOption('eolCheck')) { - if(self::isExpired(Kernel::END_OF_MAINTENANCE) && self::isExpired(Kernel::END_OF_LIFE)) { - throw new RuntimeException(sprintf('Symfony %s is not maintained anymore, see https://symfony.com/releases to upgrade', Kernel::VERSION)); + if (self::isExpired(Kernel::END_OF_MAINTENANCE) && self::isExpired(Kernel::END_OF_LIFE)) { + throw new RuntimeException(sprintf('Symfony "%s" is not maintained anymore, see https://symfony.com/releases to upgrade.', Kernel::VERSION)); } } From 8f706bcc3b759fb97701a95c37a471b82a216e78 Mon Sep 17 00:00:00 2001 From: Domenico Graziano Date: Mon, 17 Aug 2020 17:48:30 +0100 Subject: [PATCH 3/5] fix coding standard --- src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php index ea40a0533679..9b5335c4fe32 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php @@ -57,7 +57,6 @@ protected function configure() ); } - /** * {@inheritdoc} */ From 3ff8137295437ac0a4aa20a9eea37ae933f9409f Mon Sep 17 00:00:00 2001 From: Domenico Graziano Date: Tue, 18 Aug 2020 09:27:48 +0100 Subject: [PATCH 4/5] is-mantained better name, END_OF_MAINTENANCE enough to check, return 1 if fails --- .../FrameworkBundle/Command/AboutCommand.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php index 9b5335c4fe32..b8b39475ae7b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php @@ -11,11 +11,11 @@ namespace Symfony\Bundle\FrameworkBundle\Command; -use RuntimeException; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\Helper; use Symfony\Component\Console\Helper\TableSeparator; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\HttpKernel\Kernel; @@ -39,6 +39,7 @@ protected function configure() { $this ->setDescription('Displays information about the current project') + ->addOption('is-maintained', null, InputOption::VALUE_NONE, 'Exits if current symfony Kernel is unmaintained (usable with CI tools)') ->setHelp(<<<'EOT' The %command.name% command displays information about the current Symfony project. @@ -48,12 +49,10 @@ protected function configure() The Environment section displays the current environment variables managed by Symfony Dotenv. It will not be shown if no variables were found. The values might be different between web and CLI. -Passing eolCheck as an option you will get an error if the current symfony kernel is End of Maintenance and -End of Life (can be used in CI as check `php bin/console about --eolCheck` +Passing is-maintained as an option you will get an error if the current symfony kernel is End of Maintenance +(can be used in CI as check `php bin/console about --is-maintained` EOT - )->addOption( - 'eolCheck' ); } @@ -67,10 +66,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int /** @var KernelInterface $kernel */ $kernel = $this->getApplication()->getKernel(); - if ($input->getOption('eolCheck')) { - if (self::isExpired(Kernel::END_OF_MAINTENANCE) && self::isExpired(Kernel::END_OF_LIFE)) { - throw new RuntimeException(sprintf('Symfony "%s" is not maintained anymore, see https://symfony.com/releases to upgrade.', Kernel::VERSION)); - } + if ($input->getOption('is-maintained') && self::isExpired(Kernel::END_OF_MAINTENANCE)) { + $io->error(sprintf('Symfony "%s" is not maintained anymore, see https://symfony.com/releases to upgrade.', Kernel::VERSION)); + return 1; } $rows = [ From d87bab021ea47d639288d073362ab146b0fd73ac Mon Sep 17 00:00:00 2001 From: Domenico Graziano Date: Tue, 18 Aug 2020 09:29:09 +0100 Subject: [PATCH 5/5] fix coding standard --- src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php index b8b39475ae7b..073c112f8aaa 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php @@ -68,6 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($input->getOption('is-maintained') && self::isExpired(Kernel::END_OF_MAINTENANCE)) { $io->error(sprintf('Symfony "%s" is not maintained anymore, see https://symfony.com/releases to upgrade.', Kernel::VERSION)); + return 1; }