Skip to content

PHPStan

The PHPStan job runs static code quality checks.

If the project contains a phpstan.neon configuration file it will be used. If not, a default configuration is used.

The pipeline variable _PHPSTAN_LEVEL can be set to a value from 0-9 to specify how relaxed or severe the code quality checks should be. This can be used to temporarily override the value in your phpstan.neon file. If no value is given, either in the variable or the fle, then the default of 0 is used. See https://phpstan.org/user-guide/rule-levels for more information.

Projects can specify baseline file(s) of messages to ignore, using the includes: keyword in the phpstan.neon file:

includes:
  - your-baseline-file.neon
  - second-baseline-file.neon

Any warnings that are found are written to a new baseline file which is available as a job artifact for download. These can be added into the existing baseline file until the code is fixed. Unmatched messages in the baseline file are also reported in the log.

In addition to testing at the current core version, the PHPStan job has optional variants for the next major and minor core versions and the maximum PHP version.

Consider the PHP version when interpreting the results of the PHPStan job, as the analysis may give different results between major versions of PHP.

If you do not want this job to be run, set the variable SKIP_PHPSTAN: 1