From b10898d24c2db9ad327508f015dcfdcb2fc0ae6e Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Tue, 10 Mar 2026 15:42:31 +0100 Subject: [PATCH] Fix PHP 8.5 deprecations --- src/PgAsync/Client.php | 2 +- src/PgAsync/Connection.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/PgAsync/Client.php b/src/PgAsync/Client.php index 698811b..621aa37 100644 --- a/src/PgAsync/Client.php +++ b/src/PgAsync/Client.php @@ -38,7 +38,7 @@ class Client /** @var Connection */ private $listenConnection; - public function __construct(array $parameters, LoopInterface $loop = null, ConnectorInterface $connector = null) + public function __construct(array $parameters, ?LoopInterface $loop = null, ?ConnectorInterface $connector = null) { $this->loop = $loop ?: \EventLoop\getLoop(); $this->connector = $connector; diff --git a/src/PgAsync/Connection.php b/src/PgAsync/Connection.php index b9b2771..66cc634 100644 --- a/src/PgAsync/Connection.php +++ b/src/PgAsync/Connection.php @@ -155,7 +155,7 @@ class Connection extends EventEmitter private $tlsConnectorFlags = []; private $password; - public function __construct(array $parameters, LoopInterface $loop, ConnectorInterface $connector = null) + public function __construct(array $parameters, LoopInterface $loop, ?ConnectorInterface $connector = null) { if (!is_array($parameters) || !isset($parameters['user']) || @@ -572,7 +572,7 @@ private function handleRowDescription(RowDescription $message) $this->addColumns($message->getColumns()); } - private function failAllCommandsWith(\Throwable $e = null) + private function failAllCommandsWith(?\Throwable $e = null) { $e = $e ?: new \Exception('unknown error'); @@ -642,7 +642,7 @@ public function processQueue() public function query($query): Observable { return new AnonymousObservable( - function (ObserverInterface $observer, SchedulerInterface $scheduler = null) use ($query) { + function (ObserverInterface $observer, ?SchedulerInterface $scheduler = null) use ($query) { if ($this->connStatus === $this::CONNECTION_NEEDED) { $this->start(); } @@ -692,7 +692,7 @@ public function executeStatement(string $queryString, array $parameters = []): O */ return new AnonymousObservable( - function (ObserverInterface $observer, SchedulerInterface $scheduler = null) use ($queryString, $parameters) { + function (ObserverInterface $observer, ?SchedulerInterface $scheduler = null) use ($queryString, $parameters) { if ($this->connStatus === $this::CONNECTION_NEEDED) { $this->start(); }