fix: make all implicitly-nullable parameters explicit (PHP 8.4 deprecation) - #7
Merged
struzik-vladislav merged 2 commits intoAug 9, 2026
Conversation
added 2 commits
July 30, 2026 10:54
`setNewPassword(string $newPassword = null)` relies on the implicit
conversion of a typed parameter with a `null` default into a nullable
type. PHP 8.4 deprecates this (E_DEPRECATED, emitted when the class is
loaded), so any consumer autoloading LoginRequest on PHP >= 8.4 gets:
Struzik\EPPClient\Request\Session\LoginRequest::setNewPassword():
Implicitly marking parameter $newPassword as nullable is deprecated,
the explicit nullable type must be used instead
Use the explicit `?string` type. This is the last remaining implicit
nullable in the package (every other optional setter already uses
`?string`/`?int`), behaviour is unchanged, and `?string` is valid on
all supported versions (php ^7.4|^8.0).
Same PHP 8.4 implicit-nullable deprecation as the LoginRequest change, in the three other spots in the package that still relied on it: - ResponseInterface::get() / getFirst() — `\DOMNode $contextNode = null` - UpdateContactRequest::setDisclose() — `Disclose $disclose = null` The ResponseInterface ones are the most impactful: the deprecation is emitted when the interface is loaded, so any consumer that runs response parsing inside an error-to-exception handler (e.g. the E_ALL handler in struzik-vladislav/epp-socket-connection) has the notice promoted to a fatal error and every EPP connection breaks on PHP 8.4+. AbstractResponse already uses `?\DOMNode`, so the interface was also inconsistent with its own implementation. After this, no implicitly-nullable parameters remain in src/.
Author
|
Expanded this PR beyond the original one-line |
Owner
|
Hi @kiuka |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Several methods declare a typed parameter with a
nulldefault but no explicit?— relying on the implicit conversion to a nullable type. PHP 8.4 deprecates this (E_DEPRECATED), emitted when the declaration is loaded (not when the method is called), so consumers on PHP ≥ 8.4 get, e.g.:Fix
Make every implicitly-nullable parameter in
src/explicit. There are four, all covered by this PR:Request/Session/LoginRequest::setNewPassword()string $newPassword = null?stringRequest/Contact/UpdateContactRequest::setDisclose()Disclose $disclose = null?DiscloseResponse/ResponseInterface::get()\DOMNode $contextNode = null?\DOMNodeResponse/ResponseInterface::getFirst()\DOMNode $contextNode = null?\DOMNodeAfter this, no implicitly-nullable parameters remain in
src/.Why the
ResponseInterfaceones matter in practiceBecause the deprecation fires when the interface is loaded, it's not just cosmetic. Any consumer that parses EPP responses inside an error-to-exception handler has the notice promoted to a fatal error. Concretely,
struzik-vladislav/epp-socket-connectionwraps its socket IO in anE_ALLerror handler (to turn socket/TLS warnings into exceptions); on PHP 8.4+ this implicit-nullable deprecation is raised while reading the server greeting and surfaces asConnectionException: Can not open connection to the EPP server— i.e. every EPP connection breaks.AbstractResponsealready uses?\DOMNode, so the interface was also inconsistent with its own implementation.Compatibility
?Typeis valid on the full supported range (php: ^7.4|^8.0); behaviour is unchanged. No test changes required.