From 4e1111953283ba249540765d21de70535758aa24 Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Tue, 2 Apr 2024 19:14:18 -0400 Subject: [PATCH 1/2] [make:stimulus-controller] use named arguments where possible --- src/Maker/MakeStimulusController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Maker/MakeStimulusController.php b/src/Maker/MakeStimulusController.php index 4dd23e65e..3d975ac4c 100644 --- a/src/Maker/MakeStimulusController.php +++ b/src/Maker/MakeStimulusController.php @@ -50,8 +50,8 @@ public function configureCommand(Command $command, InputConfiguration $inputConf public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void { $command->addArgument('extension', InputArgument::OPTIONAL); - $command->addArgument('targets', InputArgument::OPTIONAL, '', []); - $command->addArgument('values', InputArgument::OPTIONAL, '', []); + $command->addArgument('targets', InputArgument::OPTIONAL, default: []); // @TODO - Is the default mt array even needed... + $command->addArgument('values', InputArgument::OPTIONAL, default: []); $chosenExtension = $io->choice( 'Language (JavaScript or TypeScript)', @@ -139,7 +139,7 @@ private function askForNextTarget(ConsoleStyle $io, array $targets, bool $isFirs $questionText = 'Add another target? Enter the target name (or press to stop adding targets)'; } - $targetName = $io->ask($questionText, null, function (?string $name) use ($targets) { + $targetName = $io->ask($questionText, validator: function (?string $name) use ($targets) { if (\in_array($name, $targets)) { throw new \InvalidArgumentException(sprintf('The "%s" target already exists.', $name)); } From 0530bccbbbca1ef09a6694aed9ad43545947c548 Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Fri, 5 Apr 2024 09:40:40 -0400 Subject: [PATCH 2/2] remove unused defaults --- src/Maker/MakeStimulusController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Maker/MakeStimulusController.php b/src/Maker/MakeStimulusController.php index 3d975ac4c..dbb75ea36 100644 --- a/src/Maker/MakeStimulusController.php +++ b/src/Maker/MakeStimulusController.php @@ -50,8 +50,8 @@ public function configureCommand(Command $command, InputConfiguration $inputConf public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void { $command->addArgument('extension', InputArgument::OPTIONAL); - $command->addArgument('targets', InputArgument::OPTIONAL, default: []); // @TODO - Is the default mt array even needed... - $command->addArgument('values', InputArgument::OPTIONAL, default: []); + $command->addArgument('targets', InputArgument::OPTIONAL); + $command->addArgument('values', InputArgument::OPTIONAL); $chosenExtension = $io->choice( 'Language (JavaScript or TypeScript)',