PHPStan does not read phpstan.neon.dist

Migrated issue

Reported by: joelpittet

Related to !430 (merged)

Problem/Motivation

When using the gitlab_templates PHPStan job in contrib projects, it
appears that only phpstan.neon is read. A common pattern for contrib
projects is to commit phpstan.neon.dist to the repository and let
local developers copy or override it as phpstan.neon.

In pipelines such as
project/resource_conflict/-/jobs/7295981 (and similarly in the Calendar module), the project provides phpstan.neon.dist but no
phpstan.neon. The PHPStan job still runs, but it seems to ignore
the phpstan.neon.dist and falls back to default configuration.

It is not clear whether this is an explicit design decision (only ever read
phpstan.neon) or an oversight. As a contrib maintainer, it would
be helpful either to support phpstan.neon.dist or to have the
expected behaviour documented.

Proposed resolution

  • Confirm the intended behaviour of the PHPStan template with respect to phpstan.neon.dist.
  • If supported, update the template so that:
    • It prefers phpstan.neon when present, but
    • Falls back to phpstan.neon.dist when phpstan.neon is missing.
  • If phpstan.neon.dist is not meant to be supported, document that only phpstan.neon will be loaded so contrib projects can adjust their config layout.

Remaining tasks

  • Decide whether phpstan.neon.dist should be supported by the template.
  • Update the PHPStan GitLab template to implement the chosen behaviour.
  • Add or update documentation to describe how PHPStan configuration files are discovered in pipelines.
  • (Optional) Add a small test or example project that demonstrates the supported pattern for contrib maintainers.
Assignee Loading
Time tracking Loading