Skip to content

Commit 8bb895b

Browse files
Merge v1.20 into v1.x (#1440)
2 parents 8dba275 + 2109214 commit 8bb895b

14 files changed

+51
-13
lines changed

psalm-baseline.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,9 @@
360360
</TooManyArguments>
361361
</file>
362362
<file src="src/Model/CollectionInfoCommandIterator.php">
363+
<DeprecatedInterface>
364+
<code><![CDATA[CollectionInfoCommandIterator]]></code>
365+
</DeprecatedInterface>
363366
<MixedArrayAssignment>
364367
<code><![CDATA[$info['idIndex']['ns']]]></code>
365368
</MixedArrayAssignment>
@@ -368,6 +371,9 @@
368371
</MixedOperand>
369372
</file>
370373
<file src="src/Model/DatabaseInfoLegacyIterator.php">
374+
<DeprecatedInterface>
375+
<code><![CDATA[DatabaseInfoLegacyIterator]]></code>
376+
</DeprecatedInterface>
371377
<MixedArgument>
372378
<code><![CDATA[current($this->databases)]]></code>
373379
</MixedArgument>
@@ -376,6 +382,11 @@
376382
<code><![CDATA[key($this->databases)]]></code>
377383
</MixedReturnTypeCoercion>
378384
</file>
385+
<file src="src/Model/IndexInfoIteratorIterator.php">
386+
<DeprecatedInterface>
387+
<code><![CDATA[IndexInfoIteratorIterator]]></code>
388+
</DeprecatedInterface>
389+
</file>
379390
<file src="src/Model/IndexInput.php">
380391
<LessSpecificReturnStatement>
381392
<code><![CDATA[(object) $this->index]]></code>
@@ -774,7 +785,22 @@
774785
<code><![CDATA[$document]]></code>
775786
</PossiblyInvalidArgument>
776787
</file>
788+
<file src="src/Operation/ListCollections.php">
789+
<DeprecatedClass>
790+
<code><![CDATA[new CollectionInfoCommandIterator($this->listCollections->execute($server), $this->databaseName)]]></code>
791+
</DeprecatedClass>
792+
</file>
793+
<file src="src/Operation/ListDatabases.php">
794+
<DeprecatedClass>
795+
<code><![CDATA[new DatabaseInfoLegacyIterator($this->listDatabases->execute($server))]]></code>
796+
</DeprecatedClass>
797+
</file>
777798
<file src="src/Operation/ListIndexes.php">
799+
<DeprecatedClass>
800+
<code><![CDATA[IndexInfoIteratorIterator]]></code>
801+
<code><![CDATA[new IndexInfoIteratorIterator($iterator, $this->databaseName . '.' . $this->collectionName)]]></code>
802+
<code><![CDATA[new IndexInfoIteratorIterator(new EmptyIterator())]]></code>
803+
</DeprecatedClass>
778804
<MixedAssignment>
779805
<code><![CDATA[$cmd[$option]]]></code>
780806
<code><![CDATA[$options['session']]]></code>

src/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
use MongoDB\Exception\UnsupportedException;
3939
use MongoDB\Model\BSONArray;
4040
use MongoDB\Model\BSONDocument;
41-
use MongoDB\Model\DatabaseInfoIterator;
41+
use MongoDB\Model\DatabaseInfo;
4242
use MongoDB\Operation\DropDatabase;
4343
use MongoDB\Operation\ListDatabaseNames;
4444
use MongoDB\Operation\ListDatabases;
@@ -313,7 +313,7 @@ public function listDatabaseNames(array $options = []): Iterator
313313
* List databases.
314314
*
315315
* @see ListDatabases::__construct() for supported options
316-
* @return DatabaseInfoIterator
316+
* @return Iterator<int, DatabaseInfo>
317317
* @throws UnexpectedValueException if the command response was malformed
318318
* @throws InvalidArgumentException for parameter/option parsing errors
319319
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)

src/Collection.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
use MongoDB\Model\BSONArray;
3939
use MongoDB\Model\BSONDocument;
4040
use MongoDB\Model\IndexInfo;
41-
use MongoDB\Model\IndexInfoIterator;
4241
use MongoDB\Operation\Aggregate;
4342
use MongoDB\Operation\BulkWrite;
4443
use MongoDB\Operation\Count;
@@ -907,7 +906,7 @@ public function insertOne(array|object $document, array $options = [])
907906
* Returns information for all indexes for the collection.
908907
*
909908
* @see ListIndexes::__construct() for supported options
910-
* @return IndexInfoIterator
909+
* @return Iterator<int, IndexInfo>
911910
* @throws InvalidArgumentException for parameter/option parsing errors
912911
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
913912
*/

src/Database.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
use MongoDB\GridFS\Bucket;
3838
use MongoDB\Model\BSONArray;
3939
use MongoDB\Model\BSONDocument;
40-
use MongoDB\Model\CollectionInfoIterator;
40+
use MongoDB\Model\CollectionInfo;
4141
use MongoDB\Operation\Aggregate;
4242
use MongoDB\Operation\CreateCollection;
4343
use MongoDB\Operation\CreateEncryptedCollection;
@@ -491,7 +491,7 @@ public function listCollectionNames(array $options = []): Iterator
491491
* Returns information for all collections in this database.
492492
*
493493
* @see ListCollections::__construct() for supported options
494-
* @return CollectionInfoIterator
494+
* @return Iterator<int, CollectionInfo>
495495
* @throws InvalidArgumentException for parameter/option parsing errors
496496
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
497497
*/

src/Model/CollectionInfoCommandIterator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* @see \MongoDB\Database::listCollections()
3131
* @see https://github.com/mongodb/specifications/blob/master/source/enumerate-collections.rst
3232
* @see https://mongodb.com/docs/manual/reference/command/listCollections/
33+
* @deprecated
3334
* @template-extends IteratorIterator<int, array, Traversable<int, array>>
3435
*/
3536
class CollectionInfoCommandIterator extends IteratorIterator implements CollectionInfoIterator

src/Model/CollectionInfoIterator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* This iterator is used for enumerating collections in a database.
2727
*
2828
* @see \MongoDB\Database::listCollections()
29+
* @deprecated
2930
* @template-extends Iterator<int, CollectionInfo>
3031
*/
3132
interface CollectionInfoIterator extends Iterator

src/Model/DatabaseInfoIterator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* This iterator is used for enumerating databases on a server.
2727
*
2828
* @see \MongoDB\Client::listDatabases()
29+
* @deprecated
2930
* @template-extends Iterator<int, DatabaseInfo>
3031
*/
3132
interface DatabaseInfoIterator extends Iterator

src/Model/DatabaseInfoLegacyIterator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
* @internal
3232
* @see \MongoDB\Client::listDatabases()
3333
* @see https://mongodb.com/docs/manual/reference/command/listDatabases/
34+
* @deprecated
3435
*/
3536
class DatabaseInfoLegacyIterator implements DatabaseInfoIterator
3637
{

src/Model/IndexInfo.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,14 @@ public function getName()
9393
/**
9494
* Return the index namespace (e.g. "db.collection").
9595
*
96+
* @deprecated
97+
*
9698
* @return string
9799
*/
98100
public function getNamespace()
99101
{
102+
@trigger_error('MongoDB 4.4 drops support for the namespace in indexes, the method "IndexInfo::getNamespace()" will be removed in a future release', E_USER_DEPRECATED);
103+
100104
return (string) $this->info['ns'];
101105
}
102106

@@ -128,7 +132,7 @@ public function is2dSphere()
128132
*/
129133
public function isGeoHaystack()
130134
{
131-
trigger_error('MongoDB 5.0 removes support for "geoHaystack" indexes, the method "IndexInfo::isGeoHaystack()" will be removed in a future release', E_USER_DEPRECATED);
135+
@trigger_error('MongoDB 5.0 removes support for "geoHaystack" indexes, the method "IndexInfo::isGeoHaystack()" will be removed in a future release', E_USER_DEPRECATED);
132136

133137
return array_search('geoHaystack', $this->getKey(), true) !== false;
134138
}

src/Model/IndexInfoIterator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* This iterator is used for enumerating indexes in a collection.
2727
*
2828
* @see \MongoDB\Collection::listIndexes()
29+
* @deprecated
2930
* @template-extends Iterator<int, IndexInfo>
3031
*/
3132
interface IndexInfoIterator extends Iterator

0 commit comments

Comments
 (0)