By mondrake on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
11.0.x
Introduced in version:
11.0.0
Issue links:
Description:
Drupal custom PHPStan rules are now available at core/tests/PHPStan.
Subdirectories
- Rules: contains the actual rules.
- tests: contains PHPUnit tests for the rules. Note that these tests are run separately from Drupal core tests, since they rely on PHPStan testing framework that differs in terms of dependencies from Drupal's one.
- fixtures: contains fixture files for the PHPUnit tests of the rules.
Enabling rules
Rules are executed when they are added to the the phpstan.neon(.dist) configuration file of a PHPStan scan run. You need to add them under the `rules` entry in the file, specifying the fully qualified class name of the rule. For example:
rules:
- Drupal\PHPStan\Rules\ComponentTestDoesNotExtendCoreTest
Impacts:
Module developers