Skip to content

Commit

Permalink
Improve PHP 8.4+ support by avoiding implicitly nullable types
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Jul 4, 2024
1 parent 9f04466 commit 4ee049d
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
"require": {
"php": ">=7.1",
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"react/dns": "^1.11",
"react/dns": "^1.13",
"react/event-loop": "^1.2",
"react/promise": "^3 || ^2.6 || ^1.2.1",
"react/stream": "^1.2"
"react/promise": "^3.2 || ^2.6 || ^1.2.1",
"react/stream": "^1.4"
},
"require-dev": {
"phpunit/phpunit": "^9.6 || ^7.5",
"react/async": "^4 || ^3",
"react/async": "^4.3 || ^3",
"react/promise-stream": "^1.4",
"react/promise-timer": "^1.10"
"react/promise-timer": "^1.11"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ final class Connector implements ConnectorInterface
* @param ?LoopInterface $loop
* @throws \InvalidArgumentException for invalid arguments
*/
public function __construct(array $context = array(), LoopInterface $loop = null)
public function __construct(array $context = [], ?LoopInterface $loop = null)
{
// apply default options if not explicitly given
$context += [
Expand Down
2 changes: 1 addition & 1 deletion src/FdServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ final class FdServer extends EventEmitter implements ServerInterface
* @throws \InvalidArgumentException if the listening address is invalid
* @throws \RuntimeException if listening on this address fails (already in use etc.)
*/
public function __construct($fd, LoopInterface $loop = null)
public function __construct($fd, ?LoopInterface $loop = null)
{
if (\preg_match('#^php://fd/(\d+)$#', $fd, $m)) {
$fd = (int) $m[1];
Expand Down
2 changes: 1 addition & 1 deletion src/SecureConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class SecureConnector implements ConnectorInterface
private $streamEncryption;
private $context;

public function __construct(ConnectorInterface $connector, LoopInterface $loop = null, array $context = [])
public function __construct(ConnectorInterface $connector, ?LoopInterface $loop = null, array $context = [])
{
$this->connector = $connector;
$this->streamEncryption = new StreamEncryption($loop ?? Loop::get(), false);
Expand Down
2 changes: 1 addition & 1 deletion src/SecureServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ final class SecureServer extends EventEmitter implements ServerInterface
* @see TcpServer
* @link https://www.php.net/manual/en/context.ssl.php for TLS context options
*/
public function __construct(ServerInterface $tcp, LoopInterface $loop = null, array $context = [])
public function __construct(ServerInterface $tcp, ?LoopInterface $loop = null, array $context = [])
{
// default to empty passphrase to suppress blocking passphrase prompt
$context += [
Expand Down
2 changes: 1 addition & 1 deletion src/SocketServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class SocketServer extends EventEmitter implements ServerInterface
* @throws \InvalidArgumentException if the listening address is invalid
* @throws \RuntimeException if listening on this address fails (already in use etc.)
*/
public function __construct($uri, array $context = [], LoopInterface $loop = null)
public function __construct($uri, array $context = [], ?LoopInterface $loop = null)
{
// apply default options if not explicitly given
$context += [
Expand Down
2 changes: 1 addition & 1 deletion src/TcpConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class TcpConnector implements ConnectorInterface
private $loop;
private $context;

public function __construct(LoopInterface $loop = null, array $context = [])
public function __construct(?LoopInterface $loop = null, array $context = [])
{
$this->loop = $loop ?? Loop::get();
$this->context = $context;
Expand Down
2 changes: 1 addition & 1 deletion src/TcpServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ final class TcpServer extends EventEmitter implements ServerInterface
* @throws \InvalidArgumentException if the listening address is invalid
* @throws \RuntimeException if listening on this address fails (already in use etc.)
*/
public function __construct($uri, LoopInterface $loop = null, array $context = [])
public function __construct($uri, ?LoopInterface $loop = null, array $context = [])
{
$this->loop = $loop ?? Loop::get();

Expand Down
2 changes: 1 addition & 1 deletion src/TimeoutConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class TimeoutConnector implements ConnectorInterface
private $timeout;
private $loop;

public function __construct(ConnectorInterface $connector, $timeout, LoopInterface $loop = null)
public function __construct(ConnectorInterface $connector, $timeout, ?LoopInterface $loop = null)
{
$this->connector = $connector;
$this->timeout = $timeout;
Expand Down
2 changes: 1 addition & 1 deletion src/UnixConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class UnixConnector implements ConnectorInterface
{
private $loop;

public function __construct(LoopInterface $loop = null)
public function __construct(?LoopInterface $loop = null)
{
$this->loop = $loop ?? Loop::get();
}
Expand Down
2 changes: 1 addition & 1 deletion src/UnixServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class UnixServer extends EventEmitter implements ServerInterface
* @throws \InvalidArgumentException if the listening address is invalid
* @throws \RuntimeException if listening on this address fails (already in use etc.)
*/
public function __construct($path, LoopInterface $loop = null, array $context = [])
public function __construct($path, ?LoopInterface $loop = null, array $context = [])
{
$this->loop = $loop ?? Loop::get();

Expand Down

0 comments on commit 4ee049d

Please sign in to comment.