Problem/Motivation

After upgrading to Drupal 11.3.8 and PHP 8.5, the following deprecation warning appears in the logs:

Deprecated function: Drupal\fvm\Plugin\EntityReferenceSelection\FieldViewMode::__construct(): Implicitly marking parameter $entity_repository as nullable is deprecated, the explicit nullable type must be used instead in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php)

Steps to reproduce

  1. Upgrade Drupal to 11.3.8
  2. Upgrade PHP to 8.5
  3. Check Recent log messages

Proposed resolution

Update the constructor signature to explicitly declare nullable types (e.g., ?Type) for parameters instead of relying on implicit nullability, ensuring compatibility with PHP 8.4+

Remaining tasks

  • Deprecated function: Drupal\fvm\Plugin\EntityReferenceSelection\FieldViewMode::__construct(): Implicitly marking parameter $entity_field_manager as nullable is deprecated, the explicit nullable type must be used instead in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
  • Deprecated function: Drupal\fvm\Plugin\EntityReferenceSelection\FieldViewMode::__construct(): Implicitly marking parameter $entity_type_bundle_info as nullable is deprecated, the explicit nullable type must be used instead in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).
  • Deprecated function: Drupal\fvm\Plugin\EntityReferenceSelection\FieldViewMode::__construct(): Implicitly marking parameter $entity_repository as nullable is deprecated, the explicit nullable type must be used instead in include() (line 576 of /var/www/html/vendor/composer/ClassLoader.php).

User interface changes

None

API changes

Constructor signature is updated to explicitly define nullable parameters, which may affect custom implementations extending this class.

Data model changes

None

Issue fork fvm-3590653

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

sivaji_ganesh_jojodae’s picture

Issue summary: View changes
sivaji_ganesh_jojodae’s picture

Issue summary: View changes

sivaji_ganesh_jojodae’s picture

Status: Active » Needs review
maursilveira’s picture

Version: 2.0.6 » 2.x-dev

maursilveira’s picture

Status: Needs review » Fixed

Thank you for the MR. There was a missing deprecation warning left, which I pushed the fix for.

Marking this as fixed.

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.