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: implements ValueResolverInterface in place of ArgumentValueResolverInterface, which Symfony 7 removed. resolve() returns an empty array when the argument doesn't apply. supports() is kept as a public helper.
  • ConfigForm: passes TypedConfigManagerInterface to ConfigFormBase::__construct(), which Drupal 11 requires.
  • Logger::eventCollections(): the return type stays CollectionInfoIterator, which is deprecated in mongodb/mongodb 1.21. PHPStan's return.deprecatedInterface error is ignored on that method only, with a @todo to change the type to \Iterator in #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, and php: 8.1 in place of php: '8.x'.
  • Root composer.json: the drupal/core conflict is now <10.6.0 || >=11.0 <11.3.0.
  • All four composer.json files: ext-mongodb and mongodb/mongodb are raised to ^1.21.
  • Root composer.json require-dev: phpunit/phpunit is ^9.6 || ^11.5. Drupal 10.6's core-dev requires PHPUnit 9.6, and PHPUnit 11 needs PHP 8.2, so ^11.5 alone can't install with Drupal 10.6 on PHP 8.1.

Tests

  • ControllerTest: drupal_rewrite_settings() is replaced with SettingsEditor::rewrite(), matching core's FunctionalTestSetupTrait::writeSettings(). The test user is also given access help pages, which is needed to view admin/help and admin/help/mongodb.
  • QueueTest: passes a test name to core's QueueTest constructor, which PHPUnit 10+ requires.
  • SqlImportTest::importProvider() and ControllerBaseTest::pageGenerationData(): made static.
  • Unit LoggerTest: now asserts the function name and file that enhanceLogEntry() records, so it's no longer flagged as risky.
  • MongoDbTest::testCountCollection(): inserts at least one document. mt_rand(0, 100) could return 0, and insertMany() throws on an empty array, so the test failed about once every 101 runs.

CI and linting

  • ext-mongodb: the phpunit jobs build a pinned 1.x extension with pecl install -f mongodb-1.21.10 && docker-php-ext-enable mongodb:
    • -f is 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-essential and pkg-config are installed first. The job log showed phpize failing with Cannot 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_MINOR and OPT_IN_TEST_NEXT_MAJOR are enabled:
    • This covers the new floors and gives an early look at Drupal 12.
    • _AUTORUN_PREVIOUS_MAJOR, _AUTORUN_PREVIOUS_MINOR and _AUTORUN_NEXT_MAJOR are set to push-and-mr. With the default none, 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 rewrite core_version_requirement to ^12, so the .info.yml files don't need to claim it yet.
  • Drush: drush/drush (^12 || ^13) is added to require-dev. The template's own Drush install runs without --ignore-platform-req=ext-mongodb, so it failed, and PHPStan couldn't find DrushCommands.
  • cspell: fixed the misspellings (enteprise, vrsions, watchdoig, mongobb, buildl, havec). Project terms are added through the _CSPELL_WORDS variable in .gitlab-ci.yml. This includes the new words from #3626482 and British behaviour(s), which is kept as is.
  • stylelint: @CHARSET is lowercased and rgba() is changed to rgb().

API changes

  • FormStateValueResolver implements ValueResolverInterface in place of ArgumentValueResolverInterface.
  • ConfigForm::__construct() takes an additional $typedConfigManager argument.
  • 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 validate on all four composer.json files.
  • 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

Merge request reports

Loading
Loading