diff --git a/phpstan.neon.dist b/phpstan.neon.dist index a353de443e81..e6cc288cc678 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -43,6 +43,8 @@ parameters: codeigniter: additionalServices: - AfterAutoloadModule\Config\Services + additionalModelNamespaces: + - Tests\Support\Models checkArgumentTypeOfModel: false shipmonkBaselinePerIdentifier: directory: %currentWorkingDirectory% diff --git a/system/Test/Fabricator.php b/system/Test/Fabricator.php index e092dee69ba7..1a7c5c8f392f 100644 --- a/system/Test/Fabricator.php +++ b/system/Test/Fabricator.php @@ -119,8 +119,7 @@ class Fabricator */ public function __construct($model, ?array $formatters = null, ?string $locale = null) { - if (is_string($model)) { - // Create a new model instance + if (is_string($model) && class_exists($model)) { $model = model($model, false); } diff --git a/utils/phpstan-baseline/codeigniter.modelArgumentType.neon b/utils/phpstan-baseline/codeigniter.modelArgumentType.neon index c0b878bf3861..0bf0d63faeb2 100644 --- a/utils/phpstan-baseline/codeigniter.modelArgumentType.neon +++ b/utils/phpstan-baseline/codeigniter.modelArgumentType.neon @@ -1,17 +1,7 @@ -# total 3 errors +# total 1 error parameters: ignoreErrors: - - - message: '#^Parameter \#1 \$name of function model expects a valid class string, string given\.$#' - count: 1 - path: ../../system/Test/Fabricator.php - - - - message: '#^Parameter \#1 \$name of function model expects a valid class string, ''JobModel'' given\.$#' - count: 1 - path: ../../tests/system/CommonFunctionsTest.php - - message: '#^Parameter \#1 \$name of function model expects a valid class string, ''CodeIgniter\\\\Shield\\\\Models\\\\UserModel'' given\.$#' count: 1 diff --git a/utils/phpstan-baseline/loader.neon b/utils/phpstan-baseline/loader.neon index 49e4a76cbc9c..298407775ba9 100644 --- a/utils/phpstan-baseline/loader.neon +++ b/utils/phpstan-baseline/loader.neon @@ -1,4 +1,4 @@ -# total 3373 errors +# total 3371 errors includes: - argument.type.neon - assign.propertyType.neon