You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: document PHPStan 2.x and Larastan 3.x upgrade changes (#503)
Adds a detailed PHPStan/Larastan section to the 2.x upgrade guide covering
the version bumps, recommended level 6 increase, removed config parameters,
and Larastan 3.x breaking changes (explicit relation generics, annotation
renames). Updates the static-code-analysis setup guide to reflect level 6
and remove the now-invalid checkMissingIterableValueType parameter.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/extend/update-2_0.md
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -371,6 +371,65 @@ Checkout this example from the mentions extension:
371
371
372
372
## Infrastructure
373
373
374
+
### PHPStan (updated from ^1.10 to ^2.1) and Larastan (updated from 2.9 to ^3.8)
375
+
376
+
Flarum 2.0 upgrades its static analysis tooling to PHPStan 2.xand Larastan 3.x. Extensions using `flarum/phpstan` will need to update their configuration and may need to fix newly reported errors.
377
+
378
+
#### flarum/phpstan dependency
379
+
380
+
Update your `composer.json` to require the latest `flarum/phpstan`:
381
+
382
+
```bash
383
+
composer require --dev flarum/phpstan:^2.0
384
+
```
385
+
386
+
#### Recommended level increase
387
+
388
+
Flarum core now runs PHPStan at **level 6**. We recommend all extensions do the same. Update your `phpstan.neon`:
389
+
390
+
```neon
391
+
parameters:
392
+
level: 6
393
+
```
394
+
395
+
Level 6 checks for missing return types on all methods and properties. You may encounter new errors on your first run after increasing the level — work through them incrementally.
396
+
397
+
#### Removed config parameters
398
+
399
+
PHPStan 2.x removed several parameters that were commonly used in Flarum extension configs. Remove these from your `phpstan.neon` if present — they will cause an error if left in:
400
+
401
+
*`checkMissingIterableValueType` — replaced by the `missingType.iterableValue` error identifier. If you need to suppress these errors, use `ignoreErrors` with the identifier instead.
402
+
*`checkGenericClassInNonGenericObjectType` — replaced by `missingType.generics`.
403
+
*`checkAlwaysTrueCheckTypeFunctionCall`, `checkAlwaysTrueInstanceof`, `checkAlwaysTrueStrictComparison`, `checkAlwaysTrueLooseComparison` — these checks are now always enabled and can no longer be disabled.
0 commit comments