Drush code gen fails to generate Drush Alias File
bhanu951 opened this issue · 1 comments
bhanu951 commented
Issue
Drush code gen fails to generate Drush Alias File with below error.
[warning] Undefined array key "machine_name" BaseGenerator.php:283
TypeError: DrupalCodeGenerator\Utils::machine2human(): Argument #1 ($machine_name) must be of type string, null given, called in /var/www/html/vendor/chi-teck/drupal-code-generator/src/Command/BaseGenerator.php on line 283 in /var/www/html/vendor/chi-teck/drupal-code-generator/src/Utils.php on line 16 #0 /var/www/html/vendor/chi-teck/drupal-code-generator/src/Command/BaseGenerator.php(283): DrupalCodeGenerator\Utils::machine2human(NULL)
#1 /var/www/html/vendor/chi-teck/drupal-code-generator/src/Command/BaseGenerator.php(114): DrupalCodeGenerator\Command\BaseGenerator->generateInfoFile(Array, Object(DrupalCodeGenerator\Asset\AssetCollection))
#2 /var/www/html/vendor/symfony/console/Command/Command.php(326): DrupalCodeGenerator\Command\BaseGenerator->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/html/vendor/symfony/console/Application.php(1063): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /var/www/html/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand(Object(Drush\Commands\generate\Generators\Drush\DrushAliasFile), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /var/www/html/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/html/vendor/drush/drush/src/Commands/generate/GenerateCommands.php(105): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 [internal function]: Drush\Commands\generate\GenerateCommands->generate('daf', Array)
#8 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
#9 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#10 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#12 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/html/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/html/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
#19 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
#20 /var/www/html/vendor/bin/drush(119): include('/var/www/html/v...')
#21 {main}
TypeError: DrupalCodeGenerator\Utils::machine2human(): Argument #1 ($machine_name) must be of type string, null given, called in /var/www/html/vendor/chi-teck/drupal-code-generator/src/Command/BaseGenerator.php on line 283 in DrupalCodeGenerator\Utils::machine2human() (line 16 of /var/www/html/vendor/chi-teck/drupal-code-generator/src/Utils.php).
[warning] Drush command terminated abnormally.
Installed Package Version
drupal9 $ddev composer show chi-teck/drupal-code-generator
name : chi-teck/drupal-code-generator
descrip. : Drupal code generator
keywords :
versions : * 3.2.0
type : library
license : GNU General Public License v2.0 or later (GPL-2.0-or-later) (OSI approved) https://spdx.org/licenses/GPL-2.0-or-later.html#licenseText
homepage :
source : [git] https://github.com/Chi-teck/drupal-code-generator.git 6883a423f21446b16f8b9a2d90cc5abd4bc3e5d6
dist : [zip] https://api.github.com/repos/Chi-teck/drupal-code-generator/zipball/6883a423f21446b16f8b9a2d90cc5abd4bc3e5d6 6883a423f21446b16f8b9a2d90cc5abd4bc3e5d6
path : /var/www/html/vendor/chi-teck/drupal-code-generator
names : chi-teck/drupal-code-generator
support
issues : https://github.com/Chi-teck/drupal-code-generator/issues
source : https://github.com/Chi-teck/drupal-code-generator/tree/3.2.0
autoload
psr-4
DrupalCodeGenerator\ => src
requires
ext-json *
php >=8.1.0
psr/event-dispatcher ^1.0
psr/log ^3.0
symfony/console ^6.3
symfony/dependency-injection ^6.3.2
symfony/filesystem ^6.3
symfony/string ^6.3
twig/twig ^3.4
requires (dev)
chi-teck/drupal-coder-extension ^2.0.0-alpha4
drupal/coder 8.3.20
drupal/core 10.1.x-dev
ext-simplexml *
phpspec/prophecy-phpunit ^2.0
phpunit/phpunit ^9.5
squizlabs/php_codesniffer ^3.7
symfony/var-dumper ^6.3
symfony/yaml ^6.3
vimeo/psalm ^5.14.0
conflicts
squizlabs/php_codesniffer <3.6
Drush Version: 12.2.0
Steps to Reproduce
drush gen daf
Welcome to daf generator!
–––––––––––––––––––––––––––
File prefix (one word) [self]:
➤
Path to Drupal root [/var/www/html/web]:
➤
Drupal uri [https://drupal9.local]:
➤
Remote host:
➤ 127.0.0.1
Remote user [root]:
➤ www-data
Expected Behaviour
Site Alias File need to be generated.
Actual Behaviour
Site Alias File not generated and throws fatal error.
Chi-teck commented
Fixed in drush-ops/drush#5820
Thank you.