Minor update to cater php8
Some checks are pending
CI / PHPUnit (highest, 5.4) (push) Waiting to run
CI / PHPUnit (highest, 5.5) (push) Waiting to run
CI / PHPUnit (highest, 5.6) (push) Waiting to run
CI / PHPUnit (highest, 7.0) (push) Waiting to run
CI / PHPUnit (highest, 7.1) (push) Waiting to run
CI / PHPUnit (highest, 7.2) (push) Waiting to run
CI / PHPUnit (highest, 7.3) (push) Waiting to run
CI / PHPUnit (highest, 7.4) (push) Waiting to run
CI / PHPUnit (lowest, 5.4) (push) Waiting to run

This commit is contained in:
Mohamad Faeez 2025-04-09 14:21:15 +08:00
parent 05bb6c9d4e
commit eab09f30df

View File

@ -33,7 +33,7 @@ class IoServer {
* @param \React\Socket\ServerInterface $socket The React socket server to run the Ratchet application off of * @param \React\Socket\ServerInterface $socket The React socket server to run the Ratchet application off of
* @param \React\EventLoop\LoopInterface|null $loop The React looper to run the Ratchet application off of * @param \React\EventLoop\LoopInterface|null $loop The React looper to run the Ratchet application off of
*/ */
public function __construct(MessageComponentInterface $app, ServerInterface $socket, LoopInterface $loop = null) { public function __construct(MessageComponentInterface $app, ServerInterface $socket, ?LoopInterface $loop = null) {
if (false === strpos(PHP_VERSION, "hiphop")) { if (false === strpos(PHP_VERSION, "hiphop")) {
gc_enable(); gc_enable();
} }
@ -54,7 +54,10 @@ class IoServer {
* @param string $address The address to receive sockets on (0.0.0.0 means receive connections from any) * @param string $address The address to receive sockets on (0.0.0.0 means receive connections from any)
* @return IoServer * @return IoServer
*/ */
public static function factory(MessageComponentInterface $component, $port = 80, $address = '0.0.0.0') { public static function factory(MessageComponentInterface $component, integer|null $port = null, string|null $address = null) {
if ($port == null) $port = 80;
if ($address == null) $address = '0.0.0.0';
$loop = LoopFactory::create(); $loop = LoopFactory::create();
$socket = new Reactor($address . ':' . $port, $loop); $socket = new Reactor($address . ':' . $port, $loop);