PHP 8.4 compatibility

Created on 25 July 2025, 9 days ago

Problem/Motivation

There are 2 deprecation warnings when module is installed with PHP 8.4:

Deprecated function: Drupal\wpf\ImageFactory::createImageCopy(): Implicitly marking parameter $quality as nullable is deprecated, the explicit nullable type must be used instead w include() (linia 571 w /vendor/composer/ClassLoader.php)

Deprecated function: Drupal\wpf\ImageFactory::setDestinationUri(): Implicitly marking parameter $uri as nullable is deprecated, the explicit nullable type must be used instead w include() (linia 571 w /vendor/composer/ClassLoader.php)

Steps to reproduce

composer require --dev --with-all-dependencies \
    phpcompatibility/php-compatibility:10.x@dev \
    dealerdirect/phpcodesniffer-composer-installer:^1.1
vendor/bin/phpcs -p -s \
  --standard=PHPCompatibility \
  --runtime-set testVersion 8.4 \
  --extensions="inc,install,module,php,profile,theme" \
  --ignore="core/lib/Drupal/Core/Test/*,*/tests/*" \
  web/modules/contrib/wpf

Results in:

web/modules/contrib/wpf/src/ImageFactory.php
---
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---
165 | WARNING | Implicitly marking a parameter as nullable is deprecated since PHP 8.4. Update the type to be explicitly nullable instead. Found implicitly nullable parameter: $quality. (PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated)
231 | WARNING | Implicitly marking a parameter as nullable is deprecated since PHP 8.4. Update the type to be explicitly nullable instead. Found implicitly nullable parameter: $uri. (PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated)

Proposed resolution

Explicitly mark parameters as nullable.

📌 Task
Status

Active

Version

1.2

Component

Code

Created by

🇵🇱Poland mscieszka

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

Comments & Activities

Production build 0.71.5 2024