phpstan

  • ignoreErrors with a message regex ages badly

    Ignoring an error by matching its message couples the configuration to wording that changes between releases. reportUnmatchedIgnoredErrors is on by default and worth keeping on, because it turns…

  • Generics in a docblock are checked by nothing at runtime

    PHP has no generics, so @return list<Order> is a promise to the analyser and a comment to the engine. The annotations are genuinely useful and are genuinely unenforced:…

  • Psalm and PHPStan disagree, and both are right

    The two analysers have different defaults and different opinions about the same code, and running both is rarely worth it. Psalm’s taint analysis is the one genuinely differentiating…

  • A PHPStan baseline that can only shrink

  • Union types, promotion, and match

    8.0 shipped in November with three changes that alter how a class is written, and a fourth that quietly breaks string-to-number comparison.

  • Static analysis on changed files in a hook

    A full analysis on a large codebase takes long enough that nobody runs it before committing, so every finding arrives from CI after the context has been lost.…

  • A PHPStan extension for a magic method

    Frameworks built on __call and facades produce hundreds of findings that are all the same false positive, and putting them in the baseline hides real errors of the…

  • The PHPStan baseline is a debt register

    A generated file recording every existing error is the thing that makes static analysis adoptable on a codebase that has never had any. Reading it once by directory…

  • Failing on a growing baseline is the whole ratchet

    A baseline that can grow is a suppression file, and one that can only shrink is a debt that gets paid — the difference is one CI step.…

  • Typed properties and the constructor that got shorter

    7.4 landed on 28 November and the docblock is no longer the only type. Uninitialised is a new state, and arrow functions remove the use() clause.