15
15
16
16
use Bolt \Bolt ;
17
17
use Bolt \error \MessageException ;
18
- use Ds \Vector ;
19
18
use Exception ;
20
19
use Laudis \Neo4j \Common \TransactionHelper ;
21
20
use Laudis \Neo4j \Contracts \ConnectionInterface ;
@@ -60,15 +59,15 @@ public function commit(iterable $statements = []): CypherList
60
59
$ tbr = $ this ->runStatements ($ statements );
61
60
62
61
if ($ this ->finished ) {
63
- throw new Neo4jException (new Vector ( [new Neo4jError ('0 ' , 'Transaction already finished ' )]) );
62
+ throw new Neo4jException ([new Neo4jError ('0 ' , 'Transaction already finished ' )]);
64
63
}
65
64
66
65
try {
67
66
$ this ->getBolt ()->commit ();
68
67
$ this ->finished = true ;
69
68
} catch (Exception $ e ) {
70
69
$ code = TransactionHelper::extractCode ($ e );
71
- throw new Neo4jException (new Vector ( [new Neo4jError ($ code ?? '' , $ e ->getMessage ())]) , $ e );
70
+ throw new Neo4jException ([new Neo4jError ($ code ?? '' , $ e ->getMessage ())], $ e );
72
71
}
73
72
74
73
return $ tbr ;
@@ -77,15 +76,15 @@ public function commit(iterable $statements = []): CypherList
77
76
public function rollback (): void
78
77
{
79
78
if ($ this ->finished ) {
80
- throw new Neo4jException (new Vector ( [new Neo4jError ('0 ' , 'Transaction already finished ' )]) );
79
+ throw new Neo4jException ([new Neo4jError ('0 ' , 'Transaction already finished ' )]);
81
80
}
82
81
83
82
try {
84
83
$ this ->connection ->getImplementation ()->rollback ();
85
84
$ this ->finished = true ;
86
85
} catch (Exception $ e ) {
87
86
$ code = TransactionHelper::extractCode ($ e ) ?? '' ;
88
- throw new Neo4jException (new Vector ( [new Neo4jError ($ code , $ e ->getMessage ())]) , $ e );
87
+ throw new Neo4jException ([new Neo4jError ($ code , $ e ->getMessage ())], $ e );
89
88
}
90
89
}
91
90
@@ -110,8 +109,8 @@ public function runStatement(Statement $statement)
110
109
*/
111
110
public function runStatements (iterable $ statements ): CypherList
112
111
{
113
- /** @var Vector <T> $tbr */
114
- $ tbr = new Vector () ;
112
+ /** @var list <T> $tbr */
113
+ $ tbr = [] ;
115
114
foreach ($ statements as $ statement ) {
116
115
$ extra = ['db ' => $ this ->database ];
117
116
$ parameters = ParameterHelper::formatParameters ($ statement ->getParameters ());
@@ -126,18 +125,18 @@ public function runStatements(iterable $statements): CypherList
126
125
} catch (Throwable $ e ) {
127
126
if ($ e instanceof MessageException) {
128
127
$ code = TransactionHelper::extractCode ($ e ) ?? '' ;
129
- throw new Neo4jException (new Vector ( [new Neo4jError ($ code , $ e ->getMessage ())]) , $ e );
128
+ throw new Neo4jException ([new Neo4jError ($ code , $ e ->getMessage ())], $ e );
130
129
}
131
130
throw $ e ;
132
131
}
133
- $ tbr-> push ( $ this ->formatter ->formatBoltResult (
132
+ $ tbr[] = $ this ->formatter ->formatBoltResult (
134
133
$ meta ,
135
134
$ results ,
136
135
$ this ->connection ,
137
136
$ run - $ start ,
138
137
$ end - $ start ,
139
138
$ statement
140
- )) ;
139
+ );
141
140
}
142
141
143
142
return new CypherList ($ tbr );
0 commit comments