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:
GoogleAnalyticsParameterPagesGoogleAnalyticsVisibilityPagesGoogleAnalyticsVisibilityRoles
- 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
Issue fork google_analytics-3562288
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
Comment #2
rajab natshahComment #3
rajab natshahComment #5
rajab natshahComment #6
rajab natshahComment #7
jmoreira commented