From cf0b923c2360103c4bb3ff818becbc266ea2d452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Tue, 4 Nov 2025 07:03:18 -0500 Subject: [PATCH] Remove Support for ext-mongodb 1 --- .github/workflows/continuous-integration.yml | 10 +--------- composer.json | 4 ++-- phpstan-baseline.neon | 12 ------------ tests/Tests/SchemaManagerTest.php | 13 ------------- 4 files changed, 3 insertions(+), 36 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c837bf2cb..75160f7af 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -42,7 +42,7 @@ jobs: - dependencies: "lowest" php-version: "8.1" mongodb-version: "6.0" - driver-version: "1.21.0" + driver-version: "2.1.0" topology: "server" symfony-version: "stable" proxy: "lazy-ghost" @@ -84,14 +84,6 @@ jobs: dependencies: "highest" symfony-version: "stable" proxy: "native" - # Test with extension 1.21 - - topology: "server" - php-version: "8.2" - mongodb-version: "8.0" - driver-version: "1.21.0" - dependencies: "highest" - symfony-version: "stable" - proxy: "lazy-ghost" # Test with a sharded cluster # Currently disabled due to a bug where MongoDB reports "sharding status unknown" # - topology: "sharded_cluster" diff --git a/composer.json b/composer.json index fb8f0bf83..0903aa810 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "require": { "php": "^8.1", - "ext-mongodb": "^1.21 || ^2.0", + "ext-mongodb": "^2.0", "composer-runtime-api": "^2.0", "doctrine/cache": "^1.11 || ^2.0", "doctrine/collections": "^1.5 || ^2.0", @@ -33,7 +33,7 @@ "doctrine/instantiator": "^1.1 || ^2", "doctrine/persistence": "^3.2 || ^4", "friendsofphp/proxy-manager-lts": "^1.0", - "mongodb/mongodb": "^1.21.2 || ^2.1.1", + "mongodb/mongodb": "^2.1.1", "psr/cache": "^1.0 || ^2.0 || ^3.0", "symfony/console": "^5.4 || ^6.0 || ^7.0", "symfony/deprecation-contracts": "^2.2 || ^3.0", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d2f4c2db1..03a54bafc 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1110,18 +1110,6 @@ parameters: count: 1 path: tests/Tests/QueryTest.php - - - message: '#^Instantiated class MongoDB\\Model\\CollectionInfoCommandIterator not found\.$#' - identifier: class.notFound - count: 1 - path: tests/Tests/SchemaManagerTest.php - - - - message: '#^Instantiated class MongoDB\\Model\\IndexInfoIteratorIterator not found\.$#' - identifier: class.notFound - count: 1 - path: tests/Tests/SchemaManagerTest.php - - message: '#^Method Doctrine\\ODM\\MongoDB\\Tests\\SchemaManagerTest\:\:createCollectionIterator\(\) has parameter \$collections with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue diff --git a/tests/Tests/SchemaManagerTest.php b/tests/Tests/SchemaManagerTest.php index 5bf435727..bc08ec05a 100644 --- a/tests/Tests/SchemaManagerTest.php +++ b/tests/Tests/SchemaManagerTest.php @@ -37,11 +37,7 @@ use MongoDB\Driver\WriteConcern; use MongoDB\GridFS\Bucket; use MongoDB\Model\CollectionInfo; -use MongoDB\Model\CollectionInfoCommandIterator; -use MongoDB\Model\CollectionInfoIterator; use MongoDB\Model\IndexInfo; -use MongoDB\Model\IndexInfoIterator; -use MongoDB\Model\IndexInfoIteratorIterator; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\IgnoreDeprecations; use PHPUnit\Framework\Constraint\ArrayHasKey; @@ -55,7 +51,6 @@ use function array_map; use function assert; use function in_array; -use function interface_exists; /** * @phpstan-import-type IndexMapping from ClassMetadata @@ -1483,10 +1478,6 @@ private function createSearchIndexCommandExceptionForOlderServers(): CommandExce private function createIndexIterator(array $indexes = []): Iterator { - if (interface_exists(IndexInfoIterator::class)) { - return new IndexInfoIteratorIterator(new ArrayIterator($indexes)); - } - return new ArrayIterator(array_map( static fn (array $indexInfo) => new IndexInfo($indexInfo), $indexes, @@ -1495,10 +1486,6 @@ private function createIndexIterator(array $indexes = []): Iterator private function createCollectionIterator(array $collections = []): Iterator { - if (interface_exists(CollectionInfoIterator::class)) { - return new CollectionInfoCommandIterator(new ArrayIterator($collections)); - } - return new ArrayIterator(array_map( static fn (array $collectionInfo) => new CollectionInfo($collectionInfo), $collections,