Skip to content

Commit 4f34bf9

Browse files
committed
refactor: fix phpstan errors in BaseBuilder
1 parent 69796fc commit 4f34bf9

19 files changed

Lines changed: 180 additions & 633 deletions

system/Database/BaseBuilder.php

Lines changed: 89 additions & 76 deletions
Large diffs are not rendered by default.

system/Database/OCI8/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Builder extends BaseBuilder
3434
/**
3535
* ORDER BY random keyword
3636
*
37-
* @var array
37+
* @var list<string>
3838
*/
3939
protected $randomKeyword = [
4040
'"DBMS_RANDOM"."RANDOM"',

system/Database/Postgre/Builder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Builder extends BaseBuilder
3030
/**
3131
* ORDER BY random keyword
3232
*
33-
* @var array
33+
* @var list<string>
3434
*/
3535
protected $randomKeyword = [
3636
'RANDOM()',
@@ -140,7 +140,7 @@ public function decrement(string $column, int $value = 1)
140140
* we simply do a DELETE and an INSERT on the first key/value
141141
* combo, assuming that it's either the primary key or a unique key.
142142
*
143-
* @param array|null $set An associative array of insert values
143+
* @param array<string, mixed>|null $set An associative array of insert values
144144
*
145145
* @return BaseResult|false|Query|string
146146
*

system/Database/SQLSRV/Builder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Builder extends BaseBuilder
3636
/**
3737
* ORDER BY random keyword
3838
*
39-
* @var array
39+
* @var list<string>
4040
*/
4141
protected $randomKeyword = [
4242
'NEWID()',
@@ -644,7 +644,7 @@ protected function compileSelect($selectOverride = false): string
644644
* Compiles the select statement based on the other functions called
645645
* and runs the query
646646
*
647-
* @return ResultInterface
647+
* @return false|ResultInterface|string
648648
*/
649649
public function get(?int $limit = null, int $offset = 0, bool $reset = true)
650650
{

system/Database/SQLite3/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Builder extends BaseBuilder
4444
/**
4545
* ORDER BY random keyword
4646
*
47-
* @var array
47+
* @var list<string>
4848
*/
4949
protected $randomKeyword = [
5050
'RANDOM()',

system/Test/CIUnitTestCase.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737

3838
/**
3939
* Framework test case for PHPUnit.
40+
*
41+
* @template TDb of BaseConnection = BaseConnection
4042
*/
4143
abstract class CIUnitTestCase extends TestCase
4244
{
@@ -147,7 +149,7 @@ abstract class CIUnitTestCase extends TestCase
147149
/**
148150
* Our database connection.
149151
*
150-
* @var BaseConnection
152+
* @var TDb
151153
*/
152154
protected $db;
153155

tests/system/Database/Builder/InsertTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,12 @@
2323

2424
/**
2525
* @internal
26+
*
27+
* @extends CIUnitTestCase<MockConnection>
2628
*/
2729
#[Group('Others')]
2830
final class InsertTest extends CIUnitTestCase
2931
{
30-
/**
31-
* @var MockConnection
32-
*/
33-
protected $db;
34-
3532
protected function setUp(): void
3633
{
3734
parent::setUp();

tests/system/Database/Builder/UnionTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525
#[Group('Others')]
2626
final class UnionTest extends CIUnitTestCase
2727
{
28-
/**
29-
* @var MockConnection
30-
*/
31-
protected $db;
32-
3328
protected function setUp(): void
3429
{
3530
parent::setUp();

tests/system/Database/Builder/UpdateTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,12 @@
2222

2323
/**
2424
* @internal
25+
*
26+
* @extends CIUnitTestCase<MockConnection>
2527
*/
2628
#[Group('Others')]
2729
final class UpdateTest extends CIUnitTestCase
2830
{
29-
/**
30-
* @var MockConnection
31-
*/
32-
protected $db;
33-
3431
protected function setUp(): void
3532
{
3633
parent::setUp();

tests/system/Database/Builder/WhenTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525
#[Group('Others')]
2626
final class WhenTest extends CIUnitTestCase
2727
{
28-
/**
29-
* @var MockConnection
30-
*/
31-
protected $db;
32-
3328
protected function setUp(): void
3429
{
3530
parent::setUp();

0 commit comments

Comments
 (0)