The third parameter of Driver::executeQuery is now an options array (#813)

* The third parameter of Driver::executeQuery is now an options array

* array functions not documented on php.net to accept objects and this fails in PHP 7.4


Co-authored-by: Tim Whitlock <noreply@timwhitlock.info>
Co-authored-by: andrey-sokolov <andrey.sokolov@jetbrains.com>
This commit is contained in:
Tim Whitlock 2020-06-03 12:14:13 +01:00 committed by GitHub
parent 1069a4ecce
commit 2545d67469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 8 deletions

View File

@ -352,14 +352,49 @@ namespace MongoDB {}
* @link https://php.net/manual/en/mongodb-driver-server.executequery.php
* @param string $namespace A fully qualified namespace (e.g. "databaseName.collectionName").
* @param Query $query The MongoDB\Driver\Query to execute.
* @param ReadPreference $readPreference Optionally, a MongoDB\Driver\ReadPreference to select the server for this operation. If none is given, the read preference from the MongoDB Connection URI will be used.
* @param array|ReadPreference $options
* <table>
* <caption><strong>options</strong></caption>
*
* <thead>
* <tr>
* <th>Option</th>
* <th>Type</th>
* <th>Description</th>
* </tr>
*
* </thead>
*
* <tbody>
*
* <tr>
* <td>readPreference</td>
* <td><a href="https://php.net/manual/en/php.neclass.mongodb-driver-readpreference.php">MongoDB\Driver\ReadPreference</a></td>
* <td>
* <p>
* A read preference to use for selecting a server for the operation.
* </p>
* </td>
* </tr>
* <tr>
* <td>session</td>
* <td><a href="https://php.net/manual/en/class.mongodb-driver-session.php">MongoDB\Driver\Session</a></td>
* <td>
* <p>
* A session to associate with the operation.
* </p>
* </td>
* </tr>
* </tbody>
* </table>
* The third parameter is now an options array. For backwards compatibility, this parameter will still accept a MongoDB\Driver\ReadPreference object.
* @throws InvalidArgumentException on argument parsing errors.
* @throws ConnectionException if connection to the server fails (for reasons other than authentication).
* @throws AuthenticationException if authentication is needed and fails.
* @throws RuntimeException on other errors (e.g. invalid command, issuing a write command to a secondary).
* @return Cursor
*/
final public function executeQuery($namespace, Query $query, ReadPreference $readPreference = null)
final public function executeQuery($namespace, Query $query, $option = [])
{
}

View File

@ -633,7 +633,7 @@ function count ($var, $mode = COUNT_NORMAL) {}
/**
* Set the internal pointer of an array to its last element
* @link https://php.net/manual/en/function.end.php
* @param array|object $array <p>
* @param array $array <p>
* The array. This array is passed by reference because it is modified by
* the function. This means you must pass it a real variable and not
* a function returning an array because only actual variables may be
@ -647,7 +647,7 @@ function end (array &$array) {}
/**
* Rewind the internal array pointer
* @link https://php.net/manual/en/function.prev.php
* @param array|object $array <p>
* @param array $array <p>
* The input array.
* </p>
* @return mixed the array value in the previous place that's pointed to by
@ -660,7 +660,7 @@ function prev (array &$array) {}
/**
* Advance the internal array pointer of an array
* @link https://php.net/manual/en/function.next.php
* @param array|object $array <p>
* @param array $array <p>
* The array being affected.
* </p>
* @return mixed the array value in the next place that's pointed to by the
@ -672,7 +672,7 @@ function next (array &$array) {}
/**
* Set the internal pointer of an array to its first element
* @link https://php.net/manual/en/function.reset.php
* @param array|object $array <p>
* @param array $array <p>
* The input array.
* </p>
* @return mixed the value of the first array element, or false if the array is
@ -684,7 +684,7 @@ function reset (array &$array) {}
/**
* Return the current element in an array
* @link https://php.net/manual/en/function.current.php
* @param array|object $array <p>
* @param array $array <p>
* The array.
* </p>
* @return mixed The current function simply returns the
@ -699,7 +699,7 @@ function current (array $array) {}
/**
* Fetch a key from an array
* @link https://php.net/manual/en/function.key.php
* @param array|object $array <p>
* @param array $array <p>
* The array.
* </p>
* @return int|string|null The key function simply returns the