reactphp / socket

Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP.
https://reactphp.org/socket/
MIT License
1.21k stars 157 forks source link

Drop deprecated alternative `Connector` constructor argument order #315

Closed clue closed 5 months ago

clue commented 5 months ago

This simple changeset drops the deprecated alternative Connector constructor argument order. As of v1.9.0, we recommend using the new Connector signature with the optional $context as first argument and optional $loop as second argument, so upgrading should be straightforward for most use cases:

// unchanged
$connector = new React\Socket\Connector();

// old (no longer supported)
$connector = new React\Socket\Connector(null, $context);
$connector = new React\Socket\Connector($loop, $context);

// new (already supported since v1.9.0)
$connector = new React\Socket\Connector($context);
$connector = new React\Socket\Connector($context, $loop);

The original deprecation message has been in place for a couple of years already, so this should be relatively safe to apply.

Note that this temporarily introduces an implicitly nullable type that should be removed in a follow-up as discussed in https://github.com/reactphp/promise/pull/260. Additionally, a follow-up PR should drop the entire $loop argument as discussed in #312.

Builds on top of #264 and #314.