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
- Upgrade Drupal to 11.3.8
- Upgrade PHP to 8.5
- 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
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
sivaji_ganesh_jojodae commentedComment #3
sivaji_ganesh_jojodae commentedComment #5
sivaji_ganesh_jojodae commentedComment #6
maursilveira commentedComment #8
maursilveira commentedThank you for the MR. There was a missing deprecation warning left, which I pushed the fix for.
Marking this as fixed.