Skip to content

Fix: Add explicit nullable typehints to resolve PHP deprecation warnings#83

Merged
ZhukV merged 1 commit intoZhukV:masterfrom
abavyka:fix/php-explicit-nullable-types
Jun 11, 2025
Merged

Fix: Add explicit nullable typehints to resolve PHP deprecation warnings#83
ZhukV merged 1 commit intoZhukV:masterfrom
abavyka:fix/php-explicit-nullable-types

Conversation

@abavyka
Copy link
Copy Markdown
Contributor

@abavyka abavyka commented Jun 11, 2025

Description:

This Pull Request addresses deprecation warnings related to implicitly marked nullable parameters when running the package with newer PHP versions (specifically PHP 8.1+ up to 8.4, where this deprecation is fully enforced).

Problem:
PHP 8.1 introduced a deprecation notice (E_DEPRECATED) for parameters that are implicitly marked as nullable (e.g., function example($param = null) without a ? typehint). While still functional, this syntax will lead to errors in future PHP versions (e.g., PHP 9.0). This PR fixes warnings like:
Implicitly marking parameter {paramName} as nullable is deprecated, the explicit nullable type must be used instead

Solution:
The changes introduce explicit nullable typehints (?Type) for all parameters that can accept null as a value. This aligns the codebase with modern PHP best practices and eliminates the deprecation warnings.

@ZhukV ZhukV merged commit 4066be8 into ZhukV:master Jun 11, 2025
4 checks passed
@ZhukV
Copy link
Copy Markdown
Owner

ZhukV commented Jun 11, 2025

Thank you for contributing! The version with your changes is v3.2.0.

Note: In this version, the minimum required PHP version is set to 7.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants