Implicitly marking parameter as nullable is deprecated

Created on 27 January 2025, 2 months ago

Problem/Motivation

The Shield module is triggering a deprecation notice in PHP 8.4 due to implicitly marking a parameter as nullable. This needs to be addressed to ensure compatibility with future PHP versions and to follow best practices.

Steps to reproduce

  • Install Shield module version 1.8.0
  • Use PHP 8.4
  • Start the application, may need to clear cache
  • Observe the following deprecation notice in the logs:
    Deprecated: Drupal\shield\Form\ShieldSettingsForm::__construct(): Implicitly marking parameter $keyTypeManager as nullable is deprecated, the explicit nullable type must be used instead in /app/web/modules/contrib/shield/src/Form/ShieldSettingsForm.php on line 46

Proposed resolution

Update the constructor of the ShieldSettingsForm class to explicitly declare the $keyTypeManager parameter as nullable

Remaining tasks

  • Create a patch with the proposed changes
  • Test the patch to ensure it resolves the deprecation notice
  • Submit the patch for review

User interface changes

None. This is a code-level change that does not affect the user interface.

API changes

Minor change to the constructor signature of ShieldSettingsForm, but it should not affect existing functionality.

Data model changes

None. This change does not affect the data model.

πŸ› Bug report
Status

Active

Version

1.8

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States ryankolsen South Carolina

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024