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
- Install Domain Site Settings on a Drupal site running PHP 8.4 or later.
- Exercise code that loads DomainConfigSettingsForm.
- 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) {
Comments
Comment #3
seeduardo commentedSmall change in the merge request that explicitly declares the $domain parameter nullable, resolving the PHP 8.4 deprecation while preserving the existing behaviour.