<p>When you run it on your code, the errors you see will depend on what level you set.</p>
<p><a href="/daily/2023/11/27/finding-the-best-test-base">In yesterday's email</a>, the first example code block didn't generate an error until level 5 was used.</p>
<p>For new (greenfield) code, install and configure PHPStan before you write any code and have and have it run automatically as part of a CI pipeline.</p>
<p>If you work on a team, speak with the other members and decide how strict you want PHPStan to be.</p>
<p>Read the rule levels and decide which are the most valuable for your team.</p>
<p>If you haven't used PHPStan or static analysis before, maybe start with a lower level.</p>
<p>For me, typehints and return type checking are a must, though I like to use as high a level as possible.</p>
<p>The more information you can provide to PHPStan, the more it will understand your code, give better results and be more likely to find potential bugs or issues.</p>
<p><a href="/daily/2023/11/27/finding-the-best-test-base">In yesterday's email</a>, the first example code block didn't generate an error until level 5 was used.</p>
<p>For new (greenfield) code, install and configure PHPStan before you write any code and have and have it run automatically as part of a CI pipeline.</p>
<p>If you work on a team, speak with the other members and decide how strict you want PHPStan to be.</p>
<p>Read the rule levels and decide which are the most valuable for your team.</p>
<p>If you haven't used PHPStan or static analysis before, maybe start with a lower level.</p>
<p>For me, typehints and return type checking are a must, though I like to use as high a level as possible.</p>
<p>The more information you can provide to PHPStan, the more it will understand your code, give better results and be more likely to find potential bugs or issues.</p>