⚠️ This post links to an external website. ⚠️
PHPStan 2.2 introduces significant changes to array shapes, addressing long-standing issues.
Among the key features are the new unsealed array shapes, allowing you to define array types with additional keys, enhancing flexibility in your code.
This update aims to resolve the inconsistencies that arose when using sealed array shapes, which previously allowed extra keys without proper checks. Additionally, the update introduces safer array keys, protecting against PHP quirks that could inadvertently cast string keys to integers under certain conditions.
A new configuration parameter allows developers to manage how these potential issues are reported, ultimately leading to more robust type safety in PHP applications.
Overall, PHPStan 2.2 places a strong emphasis on improving type system reliability, making it crucial for developers to revisit their type declarations as they adopt these new features.
continue reading onphpstan.org
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.