-
Notifications
You must be signed in to change notification settings - Fork 266
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
Conversation
@@ -32,5 +32,5 @@ interface Explainable extends Executable | |||
* | |||
* @return array | |||
*/ | |||
public function getCommandDocument(Server $server); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes LGTM. I'm a little bit on the fence about whether we should make this change.
FWIW, the $server
parameter was added as back then the FindAndModify
operation used it in its createCommandDocument
method to appropriately add the bypassDocumentValidation
option. However, this was removed as part of #893 when we cleaned up pre-3.6 logic. There could be future cases in which the command document might depend on a selected server to add the correct options, in which case we'd be adding the parameter back to every Explainable
.
Interesting. To reduce coupling, it might be replaced by the server info array when the needs to check server version pops again. |
@alcaeus: Thanks for saving me the trouble of digging up the historical references.
The dominate use case for Server arguments in I reckon the only real benefit is we might be able to write unit tests for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't object to removing Server from the interface since it's no longer used. If we ever need to add it back I expect we'd dig up this issue/commit via git-blame.
As for server_supports_feature()
, my preference is to leave that as-is despite the coupling if that (a) makes the code more readable and (b) reduces extra code needed in calling contexts.
Fix PHPLIB-1162