Problem/Motivation

PHP 8.4 deprecates implicitly nullable typed parameters.
 
DomainConfigSettingsForm::buildForm() declares $domain with a non-nullable DomainInterface type while assigning NULL as its default value:
 
public function buildForm(array $form, FormStateInterface $form_state, DomainInterface $domain = NULL) {

This generates a PHP 8.4+ deprecation warning.

Steps to reproduce

  1. Install Domain Site Settings on a Drupal site running PHP 8.4 or later.
  2. Exercise code that loads DomainConfigSettingsForm.
  3. Observe the implicitly nullable parameter deprecation for $domain.

Proposed resolution

Explicitly declare the parameter nullable:

public function buildForm(array $form, FormStateInterface $form_state, ?DomainInterface $domain = NULL) {
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

seeduardo created an issue. See original summary.

seeduardo’s picture

Status: Active » Needs review

Small change in the merge request that explicitly declares the $domain parameter nullable, resolving the PHP 8.4 deprecation while preserving the existing behaviour.