Skip to content

Cumulative Drupal 9 Readiness Patches, plus Drupal Standards and Practice

Cumulative Drupal 9 Readiness, plus Standards & Practice.

The following instructions still work, but are no longer necessary thanks to Drupal's new Lenient Composer Endpoint.

This MR combines all the Drupal 9 compatibility patches from !3 along with the patches from !2 and !1 plus additional patches intended to address PHPCS errors and warnings.

The additional patches include things like standardizing doc blocks, using \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead of t(), and including type hints for method parameters.

The MR at !3 does not yet contain all of these patches, so it is not fully D9-compatible.

It is useful to have an issue fork for Drupal 9 compatibility, rather than simply a patch, because:

In short, you can't use a patch to tell Composer that a Drupal 8 module is compatible with Drupal 9.

Source: https://www.mediacurrent.com/blog/how-fix-catch-22-problem-drupal-9-fixes-composer/

Adding Issue Fork as a Composer repository:

To use this issue fork as a transitional D9-compatible package in your project, modify your composer.json:

    "repositories": {
        "drupal/entity_activity": {
            "type": "vcs",
            "url": "https://git.drupalcode.org/issue/entity_activity-3129711"
        },
        "drupal": {
          "type": "composer",
          "url": "https://packages.drupal.org/8",
          "exclude": ["drupal/entity_activity"]
        },

Requiring the patched package from the Issue Fork:

Execute the following command in a terminal:

$ composer require drupal/entity_activity:dev-3129711-drupal-standards-and-practice

or manually add the requirement to composer.json:

    "require": {
        "drupal/entity_activity": "dev-3129711-drupal-standards-and-practice",

Credit due, mainly, to Benji Fisher via: https://www.drupal.org/project/views_url_alias/issues/3142138#comment-14177409

NOTE:

Instructions above tested (with Drupal 8.9.18) and patched module now passes Upgrade Status tests.

Not yet tested with Drupal 9. You can help the Drupal community by testing this! 👍

Closes #3129711 (unless you prefer my previous Merge Request on the same Issue Fork)

Edited by Matt Obert

Merge request reports