Problem/Motivation

PHP 8.4 deprecates implicitly nullable parameters. When a parameter has a typed declaration (e.g., array) but has NULL as its default value, PHP 8.4 emits a deprecation warning. In this case:

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

Steps to reproduce

  1. Be in a PHP 8.4 environment
  2. Create a view
  3. Attempt to add a selective filter to the view

Proposed resolution

Add an explicit nullable type declaration to the affected parameter.

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

danherrero created an issue. See original summary.

benjy44’s picture

Status: Active » Reviewed & tested by the community

Hi,
Applying patch from MR !15 resolves warning after upgrading to PHP 8.4.
Tested on Drupal core 10.6 views_selective_filters 2.0.0-alpha2 PHP 8.4

littlecoding’s picture

Confirming that this patch is working with PHP 8.4 and core 11.2.10