Problem/Motivation

On PHP 8.4, `ContentEntity::create()` triggers a deprecation warning:

> Implicitly marking parameter $migration as nullable is deprecated, the explicit nullable type must be used instead

This occurs at `src/Plugin/migrate/source/d8/ContentEntity.php` line 62.

Steps to reproduce

1. Run any migration using the `d8_entity` source plugin on PHP 8.4.
2. Observe the deprecation warning in the output.

Proposed resolution

Add the explicit nullable type indicator (`?`) to the `$migration` parameter:

// Before
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {

// After
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, ?MigrationInterface $migration = NULL) {

This is the only instance in the module. The deprecated subclass plugins (d8_node, d8_user, d8_file, d8_taxonomy_term) inherit from ContentEntity and do not override create().

Remaining tasks

Review and merge.

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

jlicht created an issue. See original summary.

jlicht’s picture

Issue summary: View changes

damienmckenna’s picture

Assigned: jlicht » Unassigned
Status: Active » Needs review
Issue tags: +PHP 8.4

Added the PHP 8.4 tag and adjusted some other metadata.

heddn’s picture

Version: 8.x-1.2 » 8.x-1.x-dev
Status: Needs review » Fixed

Thanks for the fixes here.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • heddn committed b3dded04 on 8.x-1.x authored by jlicht
    chore: #3573233 Fix PHP 8.4 implicit nullable parameter deprecation in...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.