Problem/Motivation

When running Drupal with PHP 8.4, the following deprecation warning is triggered:

Deprecated: Drupal\entity_reference_exposed_filters\Plugin\views\filter\EREFNodeTitles::init(): Implicitly marking parameter $options as nullable is deprecated, the explicit nullable type must be used instead in /web/modules/contrib/entity_reference_exposed_filters/src/Plugin/views/filter/EREFNodeTitles.php on line 141

PHP 8.4 has deprecated implicit nullable type declarations. Parameters with a default value of NULL must now use explicit nullable type syntax (e.g., ?array instead of array).

The EREFNodeTitles::init() method signature needs to be updated to explicitly mark the $options parameter as nullable to maintain compatibility with PHP 8.4.

Steps to reproduce

1. Install and enable the entity_reference_exposed_filters module
2. Create a view that uses the "Entity Reference Exposed Filters: Node Titles" filter
3. Run the site on PHP 8.4
4. Access the view page
5. Observe the deprecation warning in error logs or on screen (depending on error reporting settings)

Proposed resolution

Update the method signature in EREFNodeTitles.php line 141:

Before:
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)

After:
public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL)

Comments

andysipple created an issue. See original summary.

flyke’s picture

Status: Active » Reviewed & tested by the community

I can confirm that the patch works.