"value":"\n <p>Continuing yesterday's thought on <a href=\"https:\/\/www.oliverdavies.uk\/daily\/2024\/05\/04\/strict-typing-in-php\">strictness in PHP<\/a>, today I want to talk about adding more strictness to PHPStan.<\/p>\n\n<p>Adding the <a href=\"https:\/\/github.com\/phpstan\/phpstan-strict-rules\">PHPStan Strict Rules extension<\/a> makes PHPStan stricter by adding new, more opinionated rules.<\/p>\n\n<p>For example:<\/p>\n\n<ul>\n<li>Require booleans in if, elseif, ternary operator, after !, and on both sides of && and ||.<\/li>\n<li>Use the <code>$strict<\/code> parameter with <code>in_array<\/code>, <code>array_search<\/code>, <code>array_keys<\/code> and <code>base64_decode<\/code>.<\/li>\n<li>Disallow empty().<\/li>\n<li>Require calling parent constructor.<\/li>\n<\/ul>\n\n<p>You can enable and disable rules as needed but, like setting the PHPStan level, ideally I like to enable them all by default and see how strict I go.<\/p>\n\n<p>It depends on the code being tested and the preference of the team, though I find the stricter the rules, the less bugs there are.<\/p>\n\n ",
"format":"full_html",
"processed":"\n <p>Continuing yesterday's thought on <a href=\"https:\/\/www.oliverdavies.uk\/daily\/2024\/05\/04\/strict-typing-in-php\">strictness in PHP<\/a>, today I want to talk about adding more strictness to PHPStan.<\/p>\n\n<p>Adding the <a href=\"https:\/\/github.com\/phpstan\/phpstan-strict-rules\">PHPStan Strict Rules extension<\/a> makes PHPStan stricter by adding new, more opinionated rules.<\/p>\n\n<p>For example:<\/p>\n\n<ul>\n<li>Require booleans in if, elseif, ternary operator, after !, and on both sides of && and ||.<\/li>\n<li>Use the <code>$strict<\/code> parameter with <code>in_array<\/code>, <code>array_search<\/code>, <code>array_keys<\/code> and <code>base64_decode<\/code>.<\/li>\n<li>Disallow empty().<\/li>\n<li>Require calling parent constructor.<\/li>\n<\/ul>\n\n<p>You can enable and disable rules as needed but, like setting the PHPStan level, ideally I like to enable them all by default and see how strict I go.<\/p>\n\n<p>It depends on the code being tested and the preference of the team, though I find the stricter the rules, the less bugs there are.<\/p>\n\n ",