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
3 changes: 3 additions & 0 deletions tests/_support/Models/UserModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

use CodeIgniter\Model;

/**
* @method int affectedRows()
*/
class UserModel extends Model
{
protected $table = 'user';
Expand Down
3 changes: 2 additions & 1 deletion tests/system/Models/FindModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use CodeIgniter\Exceptions\ModelException;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use stdClass;
use Tests\Support\Entity\UserWithCasts;
use Tests\Support\Models\JobModel;
use Tests\Support\Models\SecondaryModel;
Expand Down Expand Up @@ -115,7 +116,7 @@ public function testFindRespectsSoftDeletes(): void
$this->createModel(UserModel::class);

$user = $this->model->find(4);
$this->assertEmpty($user);
$this->assertNotInstanceOf(stdClass::class, $user);

$user = $this->model->withDeleted()->find(4);
$count = is_object($user) ? 1 : 0;
Expand Down
8 changes: 8 additions & 0 deletions tests/system/Models/LiveModelTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ protected function tearDown(): void

/**
* Create an instance of Model for use in testing.
*
* @template T of Model
*
* @param class-string<T> $modelName
*
* @return T
*
* @phpstan-assert T $this->model
*/
protected function createModel(string $modelName, ?BaseConnection $db = null): Model
{
Expand Down
7 changes: 1 addition & 6 deletions utils/phpstan-baseline/argument.type.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 136 errors
# total 135 errors

parameters:
ignoreErrors:
Expand Down Expand Up @@ -247,11 +247,6 @@ parameters:
count: 1
path: ../../tests/system/Models/UpdateModelTest.php

-
message: '#^Parameter \#1 \$row of method CodeIgniter\\BaseModel\:\:save\(\) expects array\<int\|string, bool\|float\|int\|object\|string\|null\>\|object, list\<array\>\|null given\.$#'
count: 1
path: ../../tests/system/Models/UpdateModelTest.php

-
message: '#^Parameter \#1 \$format of method CodeIgniter\\RESTful\\ResourceController\:\:setFormat\(\) expects ''json''\|''xml'', ''Nonsense'' given\.$#'
count: 1
Expand Down
3 changes: 1 addition & 2 deletions utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 3256 errors
# total 3234 errors
includes:
- argument.type.neon
- assign.propertyType.neon
Expand All @@ -25,4 +25,3 @@ includes:
- property.phpDocType.neon
- staticMethod.notFound.neon
- ternary.shortNotAllowed.neon
- varTag.type.neon
7 changes: 1 addition & 6 deletions utils/phpstan-baseline/method.notFound.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 82 errors
# total 81 errors

parameters:
ignoreErrors:
Expand Down Expand Up @@ -152,11 +152,6 @@ parameters:
count: 3
path: ../../tests/system/Images/GDHandlerTest.php

-
message: '#^Call to an undefined method CodeIgniter\\Model\:\:affectedRows\(\)\.$#'
count: 1
path: ../../tests/system/Models/AffectedRowsTest.php

-
message: '#^Call to an undefined method CodeIgniter\\Model\:\:getLastQuery\(\)\.$#'
count: 1
Expand Down
31 changes: 3 additions & 28 deletions utils/phpstan-baseline/property.nonObject.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 54 errors
# total 36 errors

parameters:
ignoreErrors:
Expand Down Expand Up @@ -29,24 +29,9 @@ parameters:

-
message: '#^Cannot access property \$id on array\.$#'
count: 8
path: ../../tests/system/Models/FindModelTest.php

-
message: '#^Cannot access property \$name on array\.$#'
count: 5
path: ../../tests/system/Models/FindModelTest.php

-
message: '#^Cannot access property \$total on array\.$#'
count: 1
count: 2
path: ../../tests/system/Models/FindModelTest.php

-
message: '#^Cannot access property \$country on array\.$#'
count: 1
path: ../../tests/system/Models/InsertModelTest.php

-
message: '#^Cannot access property \$created_at on array\.$#'
count: 3
Expand All @@ -59,16 +44,6 @@ parameters:

-
message: '#^Cannot access property \$description on array\.$#'
count: 3
path: ../../tests/system/Models/SaveModelTest.php

-
message: '#^Cannot access property \$id on array\.$#'
count: 1
path: ../../tests/system/Models/SaveModelTest.php

-
message: '#^Cannot access property \$name on array\.$#'
count: 1
path: ../../tests/system/Models/SaveModelTest.php

Expand All @@ -94,7 +69,7 @@ parameters:

-
message: '#^Cannot access property \$value on list\<array\>\.$#'
count: 2
count: 1
path: ../../tests/system/Models/UpdateModelTest.php

-
Expand Down
13 changes: 0 additions & 13 deletions utils/phpstan-baseline/varTag.type.neon

This file was deleted.

Loading