Skip to content

A free open source IT asset/license management system

phpstan errors

snipe721b751442f6
diff --git a/app/Listeners/RegenerateIdeHelperAfterMigrate.php b/app/Listeners/RegenerateIdeHelperAfterMigrate.php
index 070c73f354..6158380e78 100644
--- a/app/Listeners/RegenerateIdeHelperAfterMigrate.php
+++ b/app/Listeners/RegenerateIdeHelperAfterMigrate.php
@@ -21,6 +21,17 @@ class RegenerateIdeHelperAfterMigrate
return;
}
+ // Skip during the test suite. CI runs `migrate --force` as
+ // part of test setup, and regenerating the stub here is both
+ // unnecessary (tests use the committed snapshot) and
+ // problematic. The dev-tooling pass has been observed to
+ // break PHP 8.2 autoload on CI in ways that didn't reproduce
+ // locally. The migrate listener is a developer-ergonomics
+ // feature for local work.
+ if (app()->environment('testing')) {
+ return;
+ }
+
try {
Artisan::call('ide-helper:models', [
'--write-mixin' => true,
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
index 31b60bf45c..3feece7715 100644
--- a/phpstan.neon.dist
+++ b/phpstan.neon.dist
@@ -59,3 +59,17 @@ parameters:
message: '#Call to an undefined method Illuminate\\Database\\Eloquent\\Builder#'
paths:
- app/Models/*.php
+ # ide-helper generates one empty IdeHelperXxx stub class per
+ # model with a long list of `@method static Builder<static>|Xxx
+ # whereYyy()` docblock tags. The stub classes don't extend
+ # Model, so PHPStan complains that the generic `static` in
+ # Builder<static> isn't a subtype of the Builder's TModel
+ # template bound (which requires Model). The method tags are
+ # there for IDE autocomplete via @mixin, not for PHPStan's own
+ # type system — the real resolution happens on the actual
+ # model class that carries the @mixin phpdoc. Suppressing the
+ # category for the stub file keeps the useful column /
+ # scope-method knowledge without the variance noise.
+ -
+ identifier: generics.notSubtype
+ path: _ide_helper_models.php