Skip to content

PHP 8.4 deprecation: implicitly nullable parameter $labelSuffix in ApiClientHelper #129

Description

@Top-CMS

Description

On PHP 8.4, running setup:di:compile (Magento 2) produces the following deprecation warning:

PHP Deprecated: PostcodeEu\AddressValidation\Helper\ApiClientHelper::_formatHouseNumberAdditionOption():
Implicitly marking parameter $labelSuffix as nullable is deprecated,
the explicit nullable type must be used instead
in Helper/ApiClientHelper.php on line 375

Root cause

PHP 8.4 deprecated implicitly nullable parameter types (RFC).
The signature on line 375 uses string $labelSuffix = null, which is no longer allowed without an explicit ?.

Affected file

Helper/ApiClientHelper.php, line 375:

// Current (deprecated in PHP 8.4)
private function _formatHouseNumberAdditionOption(int $houseNumber, string $addition, string $labelSuffix = null): array

// Fixed
private function _formatHouseNumberAdditionOption(int $houseNumber, string $addition, ?string $labelSuffix = null): array

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions