Commit 8a73c759 authored by Jeremy Mikola's avatar Jeremy Mikola

Merge pull request #457

parents d3a3c4e8 371d3b82
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
namespace MongoDB; namespace MongoDB;
use MongoDB\BSON\Serializable;
use MongoDB\Driver\Cursor; use MongoDB\Driver\Cursor;
use MongoDB\Driver\Exception\ConnectionTimeoutException; use MongoDB\Driver\Exception\ConnectionTimeoutException;
use MongoDB\Driver\Exception\RuntimeException; use MongoDB\Driver\Exception\RuntimeException;
...@@ -66,7 +67,7 @@ class ChangeStream implements Iterator ...@@ -66,7 +67,7 @@ class ChangeStream implements Iterator
} }
/** /**
* @return MongoDB\Driver\CursorId * @return \MongoDB\Driver\CursorId
*/ */
public function getCursorId() public function getCursorId()
{ {
...@@ -144,7 +145,8 @@ class ChangeStream implements Iterator ...@@ -144,7 +145,8 @@ class ChangeStream implements Iterator
throw new ResumeTokenException("Cannot extract a resumeToken from an empty document"); throw new ResumeTokenException("Cannot extract a resumeToken from an empty document");
} }
if ($document instanceof Serializable) { if ($document instanceof Serializable) {
return $this->extractResumeToken($document->bsonSerialize()); $this->extractResumeToken($document->bsonSerialize());
return;
} }
if (isset($document->_id)) { if (isset($document->_id)) {
$this->resumeToken = is_array($document) ? $document['_id'] : $document->_id; $this->resumeToken = is_array($document) ? $document['_id'] : $document->_id;
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
namespace MongoDB\GridFS; namespace MongoDB\GridFS;
use MongoDB\Collection;
use MongoDB\Driver\Cursor; use MongoDB\Driver\Cursor;
use MongoDB\Driver\Manager; use MongoDB\Driver\Manager;
use MongoDB\Driver\ReadConcern; use MongoDB\Driver\ReadConcern;
......
...@@ -132,7 +132,7 @@ class ReadableStream ...@@ -132,7 +132,7 @@ class ReadableStream
* *
* Note: this method may return a string smaller than the requested length * Note: this method may return a string smaller than the requested length
* if data is not available to be read. * if data is not available to be read.
* *
* @param integer $length Number of bytes to read * @param integer $length Number of bytes to read
* @return string * @return string
* @throws InvalidArgumentException if $length is negative * @throws InvalidArgumentException if $length is negative
...@@ -175,7 +175,7 @@ class ReadableStream ...@@ -175,7 +175,7 @@ class ReadableStream
public function seek($offset) public function seek($offset)
{ {
if ($offset < 0 || $offset > $this->file->length) { if ($offset < 0 || $offset > $this->file->length) {
throw new InvalidArgumentException(sprintf('$offset must be >= 0 and <= %d; given: %d', $length, $offset)); throw new InvalidArgumentException(sprintf('$offset must be >= 0 and <= %d; given: %d', $this->file->length, $offset));
} }
/* Compute the offsets for the chunk and buffer (i.e. chunk data) from /* Compute the offsets for the chunk and buffer (i.e. chunk data) from
......
...@@ -19,6 +19,7 @@ namespace MongoDB\GridFS; ...@@ -19,6 +19,7 @@ namespace MongoDB\GridFS;
use MongoDB\BSON\UTCDateTime; use MongoDB\BSON\UTCDateTime;
use Exception; use Exception;
use stdClass;
/** /**
* Stream wrapper for reading and writing a GridFS file. * Stream wrapper for reading and writing a GridFS file.
...@@ -117,7 +118,7 @@ class StreamWrapper ...@@ -117,7 +118,7 @@ class StreamWrapper
* *
* Note: this method may return a string smaller than the requested length * Note: this method may return a string smaller than the requested length
* if data is not available to be read. * if data is not available to be read.
* *
* @see http://php.net/manual/en/streamwrapper.stream-read.php * @see http://php.net/manual/en/streamwrapper.stream-read.php
* @param integer $length Number of bytes to read * @param integer $length Number of bytes to read
* @return string * @return string
......
...@@ -22,6 +22,7 @@ use MongoDB\BSON\ObjectId; ...@@ -22,6 +22,7 @@ use MongoDB\BSON\ObjectId;
use MongoDB\BSON\UTCDateTime; use MongoDB\BSON\UTCDateTime;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\InvalidArgumentException;
use stdClass;
/** /**
* WritableStream abstracts the process of writing a GridFS file. * WritableStream abstracts the process of writing a GridFS file.
...@@ -48,7 +49,7 @@ class WritableStream ...@@ -48,7 +49,7 @@ class WritableStream
* *
* * _id (mixed): File document identifier. Defaults to a new ObjectId. * * _id (mixed): File document identifier. Defaults to a new ObjectId.
* *
* * aliases (array of strings): DEPRECATED An array of aliases. * * aliases (array of strings): DEPRECATED An array of aliases.
* Applications wishing to store aliases should add an aliases field to * Applications wishing to store aliases should add an aliases field to
* the metadata document instead. * the metadata document instead.
* *
......
...@@ -19,6 +19,7 @@ namespace MongoDB; ...@@ -19,6 +19,7 @@ namespace MongoDB;
use IteratorAggregate; use IteratorAggregate;
use stdClass; use stdClass;
use Traversable;
/** /**
* Result class for mapReduce command results. * Result class for mapReduce command results.
......
...@@ -243,7 +243,7 @@ class BulkWrite implements Executable ...@@ -243,7 +243,7 @@ class BulkWrite implements Executable
$this->isArrayFiltersUsed = true; $this->isArrayFiltersUsed = true;
if ( ! is_array($args[2]['arrayFilters'])) { if ( ! is_array($args[2]['arrayFilters'])) {
throw InvalidArgumentException::InvalidType(sprintf('$operations[%d]["%s"][2]["arrayFilters"]', $i, $type), $args[2]['arrayFilters'], 'array'); throw InvalidArgumentException::invalidType(sprintf('$operations[%d]["%s"][2]["arrayFilters"]', $i, $type), $args[2]['arrayFilters'], 'array');
} }
} }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
namespace MongoDB\Operation; namespace MongoDB\Operation;
use MongoDB\ChangeStream as ChangeStreamResult; use MongoDB\ChangeStream as ChangeStreamResult;
use MongoDB\Driver\Command;
use MongoDB\Driver\Manager; use MongoDB\Driver\Manager;
use MongoDB\Driver\ReadConcern; use MongoDB\Driver\ReadConcern;
use MongoDB\Driver\ReadPreference; use MongoDB\Driver\ReadPreference;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment