Skip to content

Commit 02408bf

Browse files
committed
refcator: fix codeigniter.modelArgumentType errors
1 parent fa0913c commit 02408bf

File tree

5 files changed

+6
-22
lines changed

5 files changed

+6
-22
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
},
1919
"require-dev": {
2020
"codeigniter/phpstan-codeigniter": "1.x-dev",
21+
"codeigniter4/shield": "^1.1",
2122
"fakerphp/faker": "^1.24",
2223
"kint-php/kint": "^6.0",
2324
"mikey179/vfsstream": "^1.6.12",

phpstan.neon.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ parameters:
4343
codeigniter:
4444
additionalServices:
4545
- AfterAutoloadModule\Config\Services
46+
additionalModelNamespaces:
47+
- CodeIgniter\Shield\Models
48+
- Tests\Support\Models
4649
checkArgumentTypeOfModel: false
4750
shipmonkBaselinePerIdentifier:
4851
directory: %currentWorkingDirectory%

system/Test/Fabricator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ class Fabricator
119119
*/
120120
public function __construct($model, ?array $formatters = null, ?string $locale = null)
121121
{
122-
if (is_string($model)) {
123-
// Create a new model instance
122+
if (is_string($model) && class_exists($model)) {
124123
$model = model($model, false);
125124
}
126125

utils/phpstan-baseline/codeigniter.modelArgumentType.neon

Lines changed: 0 additions & 18 deletions
This file was deleted.

utils/phpstan-baseline/loader.neon

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# total 3511 errors
1+
# total 3508 errors
22
includes:
33
- argument.type.neon
44
- assign.propertyType.neon
55
- codeigniter.cacheHandlerInstance.neon
66
- codeigniter.getReassignArray.neon
7-
- codeigniter.modelArgumentType.neon
87
- codeigniter.superglobalAccess.neon
98
- codeigniter.superglobalAccessAssign.neon
109
- codeigniter.unknownServiceMethod.neon

0 commit comments

Comments
 (0)