0

I have installed PHPStan in a project developed around 1.5 years ago. The files of project have both old and fresh code. I want PHPStan to analyze only the fresh code written from today onwards and ignore the old code written in any file. How this will be possible to achieve with PHPStan?

I have tried creating a separate directory for the new code, and ask PHPStan to analyze the new directory, but, it causing a lot of code anomalies in the project. So, I am writing the new code in the old files.

1 Answers1

2

Make sure to always analyse the whole project: https://phpstan.org/blog/why-you-should-always-analyse-whole-project

And ignore existing errors from “old code” with a feature specifically designed for this: the baseline. https://phpstan.org/user-guide/baseline

Ondřej Mirtes
  • 5,054
  • 25
  • 36