Skip to content

Commit 61e5ddf

Browse files
committed
PHPLIB-330: Apply automatic fixes via phpcbf
1 parent c5a45f1 commit 61e5ddf

File tree

138 files changed

+1719
-1302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+1719
-1302
lines changed

src/BulkWriteResult.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ class BulkWriteResult
3030
private $isAcknowledged;
3131

3232
/**
33-
* Constructor.
34-
*
3533
* @param WriteResult $writeResult
3634
* @param mixed[] $insertedIds
3735
*/

src/ChangeStream.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717

1818
namespace MongoDB;
1919

20+
use Iterator;
2021
use MongoDB\Driver\CursorId;
2122
use MongoDB\Driver\Exception\ConnectionException;
2223
use MongoDB\Driver\Exception\RuntimeException;
2324
use MongoDB\Driver\Exception\ServerException;
2425
use MongoDB\Exception\ResumeTokenException;
2526
use MongoDB\Model\ChangeStreamIterator;
26-
use Iterator;
27+
use function call_user_func;
28+
use function in_array;
2729

2830
/**
2931
* Iterator for a change stream.
@@ -57,8 +59,6 @@ class ChangeStream implements Iterator
5759
private $hasAdvanced = false;
5860

5961
/**
60-
* Constructor.
61-
*
6262
* @internal
6363
* @param ChangeStreamIterator $iterator
6464
* @param callable $resumeCallable
@@ -109,6 +109,7 @@ public function key()
109109
if ($this->valid()) {
110110
return $this->key;
111111
}
112+
112113
return null;
113114
}
114115

@@ -167,7 +168,7 @@ private function isResumableError(RuntimeException $exception)
167168
return true;
168169
}
169170

170-
if ( ! $exception instanceof ServerException) {
171+
if (! $exception instanceof ServerException) {
171172
return false;
172173
}
173174

@@ -202,7 +203,7 @@ private function onIteration($incrementKey)
202203

203204
/* Return early if there is not a current result. Avoid any attempt to
204205
* increment the iterator's key. */
205-
if (!$this->valid()) {
206+
if (! $this->valid()) {
206207
return;
207208
}
208209

@@ -236,6 +237,7 @@ private function resumeOrThrow(RuntimeException $exception)
236237
{
237238
if ($this->isResumableError($exception)) {
238239
$this->resume();
240+
239241
return;
240242
}
241243

src/Client.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,30 @@
1717

1818
namespace MongoDB;
1919

20+
use MongoDB\Driver\Exception\InvalidArgumentException as DriverInvalidArgumentException;
21+
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
2022
use MongoDB\Driver\Manager;
2123
use MongoDB\Driver\ReadConcern;
2224
use MongoDB\Driver\ReadPreference;
2325
use MongoDB\Driver\Session;
2426
use MongoDB\Driver\WriteConcern;
25-
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
26-
use MongoDB\Driver\Exception\InvalidArgumentException as DriverInvalidArgumentException;
2727
use MongoDB\Exception\InvalidArgumentException;
2828
use MongoDB\Exception\UnexpectedValueException;
2929
use MongoDB\Exception\UnsupportedException;
30+
use MongoDB\Model\BSONArray;
31+
use MongoDB\Model\BSONDocument;
3032
use MongoDB\Model\DatabaseInfoIterator;
3133
use MongoDB\Operation\DropDatabase;
3234
use MongoDB\Operation\ListDatabases;
3335
use MongoDB\Operation\Watch;
36+
use function is_array;
3437

3538
class Client
3639
{
3740
private static $defaultTypeMap = [
38-
'array' => \MongoDB\Model\BSONArray::class,
39-
'document' => \MongoDB\Model\BSONDocument::class,
40-
'root' => \MongoDB\Model\BSONDocument::class,
41+
'array' => BSONArray::class,
42+
'document' => BSONDocument::class,
43+
'root' => BSONDocument::class,
4144
];
4245
private static $wireVersionForReadConcern = 4;
4346
private static $wireVersionForWritableCommandWriteConcern = 5;
@@ -147,13 +150,13 @@ public function __toString()
147150
*/
148151
public function dropDatabase($databaseName, array $options = [])
149152
{
150-
if ( ! isset($options['typeMap'])) {
153+
if (! isset($options['typeMap'])) {
151154
$options['typeMap'] = $this->typeMap;
152155
}
153156

154157
$server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
155158

156-
if ( ! isset($options['writeConcern']) && \MongoDB\server_supports_feature($server, self::$wireVersionForWritableCommandWriteConcern)) {
159+
if (! isset($options['writeConcern']) && server_supports_feature($server, self::$wireVersionForWritableCommandWriteConcern)) {
157160
$options['writeConcern'] = $this->writeConcern;
158161
}
159162

@@ -269,7 +272,7 @@ public function selectDatabase($databaseName, array $options = [])
269272
* Start a new client session.
270273
*
271274
* @see http://php.net/manual/en/mongodb-driver-manager.startsession.php
272-
* @param array $options Session options
275+
* @param array $options Session options
273276
* @return Session
274277
*/
275278
public function startSession(array $options = [])
@@ -288,17 +291,17 @@ public function startSession(array $options = [])
288291
*/
289292
public function watch(array $pipeline = [], array $options = [])
290293
{
291-
if ( ! isset($options['readPreference'])) {
294+
if (! isset($options['readPreference'])) {
292295
$options['readPreference'] = $this->readPreference;
293296
}
294297

295298
$server = $this->manager->selectServer($options['readPreference']);
296299

297-
if ( ! isset($options['readConcern']) && \MongoDB\server_supports_feature($server, self::$wireVersionForReadConcern)) {
300+
if (! isset($options['readConcern']) && server_supports_feature($server, self::$wireVersionForReadConcern)) {
298301
$options['readConcern'] = $this->readConcern;
299302
}
300303

301-
if ( ! isset($options['typeMap'])) {
304+
if (! isset($options['typeMap'])) {
302305
$options['typeMap'] = $this->typeMap;
303306
}
304307

0 commit comments

Comments
 (0)