21
21
use Laudis \Neo4j \Contracts \UnmanagedTransactionInterface ;
22
22
use Laudis \Neo4j \Databags \SessionConfiguration ;
23
23
use Laudis \Neo4j \Databags \Statement ;
24
+ use Laudis \Neo4j \Databags \SummarizedResult ;
24
25
use Laudis \Neo4j \Databags \TransactionConfiguration ;
25
26
use Laudis \Neo4j \Enum \AccessMode ;
26
27
use Laudis \Neo4j \Types \CypherList ;
27
28
28
29
/**
29
30
* A collection of drivers with methods to run queries though them.
30
- *
31
- * @template ResultFormat
32
- *
33
- * @implements ClientInterface<ResultFormat>
34
31
*/
35
32
final class Client implements ClientInterface
36
33
{
37
34
/**
38
- * @var array<string, list<UnmanagedTransactionInterface<ResultFormat> >>
35
+ * @var array<string, list<UnmanagedTransactionInterface>>
39
36
*/
40
37
private array $ boundTransactions = [];
41
38
42
39
/**
43
- * @var array<string, SessionInterface<ResultFormat> >
40
+ * @var array<string, SessionInterface>
44
41
*/
45
42
private array $ boundSessions = [];
46
43
47
44
/**
48
45
* @psalm-mutation-free
49
46
*
50
- * @param DriverSetupManager<ResultFormat> $driverSetups
47
+ * @param DriverSetupManager $driverSetups
51
48
*/
52
49
public function __construct (
53
50
private readonly DriverSetupManager $ driverSetups ,
@@ -70,12 +67,12 @@ public function getDefaultTransactionConfiguration(): TransactionConfiguration
70
67
return $ this ->defaultTransactionConfiguration ;
71
68
}
72
69
73
- public function run (string $ statement , iterable $ parameters = [], ?string $ alias = null )
70
+ public function run (string $ statement , iterable $ parameters = [], ?string $ alias = null ): SummarizedResult
74
71
{
75
72
return $ this ->runStatement (Statement::create ($ statement , $ parameters ), $ alias );
76
73
}
77
74
78
- public function runStatement (Statement $ statement , ?string $ alias = null )
75
+ public function runStatement (Statement $ statement , ?string $ alias = null ): SummarizedResult
79
76
{
80
77
return $ this ->runStatements ([$ statement ], $ alias )->first ();
81
78
}
@@ -86,6 +83,7 @@ private function getRunner(?string $alias = null): TransactionInterface|SessionI
86
83
87
84
if (array_key_exists ($ alias , $ this ->boundTransactions ) &&
88
85
count ($ this ->boundTransactions [$ alias ]) > 0 ) {
86
+ /** @psalm-suppress PossiblyNullArrayOffset */
89
87
return $ this ->boundTransactions [$ alias ][array_key_last ($ this ->boundTransactions [$ alias ])];
90
88
}
91
89
@@ -126,9 +124,6 @@ public function getDriver(?string $alias): DriverInterface
126
124
return $ this ->driverSetups ->getDriver ($ this ->defaultSessionConfiguration , $ alias );
127
125
}
128
126
129
- /**
130
- * @return SessionInterface<ResultFormat>
131
- */
132
127
private function startSession (?string $ alias , SessionConfiguration $ configuration ): SessionInterface
133
128
{
134
129
return $ this ->getDriver ($ alias )->createSession ($ configuration );
@@ -187,7 +182,7 @@ public function rollbackBoundTransaction(?string $alias = null, int $depth = 1):
187
182
}
188
183
189
184
/**
190
- * @param callable(UnmanagedTransactionInterface<ResultFormat> ): void $handler
185
+ * @param callable(UnmanagedTransactionInterface): void $handler
191
186
*/
192
187
private function popTransactions (callable $ handler , ?string $ alias = null , int $ depth = 1 ): void
193
188
{
0 commit comments