Fix deprecated implicit nullable parameter in Dialog::dialogSettings() method

Created on 25 July 2025, about 2 months ago

Problem/Motivation

The Layout Paragraphs module is generating a PHP deprecation warning in drupal 11.2.2:

Deprecated: Drupal\layout_paragraphs\Utility\Dialog::dialogSettings(): Implicitly marking parameter $layout as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/app/web/modules/contrib/layout_paragraphs/src/Utility/Dialog.php on line 62

This occurs because the dialogSettings() method has a parameter with a default value of NULL but doesn't explicitly declare the parameter as nullable using the modern PHP syntax.

Steps to reproduce

Install Layout Paragraphs module on a Drupal site running on drupal 11.2.2
Enable PHP error reporting or check error logs
Use any Layout Paragraphs functionality that calls the Dialog::dialogSettings() method
Observe the deprecation warning in logs or on screen

Proposed resolution

Update the method signature in src/Utility/Dialog.php line 62 to explicitly declare the parameter as nullable:

Current code:

public static function dialogSettings(LayoutParagraphsLayout $layout = NULL)
Fixed code:

public static function dialogSettings(?LayoutParagraphsLayout $layout = NULL)

🐛 Bug report
Status

Needs review

Version

2.1

Component

Code

Created by

🇲🇦Morocco babidar

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

Comments & Activities

Production build 0.71.5 2024