Skip to content

Commit

Permalink
Keep update commands compatible with drush 11
Browse files Browse the repository at this point in the history
  • Loading branch information
tuutti committed Feb 28, 2024
1 parent 46cb03a commit 0e47eea
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/Drush/Commands/UpdateDrushCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,24 @@ final class UpdateDrushCommands extends DrushCommands {
* Constructs a new instance.
*/
public function __construct(
private readonly Filesystem $filesystem,
private readonly ClientInterface $httpClient,
private readonly FileManager $fileManager,
private readonly UpdateHookManager $updateHookManager,
private readonly OutputStyle $style,
private ?Filesystem $filesystem = NULL,
private ?ClientInterface $httpClient = NULL,
private ?FileManager $fileManager = NULL,
private ?UpdateHookManager $updateHookManager = NULL,
private ?OutputStyle $style = NULL,
) {
if (!$this->filesystem) {
$this->filesystem = new Filesystem();
}
if (!$this->httpClient) {
$this->httpClient = new Client(['base_uri' => self::BASE_URL]);
}
if (!$this->fileManager) {
$this->fileManager = new FileManager(new HttpFileManager($this->httpClient), $this->filesystem);
}
if (!$this->style) {
$this->style = new SymfonyStyle($this->input(), $this->output());
}
parent::__construct();
}

Expand Down

0 comments on commit 0e47eea

Please sign in to comment.