Skip to content

Commit 8c6da93

Browse files
authored
refactor: fix codeigniter.modelArgumentType errors (#9533)
1 parent caf9f34 commit 8c6da93

File tree

4 files changed

+5
-14
lines changed

4 files changed

+5
-14
lines changed

phpstan.neon.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ parameters:
4343
codeigniter:
4444
additionalServices:
4545
- AfterAutoloadModule\Config\Services
46+
additionalModelNamespaces:
47+
- Tests\Support\Models
4648
checkArgumentTypeOfModel: false
4749
shipmonkBaselinePerIdentifier:
4850
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: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
1-
# total 3 errors
1+
# total 1 error
22

33
parameters:
44
ignoreErrors:
5-
-
6-
message: '#^Parameter \#1 \$name of function model expects a valid class string, string given\.$#'
7-
count: 1
8-
path: ../../system/Test/Fabricator.php
9-
10-
-
11-
message: '#^Parameter \#1 \$name of function model expects a valid class string, ''JobModel'' given\.$#'
12-
count: 1
13-
path: ../../tests/system/CommonFunctionsTest.php
14-
155
-
166
message: '#^Parameter \#1 \$name of function model expects a valid class string, ''CodeIgniter\\\\Shield\\\\Models\\\\UserModel'' given\.$#'
177
count: 1

utils/phpstan-baseline/loader.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# total 3373 errors
1+
# total 3371 errors
22
includes:
33
- argument.type.neon
44
- assign.propertyType.neon

0 commit comments

Comments
 (0)