Skip to content

Static analysis rules

Neither analyser package has an @api class, and that is correct rather than a missing annotation: understudy-phpstan is registered through extension.neon and understudy-psalm through psalm-plugin enable, so a user never names one of their classes. What a user does write is an identifier, in ignoreErrors or a suppression. That is the contract, so that is what is reflected here.

PHPStan · rasuvaeff/understudy-phpstan v0.2.0

IdentifierReported bySummary
understudy.cardinalitySpecificationCheckSays what the engine would say, before the test runs.
understudy.closureSpecificationCheckSays what the engine would say, before the test runs.
understudy.matcherSpecificationCheckSays what the engine would say, before the test runs.
understudy.matcherLeakMatcherLeakRuleA matcher written outside a specification.
understudy.returnsVoidReturnsRulereturns() on a method that returns nothing.

Silence one by its identifier:

neon
parameters:
    ignoreErrors:
        - identifier: understudy.cardinality

Registered rules (from extension.neon, in file order):

  • Rasuvaeff\Understudy\PhpStan\Rule\SpecificationCallRule
  • Rasuvaeff\Understudy\PhpStan\Rule\SpecificationStaticCallRule
  • Rasuvaeff\Understudy\PhpStan\Rule\FluentCardinalityRule
  • Rasuvaeff\Understudy\PhpStan\Rule\VoidReturnsRule
  • Rasuvaeff\Understudy\PhpStan\Rule\MatcherLeakRule

Psalm · rasuvaeff/understudy-psalm v0.2.0

Issue typeSummary
UnderstudyMisuseA specification that cannot mean what it says.

The plugin reports its own findings under that one issue type; everything else it surfaces is Psalm's own diagnostic, made possible by the types the plugin fills in.

For what each of these means in practice, see Static analysis, the Psalm plugin and the PHPStan extension.