Problem/Motivation
Patternkit currently supports Drupal 10.3 and Drupal 11. With the 9.2.0 release targeting Drupal 11 exclusively, maintaining Drupal 10 compatibility requires carrying several workarounds that add noise to the codebase, suppress static analysis warnings, and prevent adoption of cleaner Drupal 11 APIs.
Known compatibility burdens:
core_version_requirement: ^10.3 || ^11inpatternkit.info.yml;^10 || ^11in all submodule.info.ymlfiles.drupal/core-recommendedanddrupal/core-devpinned to^10.3 || ^11incomposer.json.symfony/polyfill-php84: ^1.31incomposer.jsonrequire— included to cover the PHP 8.4 compatibility gap in Drupal 10's Symfony version.\PDO::FETCH_ASSOCpassed tofetchAll()inValidityStampWriter(three call sites) andfetchField()/fetchAssoc()calls elsewhere — superseded by theDrupal\Core\Database\FetchAsenum in Drupal 11; using the old form generates deprecation notices and requires// @phpstan-ignoresuppressors.#[LegacyHook]attributes on every procedural hook wrapper inpatternkit.module— prevents duplicate execution when both a procedural function and an OOP#[Hook]class method are registered; unnecessary in Drupal 11.// @phpstan-ignore method.deprecatedinPatternDiscoveryLoaderguarding a call deprecated in Drupal 10.
A full module audit may surface additional workarounds not listed here.
Steps to reproduce
Not applicable. This is a planned cleanup task targeting the 9.2.0 release.
Proposed resolution
Known changes
- Update
core_version_requirementto^11inpatternkit.info.ymland all submodule.info.ymlfiles. - Update
composer.jsonrequire-dev constraints fordrupal/core-recommendedanddrupal/core-devto^11. - Remove
symfony/polyfill-php84fromcomposer.jsonrequireafter confirming it is unused in module code. - Replace
\PDO::FETCH_ASSOCarguments and any remaining PDO-constant-based fetch calls withFetchAsenum equivalents. - Convert
patternkit.modulehook wrappers to native#[Hook]attribute declarations on the OOP hook classes, removing the procedural functions and#[LegacyHook]bridge. - Remove the
// @phpstan-ignore method.deprecatedsuppressor inPatternDiscoveryLoaderafter the underlying call site is updated. - Update the CI matrix to test against Drupal 11 only.
Open considerations
patternkit.modulefile fate — once procedural hooks are removed, the only remaining function ispatternkit_rebuild(), which has no current OOP equivalent. Determine whether to movehook_rebuildto an OOP implementation and delete the file, or retain the file with only that function.symfony/polyfill-php84audit — confirm no module code directly depends on the polyfill before removing.- Drupal 11 minimum minor — evaluate whether targeting a specific Drupal 11 minor (e.g.,
^11.1or^11.2) is warranted to take advantage of APIs unavailable in 11.0, or whether^11is the correct floor. - PHPUnit suite audit — review the test suite for any Drupal 10-specific test coverage, skips, or version guards that can be removed or simplified.
- Rector configuration and compliance — configure
rector/rectorandpalantirnet/drupal-rectorfor the Drupal 11 target, run a full automated refactor pass, and address any findings that Rector flags but cannot auto-apply. Integrate Rector into the CI pipeline as an ongoing compliance gate. - Full module audit — conduct a systematic review of all module PHP, YAML, and configuration files for any remaining Drupal 10 workarounds, compatibility shims, or conditional logic not covered above.
Remaining tasks
- Conduct full module audit for additional Drupal 10 workarounds.
- Resolve open considerations above.
- Review and test the merge request.
- CI validation.
User interface changes
None.
Introduced terminology
None.
API changes
The core_version_requirement minimum is raised to ^11. Sites running Drupal 10 must remain on the 9.1.x branch.
Data model changes
None.
Release notes snippet
Patternkit 9.2.0 drops support for Drupal 10. The minimum required Drupal core version is now 11.0.0. Sites running Drupal 10 should remain on the 9.1.x branch, which will continue to receive security coverage according to the project's support policy. As part of this change, procedural hook wrappers in patternkit.module are removed in favor of native Drupal 11 OOP hook declarations, and the database fetch API is updated to use the FetchAs enum introduced in Drupal 11.
Comments