Loading
Fix Drupal 11 / Symfony 7 compatibility errors and failing CI jobs
Summary
The modules claim Drupal 11 support, but some code still used APIs that Drupal 11, Symfony 7 and PHPUnit 10+ removed. This MR fixes the runtime breakage in mongodb_watchdog and the failures in the phpunit, PHPStan, cspell and stylelint jobs. It also sets the version floors that 8.x-2.2 will claim to support, and adds CI jobs to test them.
Changes
Runtime (mongodb_watchdog)
FormStateValueResolver: implementsValueResolverInterfacein place ofArgumentValueResolverInterface, which Symfony 7 removed.resolve()returns an empty array when the argument doesn't apply.supports()is kept as a public helper.ConfigForm: passesTypedConfigManagerInterfacetoConfigFormBase::__construct(), which Drupal 11 requires.Logger::eventCollections(): the return type staysCollectionInfoIterator, which is deprecated inmongodb/mongodb1.21. PHPStan'sreturn.deprecatedInterfaceerror is ignored on that method only, with a@todoto change the type to\Iteratorin #3542043.
Both runtime changes also work on the new minimum core versions, 10.6 and 11.3.
Supported versions
These match the core branches that are currently supported (10.6, 11.3, 11.4) and the versions this branch is tested with.
.info.yml(all modules, including the test module):core_version_requirement: ^10.6 || ^11.3, andphp: 8.1in place ofphp: '8.x'.- Root
composer.json: thedrupal/coreconflict is now<10.6.0 || >=11.0 <11.3.0. - All four
composer.jsonfiles:ext-mongodbandmongodb/mongodbare raised to^1.21. - Root
composer.jsonrequire-dev:phpunit/phpunitis^9.6 || ^11.5. Drupal 10.6'score-devrequires PHPUnit 9.6, and PHPUnit 11 needs PHP 8.2, so^11.5alone can't install with Drupal 10.6 on PHP 8.1.
Tests
ControllerTest:drupal_rewrite_settings()is replaced withSettingsEditor::rewrite(), matching core'sFunctionalTestSetupTrait::writeSettings(). The test user is also givenaccess help pages, which is needed to viewadmin/helpandadmin/help/mongodb.QueueTest: passes a test name to core'sQueueTestconstructor, which PHPUnit 10+ requires.SqlImportTest::importProvider()andControllerBaseTest::pageGenerationData(): madestatic.- Unit
LoggerTest: now asserts the function name and file thatenhanceLogEntry()records, so it's no longer flagged as risky. MongoDbTest::testCountCollection(): inserts at least one document.mt_rand(0, 100)could return 0, andinsertMany()throws on an empty array, so the test failed about once every 101 runs.
CI and linting
- ext-mongodb: the
phpunitjobs build a pinned 1.x extension withpecl install -f mongodb-1.21.10 && docker-php-ext-enable mongodb:-fis needed because the image already has a newer 2.x build, which pecl won't downgrade. The 1.x library doesn't support 2.x.autoconf,build-essentialandpkg-configare installed first. The job log showedphpizefailing withCannot find autoconf.- The job then checks that the extension is loaded, because pecl exits 0 even when the build fails.
- PHP 8.1 image (previous major): this image runs Debian 11, whose security packages (glibc, dpkg) were removed from the Debian mirrors in September 2026 while the index still lists them. On bullseye only, the job points apt's security source at the last snapshot.debian.org copy that has them (2026-09-01) and turns off apt's expiry check for it.
- Wider test matrix:
OPT_IN_TEST_PREVIOUS_MAJOR,OPT_IN_TEST_PREVIOUS_MINORandOPT_IN_TEST_NEXT_MAJORare enabled:- This covers the new floors and gives an early look at Drupal 12.
_AUTORUN_PREVIOUS_MAJOR,_AUTORUN_PREVIOUS_MINORand_AUTORUN_NEXT_MAJORare set topush-and-mr. With the defaultnone, the variants are manual jobs that contributors can't start in MR pipelines.composer (next major)is allowed to fail, like the next-major phpunit, PHPStan and Nightwatch jobs that depend on it. During those jobs, the templates rewritecore_version_requirementto^12, so the.info.ymlfiles don't need to claim it yet.
- Drush:
drush/drush(^12 || ^13) is added torequire-dev. The template's own Drush install runs without--ignore-platform-req=ext-mongodb, so it failed, and PHPStan couldn't findDrushCommands. - cspell: fixed the misspellings (
enteprise,vrsions,watchdoig,mongobb,buildl,havec). Project terms are added through the_CSPELL_WORDSvariable in.gitlab-ci.yml. This includes the new words from #3626482 and Britishbehaviour(s), which is kept as is. - stylelint:
@CHARSETis lowercased andrgba()is changed torgb().
API changes
FormStateValueResolverimplementsValueResolverInterfacein place ofArgumentValueResolverInterface.ConfigForm::__construct()takes an additional$typedConfigManagerargument.- Higher minimum versions: Drupal core
^10.6 || ^11.3, PHP 8.1,ext-mongodb^1.21,mongodb/mongodb^1.21.
The Logger::eventCollections() signature is unchanged. Changing it belongs to #3542043.
Testing
- PHP syntax check (
php -l) on all changed PHP files. -
composer validateon all fourcomposer.jsonfiles. - Unit, Kernel and Functional tests pass locally on Drupal 11.4.8, PHP 8.4, ext-mongodb 1.21.10, mongodb/mongodb 1.21.5 and MongoDB 8.3 (reviewer run).
- phpunit, PHPStan, phpcs, cspell, eslint, stylelint and composer-lint pass on CI (current core).
- phpunit and PHPStan pass on CI for the previous major (Drupal 10.6, PHP 8.1).
- phpunit passes on CI for the previous minor (Drupal 11.3.17, PHP 8.3).
- Next-major (Drupal 12) jobs run. They currently fail, which is allowed.
Closes #3625939
Edited by Matt Hand