Level 3.B ~30 min Target: PHPStan max
Boss: take it to max
This returns service passes PHPStan at max. On paper it's finished. Then you read phpstan.neon:
- a baseline of eight entries, one of which no longer matches anything
reportUnmatchedIgnoredErrors: false, added the day a fix turned the build red, so nobody has heard about a fixed error since- no strict rules
Meanwhile, an unknown order number crashes the returns page, "7" is accepted as an order ID until it reaches a typed return, and SKU 0100 is refused as a final sale item because SKU 100 is one.
A green build is only as honest as its configuration. Your job is to make this one honest.
Your checklist
| Level | Ask of the project |
|---|---|
| 3.1 Living with a baseline | Does every baseline entry hide a real error? Is PHPStan allowed to say when one doesn't? Can you get it to zero? |
3.2 mixed, the final enemy |
Is the request checked once, where the JSON arrives, so nothing after it sees mixed? |
| 3.3 Extensions | Is anything in phpstan.neon hiding errors instead of explaining them? |
| 3.4 Strict rules | With strict rules on, is every comparison strict and every condition a boolean? |
| 3.5 Custom rules | Is there a convention here worth a rule? Not for this exercise, but worth asking of your own project. |
Start by removing reportUnmatchedIgnoredErrors and running Analyse to find the stale entry. When the baseline is empty, leave the file with ignoreErrors: [] and add strict rules to includes. The tests check the behaviour and the configuration.