Fix PHP 8.4 implicit nullable deprecation

Created on 26 June 2025, 8 days ago

Problem/Motivation

After updating PHP to 8.4 deprecation errors for implicitly nullable method parameters are thrown, primarily with the SmartIp class and classes implementing WebServiceUtilityInterface.

This is now part of Drupal standards, but the ticket for phpcs fixes has stalled. This ticket is to address the deprecation errors only.

Steps to reproduce

- Install, enable and configure smart_ip module
- Update PHP to 8.4.
- Witness error messages in the browser.

Deprecated: Drupal\smart_ip\SmartIp::query(): Implicitly marking parameter $ip as nullable is deprecated, the explicit nullable type must be used instead in /var/www/web/modules/contrib/smart_ip/src/SmartIp.php on line 31

Deprecated: Drupal\smart_ip\SmartIp::isUserDebugMode(): Implicitly marking parameter $uid as nullable is deprecated, the explicit nullable type must be used instead in /var/www/web/modules/contrib/smart_ip/src/SmartIp.php on line 203

Deprecated: Drupal\smart_ip\SmartIp::ipAddressVersion(): Implicitly marking parameter $ipAddress as nullable is deprecated, the explicit nullable type must be used instead in /var/www/web/modules/contrib/smart_ip/src/SmartIp.php on line 439

Deprecated: Drupal\smart_ip\SmartIpLocation::get(): Implicitly marking parameter $key as nullable is deprecated, the explicit nullable type must be used instead in /var/www/web/modules/contrib/smart_ip/src/SmartIpLocation.php on line 156

...

Proposed resolution

Update various method signatures with explicitly nullable types.

🐛 Bug report
Status

Active

Version

5.0

Component

Code

Created by

🇨🇦Canada tmusika

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024