2323use Laudis \Neo4j \Databags \ConnectionRequestData ;
2424use Laudis \Neo4j \Databags \DriverConfiguration ;
2525use Laudis \Neo4j \Databags \SessionConfiguration ;
26-
2726use Laudis \Neo4j \Exception \ConnectionPoolException ;
28- use function method_exists ;
29- use function microtime ;
30-
3127use Psr \Http \Message \UriInterface ;
3228
3329use function shuffle ;
@@ -45,7 +41,7 @@ public function __construct(
4541 private readonly BoltFactory $ factory ,
4642 private readonly ConnectionRequestData $ data ,
4743 private readonly ?Neo4jLogger $ logger ,
48- private readonly float $ acquireConnectionTimeout
44+ private readonly float $ acquireConnectionTimeout,
4945 ) {
5046 }
5147
@@ -72,6 +68,9 @@ public static function create(
7268
7369 public function acquire (SessionConfiguration $ config ): Generator
7470 {
71+ /**
72+ * @var Generator<int, float, bool, BoltConnection>
73+ */
7574 return (function () use ($ config ) {
7675 $ connection = $ this ->reuseConnectionIfPossible ($ config );
7776 if ($ connection !== null ) {
@@ -93,7 +92,7 @@ public function acquire(SessionConfiguration $config): Generator
9392
9493 $ generator ->next ();
9594 } else {
96- throw new ConnectionPoolException ('Connection acquire timeout reached: ' . $ waitTime );
95+ throw new ConnectionPoolException ('Connection acquire timeout reached: ' .( $ waitTime ?? 0.0 ) );
9796 }
9897 }
9998
@@ -127,7 +126,7 @@ public function getLogger(): ?Neo4jLogger
127126 return $ this ->logger ;
128127 }
129128
130- private function reuseConnectionIfPossible (SessionConfiguration $ config ): ?ConnectionInterface
129+ private function reuseConnectionIfPossible (SessionConfiguration $ config ): ?BoltConnection
131130 {
132131 // Ensure random connection reuse before picking one.
133132 shuffle ($ this ->activeConnections );
0 commit comments