| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| phpstan.phar | 2026-05-28 | 27.0 MB | |
| phpstan.phar.asc | 2026-05-28 | 833 Bytes | |
| 2.2.0 source code.tar.gz | 2026-05-28 | 4.0 MB | |
| 2.2.0 source code.zip | 2026-05-28 | 4.0 MB | |
| README.md | 2026-05-28 | 3.7 kB | |
| Totals: 5 Items | 35.1 MB | 1 | |
Dive into details about this release on PHPStan's blog: PHPStan 2.2: Unsealed Array Shapes, Safer Array Keys, and More!. It explains all the changes and the motivation behind them.
Major new features 🚀
- Unsealed array shapes (#5501), [#13565], [#8438], [#11494], [#12110], [#14032]
- New types:
decimal-int-stringandnon-decimal-int-string(#5279) - New config parameter:
reportUnsafeArrayStringKeyCasting - Check constants in parameters (#5256), [#12850]
- New error identifiers:
argument.exclusiveConstants(phpstan.org)argument.invalidConstant(phpstan.org)argument.bitmaskNotAllowed(phpstan.org)
- Detect named arguments whose parameters are renamed in subtypes (https://github.com/phpstan/phpstan-src/commit/4c1a2b9883287bfca99ebc32a8b3eefccae03b50), [#7434], [#5279]
- New error identifier
argument.parameterRenamedInSubtype(phpstan.org)
Bleeding edge 🔪
- Sealed array shapes are truly sealed
- Array shape like
array{a: int, b: string}does not allow for extra keys and does not accept general arrays
If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's phpstan.neon:
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. Learn more
Improvements 🔧
- Allow custom rules to emit collector data for CollectedDataNode with CollectedDataEmitter (#5261)
- Reduced false positives about constant conditions in traits (#5309), [#13023], [#7599], [#13474], [#13687], [#12798], [#11949], [#12267], [#9515], [#4570], [#4121], [#8060], [#10353]
Bugfixes 🐛
- Narrow division to int when modulo is known to be zero (#5757), [#9724], thanks @VincentLanglet and @staabm!
- Do not normalize union types in tryRemove to preserve finite type combinations (#5744), [#10128], [#11453], thanks @VincentLanglet and @staabm!
- Prevent infinite recursion in
AttributeReflectionFactorywhen an attribute references itself on its constructor (#5773), [#14707]