From 431bbf7808ecefaaa6a5106dcf753bf86bbbf0c3 Mon Sep 17 00:00:00 2001 From: Cody deVries Date: Mon, 30 Jan 2023 15:16:28 -0500 Subject: [PATCH 1/2] Use AsCommand attribute to set command name and description --- Command/MaintenanceCommand.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Command/MaintenanceCommand.php b/Command/MaintenanceCommand.php index 0b492c7..d9816f2 100644 --- a/Command/MaintenanceCommand.php +++ b/Command/MaintenanceCommand.php @@ -2,6 +2,7 @@ namespace Northern\MaintenanceModeBundle\Command; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -9,12 +10,12 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Filesystem\Filesystem; +#[AsCommand( + name: 'northern:maintenance', + description: 'Toggle maintenance mode', +)] class MaintenanceCommand extends Command { - protected static $defaultName = 'northern:maintenance'; - - protected static $defaultDescription = 'Toggle maintenance mode'; - private Filesystem $filesystem; private string $flagPath; From da39ad9ee0df75554eab6b057b1b8b47c8f4e517 Mon Sep 17 00:00:00 2001 From: Cody deVries Date: Mon, 30 Jan 2023 15:24:48 -0500 Subject: [PATCH 2/2] Add return type to function declaration --- DependencyInjection/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 3ab1d59..b10f7a8 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -7,7 +7,7 @@ class Configuration implements ConfigurationInterface { - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('northern_maintenance_mode');