From ce60831a9d6c41c032117ddf59f303f56d004c87 Mon Sep 17 00:00:00 2001 From: Jesse Rushlow <40327885+jrushlow@users.noreply.github.com> Date: Fri, 27 Sep 2024 22:29:51 -0400 Subject: [PATCH] minor #1605 Move help files into new directory structure * add helper method to get the help file contents for each maker * move help files to new config dir --- {src/Resources => config}/help/MakeAuth.txt | 0 {src/Resources => config}/help/MakeCommand.txt | 0 {src/Resources => config}/help/MakeController.txt | 0 {src/Resources => config}/help/MakeCrud.txt | 0 .../help/MakeDockerDatabase.txt | 10 +++++----- {src/Resources => config}/help/MakeEntity.txt | 0 {src/Resources => config}/help/MakeFixture.txt | 0 {src/Resources => config}/help/MakeForm.txt | 0 .../help/MakeFunctionalTest.txt | 0 {src/Resources => config}/help/MakeListener.txt | 0 {src/Resources => config}/help/MakeMessage.txt | 0 {src/Resources => config}/help/MakeMiddleware.txt | 0 {src/Resources => config}/help/MakeMigration.txt | 0 .../help/MakeRegistrationForm.txt | 0 .../Resources => config}/help/MakeResetPassword.txt | 0 {src/Resources => config}/help/MakeScheduler.txt | 0 .../help/MakeSerializerEncoder.txt | 0 .../help/MakeSerializerNormalizer.txt | 0 .../help/MakeStimulusController.txt | 0 {src/Resources => config}/help/MakeSubscriber.txt | 0 {src/Resources => config}/help/MakeTest.txt | 0 .../Resources => config}/help/MakeTwigExtension.txt | 0 {src/Resources => config}/help/MakeUnitTest.txt | 0 {src/Resources => config}/help/MakeUser.txt | 0 {src/Resources => config}/help/MakeValidator.txt | 0 {src/Resources => config}/help/MakeVoter.txt | 0 {src/Resources => config}/help/MakeWebhook.txt | 0 {src/Resources => config}/help/_WithTests.txt | 0 {src/Resources => config}/help/_WithUid.txt | 0 .../help/security/MakeCustom.txt | 0 .../help/security/MakeFormLogin.txt | 0 src/Maker/AbstractMaker.php | 13 +++++++++++++ src/Maker/Common/CanGenerateTestsTrait.php | 2 +- src/Maker/Common/UidTrait.php | 2 +- src/Maker/MakeAuthenticator.php | 3 ++- src/Maker/MakeCommand.php | 2 +- src/Maker/MakeController.php | 2 +- src/Maker/MakeCrud.php | 2 +- src/Maker/MakeDockerDatabase.php | 2 +- src/Maker/MakeEntity.php | 2 +- src/Maker/MakeFixtures.php | 2 +- src/Maker/MakeForm.php | 2 +- src/Maker/MakeFunctionalTest.php | 2 +- src/Maker/MakeListener.php | 2 +- src/Maker/MakeMessage.php | 2 +- src/Maker/MakeMessengerMiddleware.php | 3 ++- src/Maker/MakeMigration.php | 2 +- src/Maker/MakeRegistrationForm.php | 2 +- src/Maker/MakeResetPassword.php | 2 +- src/Maker/MakeSchedule.php | 2 +- src/Maker/MakeSerializerEncoder.php | 2 +- src/Maker/MakeSerializerNormalizer.php | 2 +- src/Maker/MakeStimulusController.php | 3 ++- src/Maker/MakeSubscriber.php | 2 +- src/Maker/MakeTest.php | 3 ++- src/Maker/MakeTwigExtension.php | 2 +- src/Maker/MakeUnitTest.php | 2 +- src/Maker/MakeUser.php | 3 ++- src/Maker/MakeValidator.php | 2 +- src/Maker/MakeVoter.php | 2 +- src/Maker/MakeWebhook.php | 2 +- src/Maker/Security/MakeCustomAuthenticator.php | 2 +- src/Maker/Security/MakeFormLogin.php | 4 +++- 63 files changed, 56 insertions(+), 36 deletions(-) rename {src/Resources => config}/help/MakeAuth.txt (100%) rename {src/Resources => config}/help/MakeCommand.txt (100%) rename {src/Resources => config}/help/MakeController.txt (100%) rename {src/Resources => config}/help/MakeCrud.txt (100%) rename {src/Resources => config}/help/MakeDockerDatabase.txt (97%) rename {src/Resources => config}/help/MakeEntity.txt (100%) rename {src/Resources => config}/help/MakeFixture.txt (100%) rename {src/Resources => config}/help/MakeForm.txt (100%) rename {src/Resources => config}/help/MakeFunctionalTest.txt (100%) rename {src/Resources => config}/help/MakeListener.txt (100%) rename {src/Resources => config}/help/MakeMessage.txt (100%) rename {src/Resources => config}/help/MakeMiddleware.txt (100%) rename {src/Resources => config}/help/MakeMigration.txt (100%) rename {src/Resources => config}/help/MakeRegistrationForm.txt (100%) rename {src/Resources => config}/help/MakeResetPassword.txt (100%) rename {src/Resources => config}/help/MakeScheduler.txt (100%) rename {src/Resources => config}/help/MakeSerializerEncoder.txt (100%) rename {src/Resources => config}/help/MakeSerializerNormalizer.txt (100%) rename {src/Resources => config}/help/MakeStimulusController.txt (100%) rename {src/Resources => config}/help/MakeSubscriber.txt (100%) rename {src/Resources => config}/help/MakeTest.txt (100%) rename {src/Resources => config}/help/MakeTwigExtension.txt (100%) rename {src/Resources => config}/help/MakeUnitTest.txt (100%) rename {src/Resources => config}/help/MakeUser.txt (100%) rename {src/Resources => config}/help/MakeValidator.txt (100%) rename {src/Resources => config}/help/MakeVoter.txt (100%) rename {src/Resources => config}/help/MakeWebhook.txt (100%) rename {src/Resources => config}/help/_WithTests.txt (100%) rename {src/Resources => config}/help/_WithUid.txt (100%) rename {src/Resources => config}/help/security/MakeCustom.txt (100%) rename {src/Resources => config}/help/security/MakeFormLogin.txt (100%) diff --git a/src/Resources/help/MakeAuth.txt b/config/help/MakeAuth.txt similarity index 100% rename from src/Resources/help/MakeAuth.txt rename to config/help/MakeAuth.txt diff --git a/src/Resources/help/MakeCommand.txt b/config/help/MakeCommand.txt similarity index 100% rename from src/Resources/help/MakeCommand.txt rename to config/help/MakeCommand.txt diff --git a/src/Resources/help/MakeController.txt b/config/help/MakeController.txt similarity index 100% rename from src/Resources/help/MakeController.txt rename to config/help/MakeController.txt diff --git a/src/Resources/help/MakeCrud.txt b/config/help/MakeCrud.txt similarity index 100% rename from src/Resources/help/MakeCrud.txt rename to config/help/MakeCrud.txt diff --git a/src/Resources/help/MakeDockerDatabase.txt b/config/help/MakeDockerDatabase.txt similarity index 97% rename from src/Resources/help/MakeDockerDatabase.txt rename to config/help/MakeDockerDatabase.txt index b4eaccc3f..426f33943 100644 --- a/src/Resources/help/MakeDockerDatabase.txt +++ b/config/help/MakeDockerDatabase.txt @@ -1,5 +1,5 @@ -The %command.name% command generates or updates databases services in compose.yaml - -php %command.full_name% - -Supports MySQL, MariaDB and PostgreSQL +The %command.name% command generates or updates databases services in compose.yaml + +php %command.full_name% + +Supports MySQL, MariaDB and PostgreSQL diff --git a/src/Resources/help/MakeEntity.txt b/config/help/MakeEntity.txt similarity index 100% rename from src/Resources/help/MakeEntity.txt rename to config/help/MakeEntity.txt diff --git a/src/Resources/help/MakeFixture.txt b/config/help/MakeFixture.txt similarity index 100% rename from src/Resources/help/MakeFixture.txt rename to config/help/MakeFixture.txt diff --git a/src/Resources/help/MakeForm.txt b/config/help/MakeForm.txt similarity index 100% rename from src/Resources/help/MakeForm.txt rename to config/help/MakeForm.txt diff --git a/src/Resources/help/MakeFunctionalTest.txt b/config/help/MakeFunctionalTest.txt similarity index 100% rename from src/Resources/help/MakeFunctionalTest.txt rename to config/help/MakeFunctionalTest.txt diff --git a/src/Resources/help/MakeListener.txt b/config/help/MakeListener.txt similarity index 100% rename from src/Resources/help/MakeListener.txt rename to config/help/MakeListener.txt diff --git a/src/Resources/help/MakeMessage.txt b/config/help/MakeMessage.txt similarity index 100% rename from src/Resources/help/MakeMessage.txt rename to config/help/MakeMessage.txt diff --git a/src/Resources/help/MakeMiddleware.txt b/config/help/MakeMiddleware.txt similarity index 100% rename from src/Resources/help/MakeMiddleware.txt rename to config/help/MakeMiddleware.txt diff --git a/src/Resources/help/MakeMigration.txt b/config/help/MakeMigration.txt similarity index 100% rename from src/Resources/help/MakeMigration.txt rename to config/help/MakeMigration.txt diff --git a/src/Resources/help/MakeRegistrationForm.txt b/config/help/MakeRegistrationForm.txt similarity index 100% rename from src/Resources/help/MakeRegistrationForm.txt rename to config/help/MakeRegistrationForm.txt diff --git a/src/Resources/help/MakeResetPassword.txt b/config/help/MakeResetPassword.txt similarity index 100% rename from src/Resources/help/MakeResetPassword.txt rename to config/help/MakeResetPassword.txt diff --git a/src/Resources/help/MakeScheduler.txt b/config/help/MakeScheduler.txt similarity index 100% rename from src/Resources/help/MakeScheduler.txt rename to config/help/MakeScheduler.txt diff --git a/src/Resources/help/MakeSerializerEncoder.txt b/config/help/MakeSerializerEncoder.txt similarity index 100% rename from src/Resources/help/MakeSerializerEncoder.txt rename to config/help/MakeSerializerEncoder.txt diff --git a/src/Resources/help/MakeSerializerNormalizer.txt b/config/help/MakeSerializerNormalizer.txt similarity index 100% rename from src/Resources/help/MakeSerializerNormalizer.txt rename to config/help/MakeSerializerNormalizer.txt diff --git a/src/Resources/help/MakeStimulusController.txt b/config/help/MakeStimulusController.txt similarity index 100% rename from src/Resources/help/MakeStimulusController.txt rename to config/help/MakeStimulusController.txt diff --git a/src/Resources/help/MakeSubscriber.txt b/config/help/MakeSubscriber.txt similarity index 100% rename from src/Resources/help/MakeSubscriber.txt rename to config/help/MakeSubscriber.txt diff --git a/src/Resources/help/MakeTest.txt b/config/help/MakeTest.txt similarity index 100% rename from src/Resources/help/MakeTest.txt rename to config/help/MakeTest.txt diff --git a/src/Resources/help/MakeTwigExtension.txt b/config/help/MakeTwigExtension.txt similarity index 100% rename from src/Resources/help/MakeTwigExtension.txt rename to config/help/MakeTwigExtension.txt diff --git a/src/Resources/help/MakeUnitTest.txt b/config/help/MakeUnitTest.txt similarity index 100% rename from src/Resources/help/MakeUnitTest.txt rename to config/help/MakeUnitTest.txt diff --git a/src/Resources/help/MakeUser.txt b/config/help/MakeUser.txt similarity index 100% rename from src/Resources/help/MakeUser.txt rename to config/help/MakeUser.txt diff --git a/src/Resources/help/MakeValidator.txt b/config/help/MakeValidator.txt similarity index 100% rename from src/Resources/help/MakeValidator.txt rename to config/help/MakeValidator.txt diff --git a/src/Resources/help/MakeVoter.txt b/config/help/MakeVoter.txt similarity index 100% rename from src/Resources/help/MakeVoter.txt rename to config/help/MakeVoter.txt diff --git a/src/Resources/help/MakeWebhook.txt b/config/help/MakeWebhook.txt similarity index 100% rename from src/Resources/help/MakeWebhook.txt rename to config/help/MakeWebhook.txt diff --git a/src/Resources/help/_WithTests.txt b/config/help/_WithTests.txt similarity index 100% rename from src/Resources/help/_WithTests.txt rename to config/help/_WithTests.txt diff --git a/src/Resources/help/_WithUid.txt b/config/help/_WithUid.txt similarity index 100% rename from src/Resources/help/_WithUid.txt rename to config/help/_WithUid.txt diff --git a/src/Resources/help/security/MakeCustom.txt b/config/help/security/MakeCustom.txt similarity index 100% rename from src/Resources/help/security/MakeCustom.txt rename to config/help/security/MakeCustom.txt diff --git a/src/Resources/help/security/MakeFormLogin.txt b/config/help/security/MakeFormLogin.txt similarity index 100% rename from src/Resources/help/security/MakeFormLogin.txt rename to config/help/security/MakeFormLogin.txt diff --git a/src/Maker/AbstractMaker.php b/src/Maker/AbstractMaker.php index 530bae0dd..bbc00062e 100644 --- a/src/Maker/AbstractMaker.php +++ b/src/Maker/AbstractMaker.php @@ -55,4 +55,17 @@ protected function addDependencies(array $dependencies, ?string $message = null) $message ); } + + /** + * Get the help file contents needed for "setHelp()" of a maker. + * + * @param string $helpFileName the filename (omit path) of the help file located in config/help/ + * e.g. MakeController.txt + * + * @internal + */ + final protected function getHelpFileContents(string $helpFileName): string + { + return file_get_contents(\sprintf('%s/config/help/%s', \dirname(__DIR__, 2), $helpFileName)); + } } diff --git a/src/Maker/Common/CanGenerateTestsTrait.php b/src/Maker/Common/CanGenerateTestsTrait.php index 18d7566af..aae231704 100644 --- a/src/Maker/Common/CanGenerateTestsTrait.php +++ b/src/Maker/Common/CanGenerateTestsTrait.php @@ -28,7 +28,7 @@ trait CanGenerateTestsTrait public function configureCommandWithTestsOption(Command $command): Command { - $testsHelp = file_get_contents(\dirname(__DIR__, 2).'/Resources/help/_WithTests.txt'); + $testsHelp = file_get_contents(\dirname(__DIR__, 3).'/config/help/_WithTests.txt'); $help = $command->getHelp()."\n".$testsHelp; $command diff --git a/src/Maker/Common/UidTrait.php b/src/Maker/Common/UidTrait.php index 25e8269de..d3ecb6ea4 100644 --- a/src/Maker/Common/UidTrait.php +++ b/src/Maker/Common/UidTrait.php @@ -34,7 +34,7 @@ trait UidTrait */ protected function addWithUuidOption(Command $command): Command { - $uidHelp = file_get_contents(\dirname(__DIR__, 2).'/Resources/help/_WithUid.txt'); + $uidHelp = file_get_contents(\dirname(__DIR__, 3).'/config/help/_WithUid.txt'); $help = $command->getHelp()."\n".$uidHelp; $command diff --git a/src/Maker/MakeAuthenticator.php b/src/Maker/MakeAuthenticator.php index 155f44fe7..3f7c9e417 100644 --- a/src/Maker/MakeAuthenticator.php +++ b/src/Maker/MakeAuthenticator.php @@ -92,7 +92,8 @@ public static function getCommandDescription(): string public function configureCommand(Command $command, InputConfiguration $inputConfig): void { $command - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeAuth.txt')); + ->setHelp($this->getHelpFileContents('MakeAuth.txt')) + ; } public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void diff --git a/src/Maker/MakeCommand.php b/src/Maker/MakeCommand.php index e8f586d19..52d331c53 100644 --- a/src/Maker/MakeCommand.php +++ b/src/Maker/MakeCommand.php @@ -58,7 +58,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf { $command ->addArgument('name', InputArgument::OPTIONAL, \sprintf('Choose a command name (e.g. app:%s)', Str::asCommand(Str::getRandomTerm()))) - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeCommand.txt')) + ->setHelp($this->getHelpFileContents('MakeCommand.txt')) ; } diff --git a/src/Maker/MakeController.php b/src/Maker/MakeController.php index e58a3fb5e..58e049eb5 100644 --- a/src/Maker/MakeController.php +++ b/src/Maker/MakeController.php @@ -70,7 +70,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf ->addArgument('controller-class', InputArgument::OPTIONAL, \sprintf('Choose a name for your controller class (e.g. %sController)', Str::asClassName(Str::getRandomTerm()))) ->addOption('no-template', null, InputOption::VALUE_NONE, 'Use this option to disable template generation') ->addOption('invokable', 'i', InputOption::VALUE_NONE, 'Use this option to create an invokable controller') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeController.txt')) + ->setHelp($this->getHelpFileContents('MakeController.txt')) ; $this->configureCommandWithTestsOption($command); diff --git a/src/Maker/MakeCrud.php b/src/Maker/MakeCrud.php index 0a37b2ba4..f535d24bd 100644 --- a/src/Maker/MakeCrud.php +++ b/src/Maker/MakeCrud.php @@ -71,7 +71,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf { $command ->addArgument('entity-class', InputArgument::OPTIONAL, \sprintf('The class name of the entity to create CRUD (e.g. %s)', Str::asClassName(Str::getRandomTerm()))) - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeCrud.txt')) + ->setHelp($this->getHelpFileContents('MakeCrud.txt')) ; $inputConfig->setArgumentAsNonInteractive('entity-class'); diff --git a/src/Maker/MakeDockerDatabase.php b/src/Maker/MakeDockerDatabase.php index bb8391669..5f6ffcb08 100644 --- a/src/Maker/MakeDockerDatabase.php +++ b/src/Maker/MakeDockerDatabase.php @@ -65,7 +65,7 @@ public static function getCommandDescription(): string public function configureCommand(Command $command, InputConfiguration $inputConfig): void { $command - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeDockerDatabase.txt')) + ->setHelp($this->getHelpFileContents('MakeDockerDatabase.txt')) ; } diff --git a/src/Maker/MakeEntity.php b/src/Maker/MakeEntity.php index dfc25301d..e0498f36b 100644 --- a/src/Maker/MakeEntity.php +++ b/src/Maker/MakeEntity.php @@ -97,7 +97,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf ->addOption('broadcast', 'b', InputOption::VALUE_NONE, 'Add the ability to broadcast entity updates using Symfony UX Turbo?') ->addOption('regenerate', null, InputOption::VALUE_NONE, 'Instead of adding new fields, simply generate the methods (e.g. getter/setter) for existing fields') ->addOption('overwrite', null, InputOption::VALUE_NONE, 'Overwrite any existing getter/setter methods') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeEntity.txt')) + ->setHelp($this->getHelpFileContents('MakeEntity.txt')) ; $this->addWithUuidOption($command); diff --git a/src/Maker/MakeFixtures.php b/src/Maker/MakeFixtures.php index befc384bc..137ef5c98 100644 --- a/src/Maker/MakeFixtures.php +++ b/src/Maker/MakeFixtures.php @@ -44,7 +44,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf { $command ->addArgument('fixtures-class', InputArgument::OPTIONAL, 'The class name of the fixtures to create (e.g. AppFixtures)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeFixture.txt')) + ->setHelp($this->getHelpFileContents('MakeFixture.txt')) ; } diff --git a/src/Maker/MakeForm.php b/src/Maker/MakeForm.php index 4859064b8..7387ead57 100644 --- a/src/Maker/MakeForm.php +++ b/src/Maker/MakeForm.php @@ -53,7 +53,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf $command ->addArgument('name', InputArgument::OPTIONAL, \sprintf('The name of the form class (e.g. %sType)', Str::asClassName(Str::getRandomTerm()))) ->addArgument('bound-class', InputArgument::OPTIONAL, 'The name of Entity or fully qualified model class name that the new form will be bound to (empty for none)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeForm.txt')) + ->setHelp($this->getHelpFileContents('MakeForm.txt')) ; $inputConfig->setArgumentAsNonInteractive('bound-class'); diff --git a/src/Maker/MakeFunctionalTest.php b/src/Maker/MakeFunctionalTest.php index 69277c585..16f0281c0 100644 --- a/src/Maker/MakeFunctionalTest.php +++ b/src/Maker/MakeFunctionalTest.php @@ -50,7 +50,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf { $command ->addArgument('name', InputArgument::OPTIONAL, 'The name of the functional test class (e.g. DefaultControllerTest)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeFunctionalTest.txt')) + ->setHelp($this->getHelpFileContents('MakeFunctionalTest.txt')) ; } diff --git a/src/Maker/MakeListener.php b/src/Maker/MakeListener.php index 298c419ec..6b00b51f2 100644 --- a/src/Maker/MakeListener.php +++ b/src/Maker/MakeListener.php @@ -66,7 +66,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf $command ->addArgument('name', InputArgument::OPTIONAL, 'Choose a class name for your event listener or subscriber (e.g. ExceptionListener or ExceptionSubscriber)') ->addArgument('event', InputArgument::OPTIONAL, 'What event do you want to listen to?') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeListener.txt')) + ->setHelp($this->getHelpFileContents('MakeListener.txt')) ; $inputConfig->setArgumentAsNonInteractive('event'); diff --git a/src/Maker/MakeMessage.php b/src/Maker/MakeMessage.php index 682601a44..74fc1e692 100644 --- a/src/Maker/MakeMessage.php +++ b/src/Maker/MakeMessage.php @@ -50,7 +50,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf { $command ->addArgument('name', InputArgument::OPTIONAL, 'The name of the message class (e.g. SendEmailMessage)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeMessage.txt')) + ->setHelp($this->getHelpFileContents('MakeMessage.txt')) ; } diff --git a/src/Maker/MakeMessengerMiddleware.php b/src/Maker/MakeMessengerMiddleware.php index 2b1c189e9..f640d90cb 100644 --- a/src/Maker/MakeMessengerMiddleware.php +++ b/src/Maker/MakeMessengerMiddleware.php @@ -45,7 +45,8 @@ public function configureCommand(Command $command, InputConfiguration $inputConf { $command ->addArgument('name', InputArgument::OPTIONAL, 'The name of the middleware class (e.g. CustomMiddleware)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeMessage.txt')); + ->setHelp($this->getHelpFileContents('MakeMessage.txt')) + ; } public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator): void diff --git a/src/Maker/MakeMigration.php b/src/Maker/MakeMigration.php index 5c0afc054..206a8d84d 100644 --- a/src/Maker/MakeMigration.php +++ b/src/Maker/MakeMigration.php @@ -60,7 +60,7 @@ public function setApplication(Application $application) public function configureCommand(Command $command, InputConfiguration $inputConfig): void { $command - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeMigration.txt')) + ->setHelp($this->getHelpFileContents('MakeMigration.txt')) ; if (class_exists(MigrationsDiffDoctrineCommand::class)) { diff --git a/src/Maker/MakeRegistrationForm.php b/src/Maker/MakeRegistrationForm.php index eeb5237ee..48a8ae34a 100644 --- a/src/Maker/MakeRegistrationForm.php +++ b/src/Maker/MakeRegistrationForm.php @@ -108,7 +108,7 @@ public static function getCommandDescription(): string public function configureCommand(Command $command, InputConfiguration $inputConfig): void { $command - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeRegistrationForm.txt')) + ->setHelp($this->getHelpFileContents('MakeRegistrationForm.txt')) ; $this->configureCommandWithTestsOption($command); diff --git a/src/Maker/MakeResetPassword.php b/src/Maker/MakeResetPassword.php index 38938f24f..ae7b039c7 100644 --- a/src/Maker/MakeResetPassword.php +++ b/src/Maker/MakeResetPassword.php @@ -119,7 +119,7 @@ public static function getCommandDescription(): string public function configureCommand(Command $command, InputConfiguration $inputConfig): void { $command - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeResetPassword.txt')) + ->setHelp($this->getHelpFileContents('MakeResetPassword.txt')) ; $this->addWithUuidOption($command); diff --git a/src/Maker/MakeSchedule.php b/src/Maker/MakeSchedule.php index 999fd000f..ff1c94ffd 100644 --- a/src/Maker/MakeSchedule.php +++ b/src/Maker/MakeSchedule.php @@ -58,7 +58,7 @@ public static function getCommandDescription(): string public function configureCommand(Command $command, InputConfiguration $inputConfig): void { $command - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeScheduler.txt')) + ->setHelp($this->getHelpFileContents('MakeScheduler.txt')) ; } diff --git a/src/Maker/MakeSerializerEncoder.php b/src/Maker/MakeSerializerEncoder.php index 7bdb69f11..8fc033b6b 100644 --- a/src/Maker/MakeSerializerEncoder.php +++ b/src/Maker/MakeSerializerEncoder.php @@ -44,7 +44,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf $command ->addArgument('name', InputArgument::OPTIONAL, 'Choose a class name for your encoder (e.g. YamlEncoder)') ->addArgument('format', InputArgument::OPTIONAL, 'Pick your format name (e.g. yaml)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeSerializerEncoder.txt')) + ->setHelp($this->getHelpFileContents('MakeSerializerEncoder.txt')) ; } diff --git a/src/Maker/MakeSerializerNormalizer.php b/src/Maker/MakeSerializerNormalizer.php index a23f24d56..39381ece1 100644 --- a/src/Maker/MakeSerializerNormalizer.php +++ b/src/Maker/MakeSerializerNormalizer.php @@ -54,7 +54,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf { $command ->addArgument('name', InputArgument::OPTIONAL, 'Choose a class name for your normalizer (e.g. UserNormalizer)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeSerializerNormalizer.txt')) + ->setHelp($this->getHelpFileContents('MakeSerializerNormalizer.txt')) ; } diff --git a/src/Maker/MakeStimulusController.php b/src/Maker/MakeStimulusController.php index 95bee3890..0610c7d3b 100644 --- a/src/Maker/MakeStimulusController.php +++ b/src/Maker/MakeStimulusController.php @@ -44,7 +44,8 @@ public function configureCommand(Command $command, InputConfiguration $inputConf { $command ->addArgument('name', InputArgument::REQUIRED, 'The name of the Stimulus controller (e.g. hello)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeStimulusController.txt')); + ->setHelp($this->getHelpFileContents('MakeStimulusController.txt')) + ; } public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void diff --git a/src/Maker/MakeSubscriber.php b/src/Maker/MakeSubscriber.php index faba42df3..cf1002c82 100644 --- a/src/Maker/MakeSubscriber.php +++ b/src/Maker/MakeSubscriber.php @@ -55,7 +55,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf $command ->addArgument('name', InputArgument::OPTIONAL, 'Choose a class name for your event subscriber (e.g. ExceptionSubscriber)') ->addArgument('event', InputArgument::OPTIONAL, 'What event do you want to subscribe to?') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeSubscriber.txt')) + ->setHelp($this->getHelpFileContents('MakeSubscriber.txt')) ; $inputConfig->setArgumentAsNonInteractive('event'); diff --git a/src/Maker/MakeTest.php b/src/Maker/MakeTest.php index 25ffa3512..47be59ab0 100644 --- a/src/Maker/MakeTest.php +++ b/src/Maker/MakeTest.php @@ -82,7 +82,8 @@ public function configureCommand(Command $command, InputConfiguration $inputConf $command ->addArgument('type', InputArgument::OPTIONAL, 'The type of test: '.implode(', ', $typesDesc)) ->addArgument('name', InputArgument::OPTIONAL, 'The name of the test class (e.g. BlogPostTest)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeTest.txt').implode("\n", $typesHelp)); + ->setHelp($this->getHelpFileContents('MakeTest.txt').implode("\n", $typesHelp)) + ; $inputConfig->setArgumentAsNonInteractive('name'); $inputConfig->setArgumentAsNonInteractive('type'); diff --git a/src/Maker/MakeTwigExtension.php b/src/Maker/MakeTwigExtension.php index a51ffe996..809b09259 100644 --- a/src/Maker/MakeTwigExtension.php +++ b/src/Maker/MakeTwigExtension.php @@ -44,7 +44,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf { $command ->addArgument('name', InputArgument::OPTIONAL, 'The name of the Twig extension class (e.g. AppExtension)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeTwigExtension.txt')) + ->setHelp($this->getHelpFileContents('MakeTwigExtension.txt')) ; } diff --git a/src/Maker/MakeUnitTest.php b/src/Maker/MakeUnitTest.php index d7ef272f6..79a407fbd 100644 --- a/src/Maker/MakeUnitTest.php +++ b/src/Maker/MakeUnitTest.php @@ -45,7 +45,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf { $command ->addArgument('name', InputArgument::OPTIONAL, 'The name of the unit test class (e.g. UtilTest)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeUnitTest.txt')) + ->setHelp($this->getHelpFileContents('MakeUnitTest.txt')) ; } diff --git a/src/Maker/MakeUser.php b/src/Maker/MakeUser.php index 8027672f6..ddfd0721a 100644 --- a/src/Maker/MakeUser.php +++ b/src/Maker/MakeUser.php @@ -77,7 +77,8 @@ public function configureCommand(Command $command, InputConfiguration $inputConf ->addOption('is-entity', null, InputOption::VALUE_NONE, 'Do you want to store user data in the database (via Doctrine)?') ->addOption('identity-property-name', null, InputOption::VALUE_REQUIRED, 'Enter a property name that will be the unique "display" name for the user (e.g. email, username, uuid)') ->addOption('with-password', null, InputOption::VALUE_NONE, 'Will this app be responsible for checking the password? Choose No if the password is actually checked by some other system (e.g. a single sign-on server)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeUser.txt')); + ->setHelp($this->getHelpFileContents('MakeUser.txt')) + ; $this->addWithUuidOption($command); diff --git a/src/Maker/MakeValidator.php b/src/Maker/MakeValidator.php index 51c40ed69..f638a12d5 100644 --- a/src/Maker/MakeValidator.php +++ b/src/Maker/MakeValidator.php @@ -45,7 +45,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf { $command ->addArgument('name', InputArgument::OPTIONAL, 'The name of the validator class (e.g. EnabledValidator)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeValidator.txt')) + ->setHelp($this->getHelpFileContents('MakeValidator.txt')) ; } diff --git a/src/Maker/MakeVoter.php b/src/Maker/MakeVoter.php index aa118afa7..0e12f28f1 100644 --- a/src/Maker/MakeVoter.php +++ b/src/Maker/MakeVoter.php @@ -43,7 +43,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf { $command ->addArgument('name', InputArgument::OPTIONAL, 'The name of the security voter class (e.g. BlogPostVoter)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeVoter.txt')) + ->setHelp($this->getHelpFileContents('MakeVoter.txt')) ; } diff --git a/src/Maker/MakeWebhook.php b/src/Maker/MakeWebhook.php index a0c77a074..a7b3f2423 100644 --- a/src/Maker/MakeWebhook.php +++ b/src/Maker/MakeWebhook.php @@ -90,7 +90,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf { $command ->addArgument('name', InputArgument::OPTIONAL, 'Name of the webhook to create (e.g. github, stripe, ...)') - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeWebhook.txt')) + ->setHelp($this->getHelpFileContents('MakeWebhook.txt')) ; $inputConfig->setArgumentAsNonInteractive('name'); diff --git a/src/Maker/Security/MakeCustomAuthenticator.php b/src/Maker/Security/MakeCustomAuthenticator.php index 6cc1407f6..c3ecae946 100644 --- a/src/Maker/Security/MakeCustomAuthenticator.php +++ b/src/Maker/Security/MakeCustomAuthenticator.php @@ -68,7 +68,7 @@ public static function getCommandDescription(): string public function configureCommand(Command $command, InputConfiguration $inputConfig): void { $command - ->setHelp(file_get_contents(__DIR__.'/../../Resources/help/security/MakeCustom.txt')) + ->setHelp($this->getHelpFileContents('security/MakeCustom.txt')) ; } diff --git a/src/Maker/Security/MakeFormLogin.php b/src/Maker/Security/MakeFormLogin.php index 8ae6e012e..641c048d9 100644 --- a/src/Maker/Security/MakeFormLogin.php +++ b/src/Maker/Security/MakeFormLogin.php @@ -77,7 +77,9 @@ public static function getCommandName(): string public function configureCommand(Command $command, InputConfiguration $inputConfig): void { - $command->setHelp(file_get_contents(\dirname(__DIR__, 2).'/Resources/help/security/MakeFormLogin.txt')); + $command + ->setHelp($this->getHelpFileContents('security/MakeFormLogin.txt')) + ; $this->configureCommandWithTestsOption($command); }