@@ -89,32 +89,14 @@ abstract class Generator extends Command implements GeneratorInterface, IOAwareI
8989 /**
9090 * {@inheritdoc}
9191 */
92- protected function configure ():void {
92+ protected function configure () :void {
9393 $ this
9494 ->setName ($ this ->name )
9595 ->setDescription ($ this ->description )
96- ->addOption (
97- 'directory ' ,
98- '-d ' ,
99- InputOption::VALUE_OPTIONAL ,
100- 'Working directory '
101- )
102- ->addOption (
103- 'answer ' ,
104- '-a ' ,
105- InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL ,
106- 'Answer to generator question '
107- )
108- ->addOption (
109- 'dry-run ' ,
110- NULL ,
111- InputOption::VALUE_NONE ,
112- 'Output the generated code but not save it to file system '
113- );
114-
115- if ($ this ->alias ) {
116- $ this ->setAliases ([$ this ->alias ]);
117- }
96+ ->addOption ('directory ' , '-d ' , InputOption::VALUE_OPTIONAL , 'Working directory ' )
97+ ->addOption ('answer ' , '-a ' , InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL , 'Answer to generator question ' )
98+ ->addOption ('dry-run ' , NULL , InputOption::VALUE_NONE , 'Output the generated code but not save it to file system ' )
99+ ->setAliases ($ this ->alias ? [$ this ->alias ] : []);
118100 }
119101
120102 /**
@@ -221,7 +203,7 @@ protected function ask(string $question, $default = NULL, $validator = NULL) {
221203 // Allow the validators to be referenced in a short form like
222204 // '::validateMachineName'.
223205 if (is_string ($ validator ) && substr ($ validator , 0 , 2 ) == ':: ' ) {
224- $ validator = [__CLASS__ , substr ($ validator , 2 )];
206+ $ validator = [get_class ( $ this ) , substr ($ validator , 2 )];
225207 }
226208 return $ this ->io ->ask ($ question , $ default , $ validator );
227209 }
0 commit comments