99use Doctrine \DBAL \Jaeger \Tag \DbalErrorCodeTag ;
1010use Doctrine \DBAL \Jaeger \Tag \DbalNestingLevelTag ;
1111use Doctrine \DBAL \Jaeger \Tag \DbalRowNumberTag ;
12+ use Doctrine \DBAL \Result ;
13+ use Doctrine \DBAL \Statement ;
1214use Jaeger \Tag \DbInstanceTag ;
1315use Jaeger \Tag \DbStatementTag ;
1416use Jaeger \Tag \DbType ;
@@ -54,18 +56,18 @@ public function connect(): bool
5456 }
5557 }
5658
57- public function prepare ($ prepareString )
59+ public function prepare (string $ sql ): Statement
5860 {
5961 $ span = $ this ->tracer
6062 ->start ('dbal.prepare ' )
6163 ->addTag (new DbInstanceTag ($ this ->getDatabase ()))
6264 ->addTag (new DbUser ($ this ->getUsername ()))
6365 ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
6466 ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
65- ->addTag (new DbStatementTag ($ this ->cutLongSql ($ prepareString )))
67+ ->addTag (new DbStatementTag ($ this ->cutLongSql ($ sql )))
6668 ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
6769 try {
68- return parent ::prepare ($ prepareString );
70+ return parent ::prepare ($ sql );
6971 } catch (\Exception $ e ) {
7072 $ span ->addTag (new DbalErrorCodeTag ($ e ->getCode ()))
7173 ->addTag (new ErrorTag ());
@@ -75,18 +77,18 @@ public function prepare($prepareString)
7577 }
7678 }
7779
78- public function executeQuery ($ query , array $ params = [], $ types = [], QueryCacheProfile $ qcp = null )
80+ public function executeQuery (string $ sql , array $ params = [], $ types = [], QueryCacheProfile $ qcp = null ): Result
7981 {
8082 $ span = $ this ->tracer
8183 ->start ('dbal.execute ' )
8284 ->addTag (new DbInstanceTag ($ this ->getDatabase ()))
8385 ->addTag (new DbUser ($ this ->getUsername ()))
8486 ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
8587 ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
86- ->addTag (new DbStatementTag ($ this ->cutLongSql ($ query )))
88+ ->addTag (new DbStatementTag ($ this ->cutLongSql ($ sql )))
8789 ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
8890 try {
89- return parent ::executeQuery ($ query , $ params , $ types , $ qcp );
91+ return parent ::executeQuery ($ sql , $ params , $ types , $ qcp );
9092 } catch (\Exception $ e ) {
9193 $ span ->addTag (new DbalErrorCodeTag ($ e ->getCode ()))
9294 ->addTag (new ErrorTag ());
@@ -96,18 +98,18 @@ public function executeQuery($query, array $params = [], $types = [], QueryCache
9698 }
9799 }
98100
99- public function executeUpdate ($ query , array $ params = [], array $ types = [])
101+ public function executeUpdate (string $ sql , array $ params = [], array $ types = []): int
100102 {
101103 $ span = $ this ->tracer
102104 ->start ('dbal.execute ' )
103105 ->addTag (new DbInstanceTag ($ this ->getDatabase ()))
104106 ->addTag (new DbUser ($ this ->getUsername ()))
105107 ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
106108 ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
107- ->addTag (new DbStatementTag ($ this ->cutLongSql ($ query )))
109+ ->addTag (new DbStatementTag ($ this ->cutLongSql ($ sql )))
108110 ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
109111 try {
110- return parent ::executeUpdate ($ query , $ params , $ types );
112+ return parent ::executeUpdate ($ sql , $ params , $ types );
111113 } catch (\Exception $ e ) {
112114 $ span ->addTag (new DbalErrorCodeTag ($ e ->getCode ()))
113115 ->addTag (new ErrorTag ());
@@ -117,19 +119,18 @@ public function executeUpdate($query, array $params = [], array $types = [])
117119 }
118120 }
119121
120- public function query ()
122+ public function query (string $ sql ): Result
121123 {
122- $ args = func_get_args ();
123124 $ span = $ this ->tracer
124125 ->start ('dbal.query ' )
125- ->addTag (new DbStatementTag ($ this ->cutLongSql ($ args [ 0 ] )))
126+ ->addTag (new DbStatementTag ($ this ->cutLongSql ($ sql )))
126127 ->addTag (new DbInstanceTag ($ this ->getDatabase ()))
127128 ->addTag (new DbUser ($ this ->getUsername ()))
128129 ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
129130 ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
130131 ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
131132 try {
132- return parent ::query (... $ args );
133+ return parent ::query ($ sql );
133134 } catch (\Exception $ e ) {
134135 $ span ->addTag (new DbalErrorCodeTag ($ e ->getCode ()))
135136 ->addTag (new ErrorTag ());
@@ -139,7 +140,7 @@ public function query()
139140 }
140141 }
141142
142- public function exec ($ statement )
143+ public function exec (string $ sql ): int
143144 {
144145 $ span = $ this ->tracer
145146 ->start ('dbal.exec ' )
@@ -149,7 +150,7 @@ public function exec($statement)
149150 ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
150151 ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
151152 try {
152- $ rows = parent ::exec ($ statement );
153+ $ rows = parent ::exec ($ sql );
153154 $ span ->addTag (new DbalRowNumberTag ($ rows ));
154155
155156 return $ rows ;
@@ -162,7 +163,7 @@ public function exec($statement)
162163 }
163164 }
164165
165- public function beginTransaction ()
166+ public function beginTransaction (): bool
166167 {
167168 $ span = $ this ->tracer
168169 ->start ('dbal.transaction ' )
@@ -171,7 +172,7 @@ public function beginTransaction()
171172 ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
172173 ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()));
173174 try {
174- parent ::beginTransaction ();
175+ return parent ::beginTransaction ();
175176 } catch (\Exception $ e ) {
176177 $ span ->addTag (new DbalErrorCodeTag ($ e ->getCode ()))
177178 ->addTag (new ErrorTag ());
@@ -181,7 +182,7 @@ public function beginTransaction()
181182 }
182183 }
183184
184- public function commit ()
185+ public function commit (): bool
185186 {
186187 $ span = $ this ->tracer
187188 ->start ('dbal.commit ' )
@@ -190,7 +191,7 @@ public function commit()
190191 ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
191192 ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()));
192193 try {
193- parent ::commit ();
194+ return parent ::commit ();
194195 } catch (\Exception $ e ) {
195196 $ span ->addTag (new DbalErrorCodeTag ($ e ->getCode ()))
196197 ->addTag (new ErrorTag ());
@@ -200,7 +201,7 @@ public function commit()
200201 }
201202 }
202203
203- public function rollBack ()
204+ public function rollBack (): bool
204205 {
205206 $ span = $ this ->tracer
206207 ->start ('dbal.rollback ' )
0 commit comments