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 || ^11 in patternkit.info.yml; ^10 || ^11 in all submodule .info.yml files.
  • drupal/core-recommended and drupal/core-dev pinned to ^10.3 || ^11 in composer.json.
  • symfony/polyfill-php84: ^1.31 in composer.json require — included to cover the PHP 8.4 compatibility gap in Drupal 10's Symfony version.
  • \PDO::FETCH_ASSOC passed to fetchAll() in ValidityStampWriter (three call sites) and fetchField() / fetchAssoc() calls elsewhere — superseded by the Drupal\Core\Database\FetchAs enum in Drupal 11; using the old form generates deprecation notices and requires // @phpstan-ignore suppressors.
  • #[LegacyHook] attributes on every procedural hook wrapper in patternkit.module — prevents duplicate execution when both a procedural function and an OOP #[Hook] class method are registered; unnecessary in Drupal 11.
  • // @phpstan-ignore method.deprecated in PatternDiscoveryLoader guarding 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

  1. Update core_version_requirement to ^11 in patternkit.info.yml and all submodule .info.yml files.
  2. Update composer.json require-dev constraints for drupal/core-recommended and drupal/core-dev to ^11.
  3. Remove symfony/polyfill-php84 from composer.json require after confirming it is unused in module code.
  4. Replace \PDO::FETCH_ASSOC arguments and any remaining PDO-constant-based fetch calls with FetchAs enum equivalents.
  5. Convert patternkit.module hook wrappers to native #[Hook] attribute declarations on the OOP hook classes, removing the procedural functions and #[LegacyHook] bridge.
  6. Remove the // @phpstan-ignore method.deprecated suppressor in PatternDiscoveryLoader after the underlying call site is updated.
  7. Update the CI matrix to test against Drupal 11 only.

Open considerations

  • patternkit.module file fate — once procedural hooks are removed, the only remaining function is patternkit_rebuild(), which has no current OOP equivalent. Determine whether to move hook_rebuild to an OOP implementation and delete the file, or retain the file with only that function.
  • symfony/polyfill-php84 audit — 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.1 or ^11.2) is warranted to take advantage of APIs unavailable in 11.0, or whether ^11 is 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/rector and palantirnet/drupal-rector for 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

slucero created an issue.