Skip to content

fix: mark $previous parameter as explicitly nullable for PHP 8.4 - #18

Open
xelan wants to merge 1 commit into
Slickdeals:masterfrom
xelan:bugfix/php84-implicit-nullable
Open

fix: mark $previous parameter as explicitly nullable for PHP 8.4#18
xelan wants to merge 1 commit into
Slickdeals:masterfrom
xelan:bugfix/php84-implicit-nullable

Conversation

@xelan

@xelan xelan commented Aug 19, 2026

Copy link
Copy Markdown

Implicitly nullable parameters missing the nullable modifier (e.g. function($param = null) instead of function(?$param = null)) are deprecated in PHP 8.4.

This PR fixes the deprecation, only TcpSocketException::__construct() is currently affected by this issue.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@qodo-slickdeals

Copy link
Copy Markdown

PR Summary by Qodo

Declare TcpSocketException previous cause nullable for PHP 8.4

🐞 Bug fix 🕐 Less than 5 minutes

Grey Divider

AI Description

• Explicitly marks the optional previous exception as nullable.
• Prevents implicit-nullability deprecation warnings under PHP 8.4.
High-Level Assessment

The explicit nullable type is the optimal approach because it preserves the constructor API and existing null default while satisfying PHP 8.4. Removing the default or accepting only Exception would introduce an unnecessary compatibility break.

Files changed (1) +1 / -1

Bug fix (1) +1 / -1
TcpSocketException.phpExplicitly allow a nullable previous exception +1/-1

Explicitly allow a nullable previous exception

• Changes the '$previous' constructor parameter from '\Exception' to '?\Exception'. This preserves existing behavior while avoiding PHP 8.4's implicit-nullability deprecation.

src/Connection/TcpSocketException.php

@qodo-slickdeals

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can show, collapse, or hide each part of a finding: code, evidence, and all

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@xelan

xelan commented Aug 19, 2026

Copy link
Copy Markdown
Author

I deliberately kept this PR as small as possible for PHP 8.4 support without deprecations, but keeping BC with the currently supported PHP versions.

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.

1 participant