Problem/Motivation

PHP 8.4 introduces stricter rules for implicitly nullable parameters. Any parameter that defaults to
NULL must now be explicitly declared as ?Type.

The Google Analytics module still contains several create() factory methods in migrate process
plugins using:

MigrationInterface $migration = NULL

Under PHP 8.4, this triggers deprecation notices such as:

Deprecated: Implicitly nullable parameter $migration; use ?MigrationInterface instead

This needs to be updated to maintain compatibility with PHP 8.4, Drupal 10.6, and Drupal 11.3.

Steps to reproduce

  • Use Google Analytics module on PHP 8.4.
  • Run migrations that invoke the following plugins:
    • GoogleAnalyticsParameterPages
    • GoogleAnalyticsVisibilityPages
    • GoogleAnalyticsVisibilityRoles
  • Observe PHP 8.4 deprecation warnings.

Proposed resolution

Update all affected create() methods to explicitly declare nullable parameters:

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rajab natshah created an issue. See original summary.

rajab natshah’s picture

Version: 4.0.3 » 4.x-dev
rajab natshah’s picture

Assigned: rajab natshah » Unassigned
Status: Active » Needs review

rajab natshah’s picture

Priority: Normal » Major
Issue tags: +PHP 8.4
rajab natshah’s picture

Priority: Major » Critical
jmoreira’s picture

Status: Needs review » Reviewed & tested by the community