Skip to content

Commit 07659b3

Browse files
committed
Fix PHPStan errors
1 parent 103a573 commit 07659b3

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

system/Database/BaseBuilder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,8 +2255,10 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc
22552255
protected function _updateBatch(string $table, array $values, string $index): string
22562256
{
22572257
// this is a work around until the rest of the platform is refactored
2258-
$this->QBOptions['constraints'] = [$index];
2259-
$keys = array_keys(current($values));
2258+
if ($index !== '') {
2259+
$this->QBOptions['constraints'] = [$index];
2260+
}
2261+
$keys = array_keys(current($values));
22602262

22612263
$sql = $this->QBOptions['sql'] ?? '';
22622264

system/Database/MySQLi/Builder.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
namespace CodeIgniter\Database\MySQLi;
1313

1414
use CodeIgniter\Database\BaseBuilder;
15+
use CodeIgniter\Database\Exceptions\DatabaseException;
16+
use CodeIgniter\Database\RawSql;
1517

1618
/**
1719
* Builder for MySQLi
@@ -60,8 +62,10 @@ protected function _fromTables(): string
6062
protected function _updateBatch(string $table, array $values, string $index): string
6163
{
6264
// this is a work around until the rest of the platform is refactored
63-
$this->QBOptions['constraints'] = [$index];
64-
$keys = array_keys(current($values));
65+
if ($index !== '') {
66+
$this->QBOptions['constraints'] = [$index];
67+
}
68+
$keys = array_keys(current($values));
6569

6670
$sql = $this->QBOptions['sql'] ?? '';
6771

system/Database/OCI8/Builder.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use CodeIgniter\Database\BaseBuilder;
1515
use CodeIgniter\Database\Exceptions\DatabaseException;
16+
use CodeIgniter\Database\RawSql;
1617

1718
/**
1819
* Builder for OCI8
@@ -234,8 +235,10 @@ protected function resetSelect()
234235
protected function _updateBatch(string $table, array $values, string $index): string
235236
{
236237
// this is a work around until the rest of the platform is refactored
237-
$this->QBOptions['constraints'] = [$index];
238-
$keys = array_keys(current($values));
238+
if ($index !== '') {
239+
$this->QBOptions['constraints'] = [$index];
240+
}
241+
$keys = array_keys(current($values));
239242

240243
$sql = $this->QBOptions['sql'] ?? '';
241244

0 commit comments

Comments
 (0)