Skip to content

Commit 5ebc5dc

Browse files
authored
Fix optional parameter declared before required parameter (#1384)
1 parent be2df01 commit 5ebc5dc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Operation/Aggregate.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class Aggregate implements Executable, Explainable
118118
* @param array $options Command options
119119
* @throws InvalidArgumentException for parameter/option parsing errors
120120
*/
121-
public function __construct(private string $databaseName, private ?string $collectionName = null, private array $pipeline, private array $options = [])
121+
public function __construct(private string $databaseName, private ?string $collectionName, private array $pipeline, private array $options = [])
122122
{
123123
if (! is_pipeline($pipeline, true /* allowEmpty */)) {
124124
throw new InvalidArgumentException('$pipeline is not a valid aggregation pipeline');

src/Operation/Watch.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class Watch implements Executable, /* @internal */ CommandSubscriber
187187
* @param array $options Command options
188188
* @throws InvalidArgumentException for parameter/option parsing errors
189189
*/
190-
public function __construct(private Manager $manager, ?string $databaseName, private ?string $collectionName = null, private array $pipeline, array $options = [])
190+
public function __construct(private Manager $manager, ?string $databaseName, private ?string $collectionName, private array $pipeline, array $options = [])
191191
{
192192
if (isset($collectionName) && ! isset($databaseName)) {
193193
throw new InvalidArgumentException('$collectionName should also be null if $databaseName is null');

0 commit comments

Comments
 (0)