Skip to content

Commit 86d5d4a

Browse files
committed
Aligning with laminas-db changes
Signed-off-by: Joey Smith <jsmith@webinertia.net> Signed-off-by: Joey Smith <jsmith@webinertia.net>
1 parent b4da8d5 commit 86d5d4a

File tree

5 files changed

+136
-147
lines changed

5 files changed

+136
-147
lines changed

composer.lock

Lines changed: 40 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Driver/Mysqli/Connection.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
use Exception as GenericException;
88
use 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;
912
use Laminas\Db\Adapter\Driver\ResultInterface;
1013
use Laminas\Db\Adapter\Exception;
1114
use Laminas\Db\Adapter\Exception\InvalidArgumentException;
@@ -20,10 +23,9 @@
2023
use const MYSQLI_CLIENT_SSL;
2124
use 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

Comments
 (0)