66
77use Exception as GenericException ;
88use Laminas \Db \Adapter \Driver \AbstractConnection ;
9+ use Laminas \Db \Adapter \Driver \ConnectionInterface ;
10+ use Laminas \Db \Adapter \Driver \DriverAwareInterface ;
11+ use Laminas \Db \Adapter \Driver \DriverInterface ;
912use Laminas \Db \Adapter \Driver \ResultInterface ;
1013use Laminas \Db \Adapter \Exception ;
1114use Laminas \Db \Adapter \Exception \InvalidArgumentException ;
2023use const MYSQLI_CLIENT_SSL ;
2124use const MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT ;
2225
23- class Connection extends AbstractConnection
26+ class Connection extends AbstractConnection implements DriverAwareInterface
2427{
25- /** @var Mysqli */
26- protected $ driver ;
28+ protected Mysqli $ driver ;
2729
2830 /** @var \mysqli */
2931 protected $ resource ;
@@ -47,7 +49,7 @@ public function __construct($connectionInfo = null)
4749 }
4850 }
4951
50- public function setDriver (Mysqli $ driver ): static
52+ public function setDriver (DriverInterface $ driver ): DriverAwareInterface
5153 {
5254 $ this ->driver = $ driver ;
5355
@@ -73,7 +75,7 @@ public function getCurrentSchema(): string|bool
7375 *
7476 * @return $this Provides a fluent interface
7577 */
76- public function setResource (\mysqli $ resource )
78+ public function setResource (\mysqli $ resource ): static
7779 {
7880 $ this ->resource = $ resource ;
7981
@@ -82,7 +84,7 @@ public function setResource(\mysqli $resource)
8284
8385 /** @inheritDoc */
8486 #[Override]
85- public function connect (): static
87+ public function connect (): ConnectionInterface
8688 {
8789 if ($ this ->resource instanceof \mysqli) {
8890 return $ this ;
@@ -184,7 +186,7 @@ public function isConnected(): bool
184186
185187 /** @inheritDoc */
186188 #[Override]
187- public function disconnect (): static
189+ public function disconnect (): ConnectionInterface
188190 {
189191 if ($ this ->resource instanceof \mysqli) {
190192 $ this ->resource ->close ();
@@ -195,7 +197,7 @@ public function disconnect(): static
195197
196198 /** @inheritDoc */
197199 #[Override]
198- public function beginTransaction (): static
200+ public function beginTransaction (): ConnectionInterface
199201 {
200202 if (! $ this ->isConnected ()) {
201203 $ this ->connect ();
@@ -209,7 +211,7 @@ public function beginTransaction(): static
209211
210212 /** @inheritDoc */
211213 #[Override]
212- public function commit (): static
214+ public function commit (): ConnectionInterface
213215 {
214216 if (! $ this ->isConnected ()) {
215217 $ this ->connect ();
@@ -224,7 +226,7 @@ public function commit(): static
224226
225227 /** @inheritDoc */
226228 #[Override]
227- public function rollback (): static
229+ public function rollback (): ConnectionInterface
228230 {
229231 if (! $ this ->isConnected ()) {
230232 throw new Exception \RuntimeException ('Must be connected before you can rollback. ' );
@@ -247,7 +249,7 @@ public function rollback(): static
247249 * @throws Exception\InvalidQueryException
248250 */
249251 #[Override]
250- public function execute ($ sql ): ResultInterface
252+ public function execute ($ sql ): ? ResultInterface
251253 {
252254 if (! $ this ->isConnected ()) {
253255 $ this ->connect ();
0 commit comments