Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 89 additions & 76 deletions system/Database/BaseBuilder.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion system/Database/OCI8/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Builder extends BaseBuilder
/**
* ORDER BY random keyword
*
* @var array
* @var list<string>
*/
protected $randomKeyword = [
'"DBMS_RANDOM"."RANDOM"',
Expand Down
4 changes: 2 additions & 2 deletions system/Database/Postgre/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Builder extends BaseBuilder
/**
* ORDER BY random keyword
*
* @var array
* @var list<string>
*/
protected $randomKeyword = [
'RANDOM()',
Expand Down Expand Up @@ -140,7 +140,7 @@ public function decrement(string $column, int $value = 1)
* we simply do a DELETE and an INSERT on the first key/value
* combo, assuming that it's either the primary key or a unique key.
*
* @param array|null $set An associative array of insert values
* @param array<string, mixed>|null $set An associative array of insert values
*
* @return BaseResult|false|Query|string
*
Expand Down
4 changes: 2 additions & 2 deletions system/Database/SQLSRV/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Builder extends BaseBuilder
/**
* ORDER BY random keyword
*
* @var array
* @var list<string>
*/
protected $randomKeyword = [
'NEWID()',
Expand Down Expand Up @@ -644,7 +644,7 @@ protected function compileSelect($selectOverride = false): string
* Compiles the select statement based on the other functions called
* and runs the query
*
* @return ResultInterface
* @return false|ResultInterface|string
*/
public function get(?int $limit = null, int $offset = 0, bool $reset = true)
{
Expand Down
2 changes: 1 addition & 1 deletion system/Database/SQLite3/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Builder extends BaseBuilder
/**
* ORDER BY random keyword
*
* @var array
* @var list<string>
*/
protected $randomKeyword = [
'RANDOM()',
Expand Down
5 changes: 0 additions & 5 deletions tests/system/Database/Builder/UnionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
#[Group('Others')]
final class UnionTest extends CIUnitTestCase
{
/**
* @var MockConnection
*/
protected $db;

protected function setUp(): void
{
parent::setUp();
Expand Down
5 changes: 0 additions & 5 deletions tests/system/Database/Builder/WhenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
#[Group('Others')]
final class WhenTest extends CIUnitTestCase
{
/**
* @var MockConnection
*/
protected $db;

protected function setUp(): void
{
parent::setUp();
Expand Down
11 changes: 6 additions & 5 deletions tests/system/Database/Builder/WhereTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@
#[Group('Others')]
final class WhereTest extends CIUnitTestCase
{
/**
* @var MockConnection
*/
protected $db;

protected function setUp(): void
{
parent::setUp();
Expand Down Expand Up @@ -407,6 +402,9 @@ public function testWhereInvalidKeyThrowInvalidArgumentException($key): void
$builder->whereIn($key, ['Politician', 'Accountant']);
}

/**
* @return iterable<string, array{string|null}>
*/
public static function provideWhereInvalidKeyThrowInvalidArgumentException(): iterable
{
return [
Expand All @@ -427,6 +425,9 @@ public function testWhereInEmptyValuesThrowInvalidArgumentException($values): vo
$builder->whereIn('name', $values);
}

/**
* @return iterable<string, array{mixed}>
*/
public static function provideWhereInEmptyValuesThrowInvalidArgumentException(): iterable
{
return [
Expand Down
6 changes: 0 additions & 6 deletions tests/system/Database/Live/SQLite3/GetIndexDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace CodeIgniter\Database\Live\SQLite3;

use CodeIgniter\Database\SQLite3\Connection;
use CodeIgniter\Database\SQLite3\Forge;
use CodeIgniter\Test\CIUnitTestCase;
use Config\Database;
Expand All @@ -26,11 +25,6 @@
#[Group('DatabaseLive')]
final class GetIndexDataTest extends CIUnitTestCase
{
/**
* @var Connection
*/
protected $db;

private Forge $forge;

protected function setUp(): void
Expand Down
57 changes: 11 additions & 46 deletions utils/phpstan-baseline/argument.type.neon
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
# total 54 errors
# total 33 errors

parameters:
ignoreErrors:
-
message: '#^Parameter \#3 \.\.\.\$arrays of function array_map expects array, int\|string given\.$#'
count: 1
path: ../../system/Database/BaseBuilder.php

-
message: '#^Parameter \#3 \.\.\.\$arrays of function array_map expects array, int\|string given\.$#'
count: 1
path: ../../system/Database/OCI8/Builder.php

-
message: '#^Parameter \#3 \.\.\.\$arrays of function array_map expects array, int\|string given\.$#'
count: 1
path: ../../system/Database/Postgre/Builder.php

-
message: '#^Parameter \#3 \.\.\.\$arrays of function array_map expects array, int\|string given\.$#'
count: 1
path: ../../system/Database/SQLite3/Builder.php

-
message: '#^Parameter \#2 \$to of method CodeIgniter\\Router\\RouteCollection\:\:add\(\) expects array\<mixed\>\|\(Closure\(mixed \.\.\.\)\: \(CodeIgniter\\HTTP\\ResponseInterface\|string\|void\)\)\|string, Closure\(mixed\)\: CodeIgniter\\HTTP\\ResponseInterface given\.$#'
count: 1
Expand Down Expand Up @@ -52,21 +32,6 @@ parameters:
count: 2
path: ../../tests/system/Config/FactoriesTest.php

-
message: '#^Parameter \#1 \$from of method CodeIgniter\\Database\\BaseBuilder\<CodeIgniter\\Database\\BaseConnection\>\:\:from\(\) expects array\|string, null given\.$#'
count: 1
path: ../../tests/system/Database/Builder/FromTest.php

-
message: '#^Parameter \#3 \$subject of function str_replace expects array\<string\>\|string, CodeIgniter\\Database\\ResultInterface given\.$#'
count: 10
path: ../../tests/system/Database/Builder/GetTest.php

-
message: '#^Parameter \#3 \$subject of function str_replace expects array\<string\>\|string, CodeIgniter\\Database\\ResultInterface\|false given\.$#'
count: 6
path: ../../tests/system/Database/Builder/GetTest.php

-
message: '#^Parameter \#1 \$fields of method CodeIgniter\\Database\\Forge\<CodeIgniter\\Database\\BaseConnection\>\:\:addField\(\) expects array\<string, array\|string\>\|string, array\<int, string\> given\.$#'
count: 2
Expand Down Expand Up @@ -127,6 +92,16 @@ parameters:
count: 1
path: ../../tests/system/Test/FeatureTestTraitTest.php

-
message: '#^Parameter \#1 \$body of method CodeIgniter\\HTTP\\Response\:\:setJSON\(\) expects array\<mixed\>\|object\|string, false given\.$#'
count: 1
path: ../../tests/system/Test/TestResponseTest.php

-
message: '#^Parameter \#1 \$body of method CodeIgniter\\HTTP\\Response\:\:setJSON\(\) expects array\<mixed\>\|object\|string, true given\.$#'
count: 1
path: ../../tests/system/Test/TestResponseTest.php

-
message: '#^Parameter \#2 \$context of method CodeIgniter\\View\\Parser\:\:setData\(\) expects ''attr''\|''css''\|''html''\|''js''\|''raw''\|''url''\|null, ''unknown'' given\.$#'
count: 3
Expand All @@ -151,13 +126,3 @@ parameters:
message: '#^Parameter \#2 \$resultID of class CodeIgniter\\View\\DBResultDummy constructor expects mysqli_result, null given\.$#'
count: 2
path: ../../tests/system/View/TableTest.php

-
message: '#^Parameter \#1 \$body of method CodeIgniter\\HTTP\\Response\:\:setJSON\(\) expects array\<mixed\>\|object\|string, false given\.$#'
count: 1
path: ../../tests/system/Test/TestResponseTest.php

-
message: '#^Parameter \#1 \$body of method CodeIgniter\\HTTP\\Response\:\:setJSON\(\) expects array\<mixed\>\|object\|string, true given\.$#'
count: 1
path: ../../tests/system/Test/TestResponseTest.php
7 changes: 1 addition & 6 deletions utils/phpstan-baseline/assign.propertyType.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 26 errors
# total 24 errors

parameters:
ignoreErrors:
Expand All @@ -22,11 +22,6 @@ parameters:
count: 1
path: ../../tests/system/Database/Live/SQLite3/AlterTableTest.php

-
message: '#^Property CodeIgniter\\Database\\Live\\SQLite3\\GetIndexDataTest\:\:\$db \(CodeIgniter\\Database\\SQLite3\\Connection\) does not accept CodeIgniter\\Database\\BaseConnection\.$#'
count: 2
path: ../../tests/system/Database/Live/SQLite3/GetIndexDataTest.php

-
message: '#^Property CodeIgniter\\Database\\Live\\SQLite3\\GetIndexDataTest\:\:\$forge \(CodeIgniter\\Database\\SQLite3\\Forge\) does not accept CodeIgniter\\Database\\Forge\.$#'
count: 1
Expand Down
2 changes: 1 addition & 1 deletion utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 895 errors
# total 789 errors

includes:
- argument.type.neon
Expand Down
8 changes: 4 additions & 4 deletions utils/phpstan-baseline/method.childReturnType.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
parameters:
ignoreErrors:
-
message: '#^Return type \(CodeIgniter\\HTTP\\URI\|null\) of method CodeIgniter\\HTTP\\OutgoingRequest\:\:getUri\(\) should be covariant with return type \(CodeIgniter\\HTTP\\URI\) of method CodeIgniter\\HTTP\\OutgoingRequestInterface\:\:getUri\(\)$#'
message: '#^Return type \(bool\) of method CodeIgniter\\HTTP\\Files\\UploadedFile\:\:move\(\) should be compatible with return type \(CodeIgniter\\Files\\File\) of method CodeIgniter\\Files\\File\:\:move\(\)$#'
count: 1
path: ../../system/HTTP/OutgoingRequest.php
path: ../../system/HTTP/Files/UploadedFile.php

-
message: '#^Return type \(bool\) of method CodeIgniter\\HTTP\\Files\\UploadedFile\:\:move\(\) should be compatible with return type \(CodeIgniter\\Files\\File\) of method CodeIgniter\\Files\\File\:\:move\(\)$#'
message: '#^Return type \(CodeIgniter\\HTTP\\URI\|null\) of method CodeIgniter\\HTTP\\OutgoingRequest\:\:getUri\(\) should be covariant with return type \(CodeIgniter\\HTTP\\URI\) of method CodeIgniter\\HTTP\\OutgoingRequestInterface\:\:getUri\(\)$#'
count: 1
path: ../../system/HTTP/Files/UploadedFile.php
path: ../../system/HTTP/OutgoingRequest.php
10 changes: 5 additions & 5 deletions utils/phpstan-baseline/method.notFound.neon
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ parameters:
count: 1
path: ../../tests/system/RESTful/ResourceControllerTest.php

-
message: '#^Call to an undefined method CodeIgniter\\Test\\TestResponse\:\:ohno\(\)\.$#'
count: 1
path: ../../tests/system/Test/ControllerTestTraitTest.php

-
message: '#^Call to an undefined method CodeIgniter\\View\\Table\:\:compileTemplate\(\)\.$#'
count: 2
Expand All @@ -96,8 +101,3 @@ parameters:
message: '#^Call to an undefined method CodeIgniter\\View\\Table\:\:setFromDBResult\(\)\.$#'
count: 1
path: ../../tests/system/View/TableTest.php

-
message: '#^Call to an undefined method CodeIgniter\\Test\\TestResponse\:\:ohno\(\)\.$#'
count: 1
path: ../../tests/system/Test/ControllerTestTraitTest.php
Loading
Loading