Skip to content

Commit a6b860e

Browse files
authored
fix: improve compatibility with PHP 8.4 (#214)
2 parents bdb9d34 + 3822f76 commit a6b860e

38 files changed

+398
-370
lines changed

composer.lock

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

src/Database.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,21 @@ public function query(string $query, array $parameters = []): StatementInterface
132132
->query($query, $parameters);
133133
}
134134

135-
public function insert(string $table = null): InsertQuery
135+
public function insert(?string $table = null): InsertQuery
136136
{
137137
return $this->getDriver(self::WRITE)
138138
->getQueryBuilder()
139139
->insertQuery($this->prefix, $table);
140140
}
141141

142-
public function update(string $table = null, array $values = [], array $where = []): UpdateQuery
142+
public function update(?string $table = null, array $values = [], array $where = []): UpdateQuery
143143
{
144144
return $this->getDriver(self::WRITE)
145145
->getQueryBuilder()
146146
->updateQuery($this->prefix, $table, $where, $values);
147147
}
148148

149-
public function delete(string $table = null, array $where = []): DeleteQuery
149+
public function delete(?string $table = null, array $where = []): DeleteQuery
150150
{
151151
return $this->getDriver(self::WRITE)
152152
->getQueryBuilder()
@@ -168,7 +168,7 @@ public function select(mixed $columns = '*'): SelectQuery
168168

169169
public function transaction(
170170
callable $callback,
171-
string $isolationLevel = null,
171+
?string $isolationLevel = null,
172172
): mixed {
173173
$this->begin($isolationLevel);
174174

@@ -183,7 +183,7 @@ public function transaction(
183183
}
184184
}
185185

186-
public function begin(string $isolationLevel = null): bool
186+
public function begin(?string $isolationLevel = null): bool
187187
{
188188
return $this->getDriver(self::WRITE)->beginTransaction($isolationLevel);
189189
}

src/DatabaseInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ public function select(mixed $columns = '*'): SelectQuery;
142142
* @throws \Throwable
143143
*
144144
*/
145-
public function transaction(callable $callback, string $isolationLevel = null): mixed;
145+
public function transaction(callable $callback, ?string $isolationLevel = null): mixed;
146146

147147
/**
148148
* Start database transaction.
149149
*
150150
* @link http://en.wikipedia.org/wiki/Database_transaction
151151
*/
152-
public function begin(string $isolationLevel = null): bool;
152+
public function begin(?string $isolationLevel = null): bool;
153153

154154
/**
155155
* Commit the active database transaction.

src/DatabaseManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function getDatabases(): array
8787
*
8888
* @throws DBALException
8989
*/
90-
public function database(string $database = null): DatabaseInterface
90+
public function database(?string $database = null): DatabaseInterface
9191
{
9292
if ($database === null) {
9393
$database = $this->config->getDefaultDatabase();

src/DatabaseProviderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ interface DatabaseProviderInterface
2121
* @throws DBALException
2222
*
2323
*/
24-
public function database(string $database = null): DatabaseInterface;
24+
public function database(?string $database = null): DatabaseInterface;
2525
}

src/Driver/Compiler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ protected function groupBy(QueryParameters $params, Quoter $q, array $groupBy):
329329
abstract protected function limit(
330330
QueryParameters $params,
331331
Quoter $q,
332-
int $limit = null,
333-
int $offset = null,
332+
?int $limit = null,
333+
?int $offset = null,
334334
): string;
335335

336336
protected function updateQuery(

src/Driver/Driver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public function execute(string $query, array $parameters = []): int
235235
*
236236
* @return mixed
237237
*/
238-
public function lastInsertID(string $sequence = null)
238+
public function lastInsertID(?string $sequence = null)
239239
{
240240
$result = $this->getPDO()->lastInsertId();
241241
$this->logger?->debug("Insert ID: {$result}");
@@ -256,7 +256,7 @@ public function getTransactionLevel(): int
256256
* @link http://en.wikipedia.org/wiki/Isolation_(database_systems)
257257
*
258258
*/
259-
public function beginTransaction(string $isolationLevel = null): bool
259+
public function beginTransaction(?string $isolationLevel = null): bool
260260
{
261261
++$this->transactionLevel;
262262

src/Driver/DriverInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function execute(string $query, array $parameters = []): int;
176176
*
177177
* @return mixed
178178
*/
179-
public function lastInsertID(string $sequence = null);
179+
public function lastInsertID(?string $sequence = null);
180180

181181
/**
182182
* Start SQL transaction with specified isolation level (not all DBMS support it). Nested
@@ -187,7 +187,7 @@ public function lastInsertID(string $sequence = null);
187187
*
188188
* @return bool True of success.
189189
*/
190-
public function beginTransaction(string $isolationLevel = null): bool;
190+
public function beginTransaction(?string $isolationLevel = null): bool;
191191

192192
/**
193193
* Commit the active database transaction.

src/Driver/HandlerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function hasTable(string $table): bool;
7878
* @throws HandlerException
7979
*
8080
*/
81-
public function getSchema(string $table, string $prefix = null): AbstractTable;
81+
public function getSchema(string $table, ?string $prefix = null): AbstractTable;
8282

8383
/**
8484
* Create table based on a given schema.

src/Driver/MySQL/MySQLCompiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function insertQuery(QueryParameters $params, Quoter $q, array $tokens
4141
*
4242
* @link http://dev.mysql.com/doc/refman/5.0/en/select.html#id4651990
4343
*/
44-
protected function limit(QueryParameters $params, Quoter $q, int $limit = null, int $offset = null): string
44+
protected function limit(QueryParameters $params, Quoter $q, ?int $limit = null, ?int $offset = null): string
4545
{
4646
if ($limit === null && $offset === null) {
4747
return '';

0 commit comments

Comments
 (0)