@@ -79,23 +79,22 @@ protected function initialize(InputInterface $input, OutputInterface $output): v
7979 /**
8080 * Collects default variables.
8181 */
82- protected function & collectDefault (): array {
82+ protected function collectDefault (array & $ vars ): void {
8383 // If both name and machine_name questions are defined it is quite possible
8484 // that we can provide the extension name without interacting with a user.
8585 if (!$ this ->isNewExtension && $ this ->drupalContext && $ this ->nameQuestion && $ this ->machineNameQuestion ) {
8686 $ extensions = $ this ->getExtensionList ();
87- $ this -> vars ['machine_name ' ] = $ this ->askMachineNameQuestion ();
88- $ this -> vars ['name ' ] = $ extensions [$ this -> vars ['machine_name ' ]] ?? Utils::machine2human ($ this -> vars ['machine_name ' ]);
87+ $ vars ['machine_name ' ] = $ this ->askMachineNameQuestion ($ vars );
88+ $ vars ['name ' ] = $ extensions [$ vars ['machine_name ' ]] ?? Utils::machine2human ($ vars ['machine_name ' ]);
8989 }
9090 else {
9191 if ($ this ->nameQuestion ) {
92- $ this -> vars ['name ' ] = $ this ->askNameQuestion ();
92+ $ vars ['name ' ] = $ this ->askNameQuestion ();
9393 }
9494 if ($ this ->machineNameQuestion ) {
95- $ this -> vars ['machine_name ' ] = $ this ->askMachineNameQuestion ();
95+ $ vars ['machine_name ' ] = $ this ->askMachineNameQuestion ($ vars );
9696 }
9797 }
98- return $ this ->vars ;
9998 }
10099
101100 /**
@@ -115,8 +114,8 @@ protected function askNameQuestion(): string {
115114 /**
116115 * Asks machine name question.
117116 */
118- protected function askMachineNameQuestion (): string {
119- $ default_value = Utils::human2machine ($ this -> vars ['name ' ] ?? \basename ($ this ->directory ));
117+ protected function askMachineNameQuestion (array $ vars ): string {
118+ $ default_value = Utils::human2machine ($ vars ['name ' ] ?? \basename ($ this ->directory ));
120119 $ machine_name_question = new Question ($ this ->machineNameQuestion , $ default_value );
121120 $ machine_name_question ->setValidator ([static ::class, 'validateRequiredMachineName ' ]);
122121 if (!$ this ->isNewExtension && $ extensions = $ this ->getExtensionList ()) {
@@ -139,15 +138,15 @@ protected function getExtensionList(): array {
139138 /**
140139 * {@inheritdoc}
141140 */
142- protected function getDestination (): ?string {
141+ protected function getDestination (array $ vars ): ?string {
143142 if ($ this ->drupalContext && $ this ->extensionType ) {
144143 $ destination = $ this ->drupalContext ->getDestination (
145144 $ this ->extensionType ,
146145 $ this ->isNewExtension ,
147- $ this -> vars ['machine_name ' ] ?? NULL ,
146+ $ vars ['machine_name ' ] ?? NULL ,
148147 );
149148 }
150- return $ destination ?? parent ::getDestination ();
149+ return $ destination ?? parent ::getDestination ($ vars );
151150 }
152151
153152}
0 commit comments