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

Update `Connector` signature to take `$context` as first argument #264

Closed clue closed 3 years ago

clue commented 3 years ago

This changeset updates the Connector signature to take the $context as first argument.

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

// deprecated
$connector = new React\Socket\Connector(null, $context);
$connector = new React\Socket\Connector($loop, $context);

// new
$connector = new React\Socket\Connector($context);
$connector = new React\Socket\Connector($context, $loop);

The new signature has been added to match the new SocketServer and consistently move the now commonly unneeded loop argument to the last argument. The previous signature has been deprecated and should not be used anymore. In its most basic form, both signatures are compatible. Existing code continues to work as-is.

Builds on top of #263, https://github.com/reactphp/http/pull/417 and #260