"value":"\n <p>Which PHPStan level should you use?<\/p>\n\n<p>PHPStan has different levels.<\/p>\n\n<p>When you run it on your code, the errors you see will depend on what level you set.<\/p>\n\n<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>\n\n<p>So, how do you know which level to use?<\/p>\n\n<h2 id=\"for-greenfield-projects\">For greenfield projects<\/h2>\n\n<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>\n\n<p>If you work on a team, speak with the other members and decide how strict you want PHPStan to be.<\/p>\n\n<p>Read the rule levels and decide which are the most valuable for your team.<\/p>\n\n<p>If you haven't used PHPStan or static analysis before, maybe start with a lower level.<\/p>\n\n<p>For me, typehints and return type checking are a must, though I like to use as high a level as possible.<\/p>\n\n<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>\n\n<h2 id=\"for-brownfield-projects\">For brownfield projects<\/h2>\n\n<p>For existing (brownfield) code, start at the lowest level, which will give you the least number of errors.<\/p>\n\n<p>Fix any errors, exclude any rules you want to ignore or generate a baseline containing any existing errors.<\/p>\n\n<p>If you like, increase the level and repeat the process.<\/p>\n\n<p>Keep increasing the level as long as you feel comfortable, and PHPStan gives you meaningful results.<\/p>\n\n<p>Again, if you haven't used PHPStan or static analysis before, maybe stick with a lower level.<\/p>\n\n<p>If you start with a lower level, you can increase it later.<\/p>\n\n ",
"processed":"\n <p>Which PHPStan level should you use?<\/p>\n\n<p>PHPStan has different levels.<\/p>\n\n<p>When you run it on your code, the errors you see will depend on what level you set.<\/p>\n\n<p><a href=\"http:\/\/default\/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>\n\n<p>So, how do you know which level to use?<\/p>\n\n<h2 id=\"for-greenfield-projects\">For greenfield projects<\/h2>\n\n<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>\n\n<p>If you work on a team, speak with the other members and decide how strict you want PHPStan to be.<\/p>\n\n<p>Read the rule levels and decide which are the most valuable for your team.<\/p>\n\n<p>If you haven't used PHPStan or static analysis before, maybe start with a lower level.<\/p>\n\n<p>For me, typehints and return type checking are a must, though I like to use as high a level as possible.<\/p>\n\n<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>\n\n<h2 id=\"for-brownfield-projects\">For brownfield projects<\/h2>\n\n<p>For existing (brownfield) code, start at the lowest level, which will give you the least number of errors.<\/p>\n\n<p>Fix any errors, exclude any rules you want to ignore or generate a baseline containing any existing errors.<\/p>\n\n<p>If you like, increase the level and repeat the process.<\/p>\n\n<p>Keep increasing the level as long as you feel comfortable, and PHPStan gives you meaningful results.<\/p>\n\n<p>Again, if you haven't used PHPStan or static analysis before, maybe stick with a lower level.<\/p>\n\n<p>If you start with a lower level, you can increase it later.<\/p>\n\n ",