From 9e613262a22ce9f57aebaf4b1d93095a0bc46e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Tue, 10 Sep 2024 22:36:12 +0200 Subject: [PATCH] Fix optional parameter declared before required parameter --- src/Operation/Aggregate.php | 2 +- src/Operation/Watch.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Operation/Aggregate.php b/src/Operation/Aggregate.php index ba6e1ea93..00d408c18 100644 --- a/src/Operation/Aggregate.php +++ b/src/Operation/Aggregate.php @@ -118,7 +118,7 @@ class Aggregate implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(private string $databaseName, private ?string $collectionName = null, private array $pipeline, private array $options = []) + public function __construct(private string $databaseName, private ?string $collectionName, private array $pipeline, private array $options = []) { if (! is_pipeline($pipeline, true /* allowEmpty */)) { throw new InvalidArgumentException('$pipeline is not a valid aggregation pipeline'); diff --git a/src/Operation/Watch.php b/src/Operation/Watch.php index 1ae781d11..09f8b659b 100644 --- a/src/Operation/Watch.php +++ b/src/Operation/Watch.php @@ -187,7 +187,7 @@ class Watch implements Executable, /* @internal */ CommandSubscriber * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(private Manager $manager, ?string $databaseName, private ?string $collectionName = null, private array $pipeline, array $options = []) + public function __construct(private Manager $manager, ?string $databaseName, private ?string $collectionName, private array $pipeline, array $options = []) { if (isset($collectionName) && ! isset($databaseName)) { throw new InvalidArgumentException('$collectionName should also be null if $databaseName is null');