Skip to content

PHPLIB-1162: Remove unused argument Explainable::getCommandDocument(Server $server) #1102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Operation/Aggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
$cmd = $this->createCommandDocument();

Expand Down
2 changes: 1 addition & 1 deletion src/Operation/Count.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
$cmd = $this->createCommandDocument();

Expand Down
2 changes: 1 addition & 1 deletion src/Operation/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
return ['delete' => $this->collectionName, 'deletes' => [['q' => $this->filter] + $this->createDeleteOptions()]];
}
Expand Down
4 changes: 2 additions & 2 deletions src/Operation/DeleteMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
return $this->delete->getCommandDocument($server);
return $this->delete->getCommandDocument();
}
}
4 changes: 2 additions & 2 deletions src/Operation/DeleteOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
return $this->delete->getCommandDocument($server);
return $this->delete->getCommandDocument();
}
}
2 changes: 1 addition & 1 deletion src/Operation/Distinct.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
$cmd = $this->createCommandDocument();

Expand Down
4 changes: 2 additions & 2 deletions src/Operation/EstimatedDocumentCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
return $this->createCount()->getCommandDocument($server);
return $this->createCount()->getCommandDocument();
}

private function createCount(): Count
Expand Down
6 changes: 3 additions & 3 deletions src/Operation/Explain.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function execute(Server $server)
throw UnsupportedException::explainNotSupported();
}

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

if (isset($this->options['typeMap'])) {
$cursor->setTypeMap($this->options['typeMap']);
Expand All @@ -125,9 +125,9 @@ public function execute(Server $server)
/**
* Create the explain command.
*/
private function createCommand(Server $server): Command
private function createCommand(): Command
{
$cmd = ['explain' => $this->explainable->getCommandDocument($server)];
$cmd = ['explain' => $this->explainable->getCommandDocument()];

foreach (['comment', 'verbosity'] as $option) {
if (isset($this->options[$option])) {
Expand Down
4 changes: 1 addition & 3 deletions src/Operation/Explainable.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

namespace MongoDB\Operation;

use MongoDB\Driver\Server;

/**
* Explainable interface for explainable operations (aggregate, count, distinct,
* find, findAndModify, delete, and update).
Expand All @@ -32,5 +30,5 @@ interface Explainable extends Executable
*
* @return array
*/
public function getCommandDocument(Server $server);
Copy link
Member Author

@GromNaN GromNaN Jun 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface is @internal, we can change it without breaking user code as no one is expected to implement this interface outside of this library. Even if someone calls this public method with an argument, it will be ignored by PHP.

public function getCommandDocument();
}
2 changes: 1 addition & 1 deletion src/Operation/Find.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
$cmd = $this->createCommandDocument();

Expand Down
2 changes: 1 addition & 1 deletion src/Operation/FindAndModify.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
return $this->createCommandDocument();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Operation/FindOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
return $this->find->getCommandDocument($server);
return $this->find->getCommandDocument();
}
}
4 changes: 2 additions & 2 deletions src/Operation/FindOneAndDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
return $this->findAndModify->getCommandDocument($server);
return $this->findAndModify->getCommandDocument();
}
}
4 changes: 2 additions & 2 deletions src/Operation/FindOneAndReplace.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
return $this->findAndModify->getCommandDocument($server);
return $this->findAndModify->getCommandDocument();
}
}
4 changes: 2 additions & 2 deletions src/Operation/FindOneAndUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
return $this->findAndModify->getCommandDocument($server);
return $this->findAndModify->getCommandDocument();
}
}
2 changes: 1 addition & 1 deletion src/Operation/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
$cmd = ['update' => $this->collectionName, 'updates' => [['q' => $this->filter, 'u' => $this->update] + $this->createUpdateOptions()]];

Expand Down
4 changes: 2 additions & 2 deletions src/Operation/UpdateMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
return $this->update->getCommandDocument($server);
return $this->update->getCommandDocument();
}
}
4 changes: 2 additions & 2 deletions src/Operation/UpdateOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ public function execute(Server $server)
* @see Explainable::getCommandDocument()
* @return array
*/
public function getCommandDocument(Server $server)
public function getCommandDocument()
{
return $this->update->getCommandDocument($server);
return $this->update->getCommandDocument();
}
}