-
Notifications
You must be signed in to change notification settings - Fork 266
PHPLIB-599: Typing improvements #959
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
Changes from all commits
b0f110f
d273370
68d68e3
e6e08b3
012650f
1dec7b2
a32be43
9a9742e
c7272cc
eb6fb73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,12 +99,11 @@ public function __construct(array $options = []) | |
* Execute the operation. | ||
* | ||
* @see Executable::execute() | ||
* @param Server $server | ||
* @return array An array of database info structures | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason not to use an If this is out of scope for this PR, feel free to ignore. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Covariance would indeed allow us to add an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh good point about extension. I didn't consider that. Shame on us for not making these things |
||
* @throws UnexpectedValueException if the command response was malformed | ||
* @throws DriverRuntimeException for other driver errors (e.g. connection errors) | ||
*/ | ||
public function execute(Server $server) | ||
public function execute(Server $server): array | ||
{ | ||
$cursor = $server->executeReadCommand('admin', $this->createCommand(), $this->createOptions()); | ||
$cursor->setTypeMap(['root' => 'array', 'document' => 'array']); | ||
|
@@ -119,10 +118,8 @@ public function execute(Server $server) | |
|
||
/** | ||
* Create the listDatabases command. | ||
* | ||
* @return Command | ||
*/ | ||
private function createCommand() | ||
private function createCommand(): Command | ||
{ | ||
$cmd = ['listDatabases' => 1]; | ||
|
||
|
@@ -146,9 +143,8 @@ private function createCommand() | |
* the command be executed on the primary. | ||
* | ||
* @see https://php.net/manual/en/mongodb-driver-server.executecommand.php | ||
* @return array | ||
*/ | ||
private function createOptions() | ||
private function createOptions(): array | ||
{ | ||
$options = []; | ||
|
||
|
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.
The comment was wrong - the
object
type was introduced in PHP 7.2.