Skip to content

Improve PHP 8.4+ support by avoiding implicitly nullable types#123

Merged
clue merged 1 commit intoclue:1.xfrom
clue-labs:php8.4
Apr 13, 2026
Merged

Improve PHP 8.4+ support by avoiding implicitly nullable types#123
clue merged 1 commit intoclue:1.xfrom
clue-labs:php8.4

Conversation

@clue
Copy link
Copy Markdown
Owner

@clue clue commented Apr 13, 2026

This changeset improves PHP 8.4+ support by avoiding implicitly nullable types as discussed in reactphp/promise#260. The same idea applies, but v1 requires manual type checks to support legacy PHP versions as the nullable type syntax requires PHP 7.1+ otherwise.

The clue/connection-manager-extra dev dependency used in some examples is not affected here because the specific classes used do not use implicitly nullable types (see clue/reactphp-connection-manager-extra#41).

Builds on top of #122, #121, #113, reactphp/promise#260, reactphp/socket#318 and others

@clue clue added this to the v1.5.0 milestone Apr 13, 2026
@clue clue added the new feature New feature or request label Apr 13, 2026
@clue clue requested a review from Copilot April 13, 2026 00:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves compatibility with PHP 8.4+ by avoiding “implicitly nullable” parameter type declarations (typed parameters with a null default), replacing them with untyped parameters plus explicit runtime validation while keeping support for older PHP versions.

Changes:

  • Removed implicitly-nullable parameter type hints from Server and Client constructors and added manual instanceof validation with clear InvalidArgumentException messages.
  • Added PHPUnit coverage for invalid constructor arguments (loop/connector).
  • Updated dependency constraints and CI to include PHP 8.4.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Server.php Drops implicitly-nullable constructor type hints and adds explicit runtime validation for $loop/$connector.
src/Client.php Drops implicitly-nullable constructor type hint and adds explicit runtime validation for $connector.
tests/ServerTest.php Adds tests asserting constructor rejects invalid $loop/$connector types with expected messages.
tests/ClientTest.php Adds test asserting constructor rejects invalid $connector type with expected message.
composer.json Updates ReactPHP-related dependency version constraints.
.github/workflows/ci.yml Adds PHP 8.4 to the test matrix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@clue clue merged commit d2cfadd into clue:1.x Apr 13, 2026
15 checks passed
@clue clue deleted the php8.4 branch April 13, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants