From d53759de4ed1c48c223bd0b4cd067215f62abdf4 Mon Sep 17 00:00:00 2001 From: tuutti Date: Thu, 7 Mar 2024 09:36:49 +0200 Subject: [PATCH] Keep PackageScannerCommands Drush 11 compatible --- src/Drush/Commands/PackageScannerDrushCommands.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Drush/Commands/PackageScannerDrushCommands.php b/src/Drush/Commands/PackageScannerDrushCommands.php index 536b76c..1c91897 100644 --- a/src/Drush/Commands/PackageScannerDrushCommands.php +++ b/src/Drush/Commands/PackageScannerDrushCommands.php @@ -14,6 +14,7 @@ use Drush\Attributes\Command; use Drush\Attributes\FieldLabels; use Drush\Commands\DrushCommands; +use Drush\Drush; use Psr\Container\ContainerInterface as DrushContainer; /** @@ -35,7 +36,10 @@ public function __construct( /** * {@inheritdoc} */ - public static function create(ContainerInterface $container, DrushContainer $drush): self { + public static function create(ContainerInterface $container, DrushContainer $drush = NULL): self { + if (!$drush && Drush::hasContainer()) { + $drush = Drush::getContainer(); + } /** @var \Drush\Formatters\DrushFormatterManager $formatterManager */ $formatterManager = $drush->get('formatterManager');