chore: install larastan at level 6 with accept-all baseline
Installs larastan/larastan ^3.0 (v3.9.6) as a dev-dependency. Level 6 is the starting target — catches missing typehints, method- existence, null-safety, and model-property existence. Level 8 deferred to a follow-up sprint after level-6 baseline reaches zero. Baseline error count at install: 1556 errors across 678 analysed files (41 distinct identifiers). Top 10 identifiers (errors / files): 613 / 87 property.notFound 289 / 52 missingType.generics 154 / 31 argument.templateType 98 / 61 missingType.iterableValue 77 / 32 argument.type 50 / 26 method.notFound 35 / 35 method.childReturnType 32 / 9 method.unresolvableReturnType 31 / 10 assign.propertyType 28 / 17 instanceof.alwaysTrue Composer scripts: - composer analyse — run static analysis - composer analyse:baseline — regenerate baseline - composer analyse:clear-cache — clear PHPStan result cache Config deviation from plan: checkGenericClassInNonGenericObjectType was removed in PHPStan 2.x (which Larastan 3 bundles) — setting dropped from phpstan.neon, otherwise config matches the work package verbatim. Defaults cover the original intent. Documentation: /dev-docs/LARASTAN.md added; CLAUDE.md quality-gates section introduced (with PHPUnit + Pint + Larastan listed). Backlog: /dev-docs/BACKLOG.md gets 10 per-identifier reduction sprints (TECH-LARASTAN-01..10) seeded from the actual baseline top categories, plus TECH-LARASTAN-CI and TECH-LARASTAN-L8 follow-ups. Memory limit 2G (baseline generation completed within it). No production behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -747,5 +747,144 @@ externe lijsten nog niet compleet zijn.
|
||||
|
||||
---
|
||||
|
||||
## Larastan reduction sprints
|
||||
|
||||
Larastan (PHPStan for Laravel) is geïnstalleerd op level 6 met een
|
||||
accept-all baseline van 1556 errors over 678 files (41 distinct
|
||||
identifiers). Zie `/dev-docs/LARASTAN.md` voor werkmodel. Per-categorie
|
||||
reduction-sprints hieronder — elke sprint mikt op één identifier, laat
|
||||
de baseline krimpen en regenereert hem aan het einde.
|
||||
|
||||
### TECH-LARASTAN-01 — property.notFound
|
||||
|
||||
**Priority:** Middel (post-foundation, incremental)
|
||||
**Scope:** baseline-entries met identifier `property.notFound`.
|
||||
**Estimate:** 613 errors over 87 files.
|
||||
**Completion gate:** category count daalt naar 0 in geregenereerde
|
||||
baseline; volledige test suite groen.
|
||||
|
||||
**Approach:**
|
||||
- Merendeel zit op Eloquent-modellen waar `$user->id` of vergelijkbaar
|
||||
niet door PHPDoc wordt herkend — los op door `@property` annotaties
|
||||
op modellen toe te voegen (of via `php artisan ide-helper:models`
|
||||
als dat acceptabel wordt gevonden).
|
||||
- Commit per sub-directory als >50 errors.
|
||||
|
||||
### TECH-LARASTAN-02 — missingType.generics
|
||||
|
||||
**Priority:** Middel
|
||||
**Scope:** baseline-entries met identifier `missingType.generics`.
|
||||
**Estimate:** 289 errors over 52 files.
|
||||
**Completion gate:** category count naar 0; tests groen.
|
||||
|
||||
**Approach:**
|
||||
- Zit vooral op factories (`extends Factory<Model>`) en
|
||||
`HasFactory`-gebruik zonder template. Voeg type-params toe aan
|
||||
class-declaraties en docblocks.
|
||||
- Overlapt deels met TYPE_DECLARATION-sprint van Rector.
|
||||
|
||||
### TECH-LARASTAN-03 — argument.templateType
|
||||
|
||||
**Priority:** Middel
|
||||
**Scope:** baseline-entries met identifier `argument.templateType`.
|
||||
**Estimate:** 154 errors over 31 files.
|
||||
**Completion gate:** category count naar 0; tests groen.
|
||||
|
||||
**Approach:**
|
||||
- Voornamelijk `collect(...)` calls waar PHPStan de generieke
|
||||
template TKey/TValue niet kan resolven. Typeer de input expliciet
|
||||
of gebruik `Collection::make([...])` met generieke annotatie.
|
||||
|
||||
### TECH-LARASTAN-04 — missingType.iterableValue
|
||||
|
||||
**Priority:** Middel
|
||||
**Scope:** baseline-entries met identifier `missingType.iterableValue`.
|
||||
**Estimate:** 98 errors over 61 files.
|
||||
**Completion gate:** category count naar 0; tests groen.
|
||||
|
||||
**Approach:**
|
||||
- Methode-return-types als `array` zonder value-type. Voeg
|
||||
`array<string, mixed>` of specifieker toe aan form-requests,
|
||||
resource `toArray()` methods, factory `definition()` methods.
|
||||
|
||||
### TECH-LARASTAN-05 — argument.type
|
||||
|
||||
**Priority:** Middel
|
||||
**Scope:** baseline-entries met identifier `argument.type`.
|
||||
**Estimate:** 77 errors over 32 files.
|
||||
**Completion gate:** category count naar 0; tests groen.
|
||||
|
||||
**Approach:**
|
||||
- Reële type-mismatches (bijv. string doorgegeven waar `'strict'|'lax'`
|
||||
vereist is). Case-by-case reviewen — niet mechanisch.
|
||||
|
||||
### TECH-LARASTAN-06 — method.notFound
|
||||
|
||||
**Priority:** Middel
|
||||
**Scope:** baseline-entries met identifier `method.notFound`.
|
||||
**Estimate:** 50 errors over 26 files.
|
||||
**Completion gate:** category count naar 0; tests groen.
|
||||
|
||||
**Approach:**
|
||||
- Meestal "Call to an undefined method Illuminate\\…::users()" —
|
||||
relationship methods die PHPStan niet kent. Los op via
|
||||
`@method` annotaties of generieke relationship-return types.
|
||||
|
||||
### TECH-LARASTAN-07 — method.childReturnType
|
||||
|
||||
**Priority:** Laag
|
||||
**Scope:** baseline-entries met identifier `method.childReturnType`.
|
||||
**Estimate:** 35 errors over 35 files.
|
||||
**Completion gate:** category count naar 0; tests groen.
|
||||
|
||||
**Approach:**
|
||||
- Eén-op-één met factory `definition()` methodes. Smeedt samen met
|
||||
TECH-LARASTAN-02 in één sprint indien praktisch.
|
||||
|
||||
### TECH-LARASTAN-08 — method.unresolvableReturnType
|
||||
|
||||
**Priority:** Laag
|
||||
**Scope:** baseline-entries met identifier
|
||||
`method.unresolvableReturnType`.
|
||||
**Estimate:** 32 errors over 9 files.
|
||||
**Completion gate:** category count naar 0; tests groen.
|
||||
|
||||
### TECH-LARASTAN-09 — assign.propertyType
|
||||
|
||||
**Priority:** Middel (reële type-bug kans hoger dan bij generics)
|
||||
**Scope:** baseline-entries met identifier `assign.propertyType`.
|
||||
**Estimate:** 31 errors over 10 files.
|
||||
**Completion gate:** category count naar 0; tests groen.
|
||||
|
||||
**Approach:**
|
||||
- Meestal Carbon vs string mismatch op Eloquent properties —
|
||||
modelcasts goed zetten zodat Eloquent de datetime teruggeeft waar
|
||||
hij beloofd is.
|
||||
|
||||
### TECH-LARASTAN-10 — instanceof.alwaysTrue
|
||||
|
||||
**Priority:** Laag
|
||||
**Scope:** baseline-entries met identifier `instanceof.alwaysTrue`.
|
||||
**Estimate:** 28 errors over 17 files.
|
||||
**Completion gate:** category count naar 0; tests groen.
|
||||
|
||||
**Approach:**
|
||||
- Dead `instanceof`-checks. Prefab voor Rector's `DEAD_CODE`
|
||||
sprint — wachten of combineren.
|
||||
|
||||
### TECH-LARASTAN-CI — CI integration
|
||||
|
||||
**Priority:** Middel
|
||||
**Scope:** wire `composer analyse` als blokkerende PR-gate in CI.
|
||||
**Depends on:** CI-infrastructuurkeuze.
|
||||
|
||||
### TECH-LARASTAN-L8 — level 8 migration
|
||||
|
||||
**Priority:** Laag
|
||||
**Scope:** niveau 6→8 verhogen nadat level-6 baseline op 0 staat.
|
||||
**Estimate:** onbekend totdat level 6 leeg is.
|
||||
|
||||
---
|
||||
|
||||
_Laatste update: April 2026_
|
||||
_Voeg nieuwe items toe met prefix: ARCH-, COMM-, OPS-, VOL-, ART-, FORM-, SUP-, DIFF-, APPS-, TECH-, UX-_
|
||||
|
||||
Reference in New Issue
Block a user