Skip to content

Symfony-style PSR-4 commands are not discovered #6523

@tuutti

Description

@tuutti

Describe the bug

ServiceManager::discoverPsr4Commands() requires the command class to be a subclass of DrushCommands, which means the new Symfony-style commands are not discovered unless I'm missing something.

The command is discovered if I move it under the src/Commands directory, but then the namespace must be Drush\Commands\package_name\Commands (I didn't dig too deep to figure out why), which does not comply with PSR-4 standards:

Class Drush\Commands\helfi_drupal_tools\Commands\PackageScannerCommands located in ./drush/Commands/helfi_drupal_tools/src/Commands/PackageScannerCommands.php does not comply with psr-4 autoloading standard (rule: DrupalTools\ => ./drush/Commands/helfi
_drupal_tools/src). Skipping.

To Reproduce

Create a PSR-4 Drush package with a new Symfony-style command.

System Configuration

Q A
Drush version? 14.x/13.x
Drupal version? 11.x
PHP version 8.4
OS? Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions