PHPStan Rule Test Helper

Makes tests for custom PHPStan rules easier to write and maintain, by removing line numbers and duplicated error messages from them.

DaveLiddament/phpstan-rule-test-helper View on GitHub


The PHPStan Rule Test Helper builds on PHPStan's own test harness for custom rules. Expected errors are marked with // ERROR comments in the fixture files themselves, so there are no line numbers to update when a fixture changes. The expected error message can also be defined once in the test case, rather than repeated for every violation.

Related articles