What’s New in PHPStan 1.0?

Nov 3, 2021, 8:54 pm EST | 5 min read PHPStan gained a milestone release at the start of November 2021 with new features, extra rules, and many performance optimizations. It means the leading PHP static analyzer is now considered to be stable and comes with a backwards compatibility promise for future updates. As it’s a major semver bump, PHPStan 1.0 also brings along some breaking changes which could affect your existing scans. These include extra rules and some replaced or removed config parameters. The New Level 9 PHPStan scans your PHP source to find potential issues without actually running the code. Alongside unit and end-to-end tests, this gives you visibility into the quality of your code by surfacing problems before users run into them. PHPStan levels are used to configure the analyzer’s strictness. The v0.x release series offered eight levels, with 0 the most relaxed and 8 the strictest. Although it’s preferred to use the strictest level possible for the best coverage, less stringent levels can help you introduce PHPStan to an imperfect codebase. PHPStan 1.0 adds level 9 as a new option. It includes all the rules from level 8 and lower, as well as one extra check: strict mixed type comparisons. The mixed type arrived in PHP 8.0 as a way to explicitly typehint “any” value. As mixed is essentially equivalent to an untyped value, it’s unsafe to make any assumptions about what a mixed-type val… Click below to read the full story from How To Geek
Read More