Skip to content

Commit 67cad14

Browse files
committed
Take Manager as first ctor arg in Watch operation
This makes the constructor consistent with other classes (e.g. Client, GridFS\Bucket) and also ensures that we don't have required parameters trailing optional arguments (i.e. options array).
1 parent 9867b4e commit 67cad14

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ public function watch(array $pipeline = [], array $options = [])
960960
$options['readConcern'] = $this->readConcern;
961961
}
962962

963-
$operation = new Watch($this->databaseName, $this->collectionName, $pipeline, $options, $this->manager);
963+
$operation = new Watch($this->manager, $this->databaseName, $this->collectionName, $pipeline, $options);
964964

965965
return $operation->execute($server);
966966
}

src/Operation/Watch.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Watch implements Executable
9191
* @param Manager $manager Manager instance from the driver
9292
* @throws InvalidArgumentException for parameter/option parsing errors
9393
*/
94-
public function __construct($databaseName, $collectionName, array $pipeline, array $options = [], Manager $manager)
94+
public function __construct(Manager $manager, $databaseName, $collectionName, array $pipeline, array $options = [])
9595
{
9696
if (isset($options['batchSize']) && ! is_integer($options['batchSize'])) {
9797
throw InvalidArgumentException::invalidType('"batchSize" option', $options['batchSize'], 'integer');
@@ -119,11 +119,11 @@ public function __construct($databaseName, $collectionName, array $pipeline, arr
119119
}
120120
}
121121

122+
$this->manager = $manager;
122123
$this->databaseName = (string) $databaseName;
123124
$this->collectionName = (string) $collectionName;
124125
$this->pipeline = $pipeline;
125126
$this->options = $options;
126-
$this->manager = $manager;
127127
}
128128

129129
/**

0 commit comments

Comments
 (0)