Skip to content

Commit b97cffb

Browse files
authored
PHPLIB-1162: Remove unused argument Explainable::getCommandDocument(Server $server) (#1102)
Not a breaking change because the interface is internal.
1 parent 487d3e8 commit b97cffb

18 files changed

+29
-31
lines changed

src/Operation/Aggregate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public function execute(Server $server)
306306
* @see Explainable::getCommandDocument()
307307
* @return array
308308
*/
309-
public function getCommandDocument(Server $server)
309+
public function getCommandDocument()
310310
{
311311
$cmd = $this->createCommandDocument();
312312

src/Operation/Count.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function execute(Server $server)
170170
* @see Explainable::getCommandDocument()
171171
* @return array
172172
*/
173-
public function getCommandDocument(Server $server)
173+
public function getCommandDocument()
174174
{
175175
$cmd = $this->createCommandDocument();
176176

src/Operation/Delete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function execute(Server $server)
175175
* @see Explainable::getCommandDocument()
176176
* @return array
177177
*/
178-
public function getCommandDocument(Server $server)
178+
public function getCommandDocument()
179179
{
180180
return ['delete' => $this->collectionName, 'deletes' => [['q' => $this->filter] + $this->createDeleteOptions()]];
181181
}

src/Operation/DeleteMany.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ public function execute(Server $server)
9191
* @see Explainable::getCommandDocument()
9292
* @return array
9393
*/
94-
public function getCommandDocument(Server $server)
94+
public function getCommandDocument()
9595
{
96-
return $this->delete->getCommandDocument($server);
96+
return $this->delete->getCommandDocument();
9797
}
9898
}

src/Operation/DeleteOne.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ public function execute(Server $server)
9191
* @see Explainable::getCommandDocument()
9292
* @return array
9393
*/
94-
public function getCommandDocument(Server $server)
94+
public function getCommandDocument()
9595
{
96-
return $this->delete->getCommandDocument($server);
96+
return $this->delete->getCommandDocument();
9797
}
9898
}

src/Operation/Distinct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function execute(Server $server)
163163
* @see Explainable::getCommandDocument()
164164
* @return array
165165
*/
166-
public function getCommandDocument(Server $server)
166+
public function getCommandDocument()
167167
{
168168
$cmd = $this->createCommandDocument();
169169

src/Operation/EstimatedDocumentCount.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ public function execute(Server $server)
114114
* @see Explainable::getCommandDocument()
115115
* @return array
116116
*/
117-
public function getCommandDocument(Server $server)
117+
public function getCommandDocument()
118118
{
119-
return $this->createCount()->getCommandDocument($server);
119+
return $this->createCount()->getCommandDocument();
120120
}
121121

122122
private function createCount(): Count

src/Operation/Explain.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function execute(Server $server)
113113
throw UnsupportedException::explainNotSupported();
114114
}
115115

116-
$cursor = $server->executeCommand($this->databaseName, $this->createCommand($server), $this->createOptions());
116+
$cursor = $server->executeCommand($this->databaseName, $this->createCommand(), $this->createOptions());
117117

118118
if (isset($this->options['typeMap'])) {
119119
$cursor->setTypeMap($this->options['typeMap']);
@@ -125,9 +125,9 @@ public function execute(Server $server)
125125
/**
126126
* Create the explain command.
127127
*/
128-
private function createCommand(Server $server): Command
128+
private function createCommand(): Command
129129
{
130-
$cmd = ['explain' => $this->explainable->getCommandDocument($server)];
130+
$cmd = ['explain' => $this->explainable->getCommandDocument()];
131131

132132
foreach (['comment', 'verbosity'] as $option) {
133133
if (isset($this->options[$option])) {

src/Operation/Explainable.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
namespace MongoDB\Operation;
1919

20-
use MongoDB\Driver\Server;
21-
2220
/**
2321
* Explainable interface for explainable operations (aggregate, count, distinct,
2422
* find, findAndModify, delete, and update).
@@ -32,5 +30,5 @@ interface Explainable extends Executable
3230
*
3331
* @return array
3432
*/
35-
public function getCommandDocument(Server $server);
33+
public function getCommandDocument();
3634
}

src/Operation/Find.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ public function execute(Server $server)
328328
* @see Explainable::getCommandDocument()
329329
* @return array
330330
*/
331-
public function getCommandDocument(Server $server)
331+
public function getCommandDocument()
332332
{
333333
$cmd = $this->createCommandDocument();
334334

src/Operation/FindAndModify.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public function execute(Server $server)
260260
* @see Explainable::getCommandDocument()
261261
* @return array
262262
*/
263-
public function getCommandDocument(Server $server)
263+
public function getCommandDocument()
264264
{
265265
return $this->createCommandDocument();
266266
}

src/Operation/FindOne.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ public function execute(Server $server)
134134
* @see Explainable::getCommandDocument()
135135
* @return array
136136
*/
137-
public function getCommandDocument(Server $server)
137+
public function getCommandDocument()
138138
{
139-
return $this->find->getCommandDocument($server);
139+
return $this->find->getCommandDocument();
140140
}
141141
}

src/Operation/FindOneAndDelete.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ public function execute(Server $server)
122122
* @see Explainable::getCommandDocument()
123123
* @return array
124124
*/
125-
public function getCommandDocument(Server $server)
125+
public function getCommandDocument()
126126
{
127-
return $this->findAndModify->getCommandDocument($server);
127+
return $this->findAndModify->getCommandDocument();
128128
}
129129
}

src/Operation/FindOneAndReplace.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ public function execute(Server $server)
175175
* @see Explainable::getCommandDocument()
176176
* @return array
177177
*/
178-
public function getCommandDocument(Server $server)
178+
public function getCommandDocument()
179179
{
180-
return $this->findAndModify->getCommandDocument($server);
180+
return $this->findAndModify->getCommandDocument();
181181
}
182182
}

src/Operation/FindOneAndUpdate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ public function execute(Server $server)
169169
* @see Explainable::getCommandDocument()
170170
* @return array
171171
*/
172-
public function getCommandDocument(Server $server)
172+
public function getCommandDocument()
173173
{
174-
return $this->findAndModify->getCommandDocument($server);
174+
return $this->findAndModify->getCommandDocument();
175175
}
176176
}

src/Operation/Update.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function execute(Server $server)
219219
* @see Explainable::getCommandDocument()
220220
* @return array
221221
*/
222-
public function getCommandDocument(Server $server)
222+
public function getCommandDocument()
223223
{
224224
$cmd = ['update' => $this->collectionName, 'updates' => [['q' => $this->filter, 'u' => $this->update] + $this->createUpdateOptions()]];
225225

src/Operation/UpdateMany.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ public function execute(Server $server)
120120
* @see Explainable::getCommandDocument()
121121
* @return array
122122
*/
123-
public function getCommandDocument(Server $server)
123+
public function getCommandDocument()
124124
{
125-
return $this->update->getCommandDocument($server);
125+
return $this->update->getCommandDocument();
126126
}
127127
}

src/Operation/UpdateOne.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ public function execute(Server $server)
120120
* @see Explainable::getCommandDocument()
121121
* @return array
122122
*/
123-
public function getCommandDocument(Server $server)
123+
public function getCommandDocument()
124124
{
125-
return $this->update->getCommandDocument($server);
125+
return $this->update->getCommandDocument();
126126
}
127127
}

0 commit comments

Comments
 (0)