2.1.3
If you're using larastan/larastan PHPStan extension, please update to version 3.0.4 alongside PHPStan 2.1.3 for improved compatibility with the new generic static<...> type. Thank you.
This release includes fixes and improvements from PHPStan 1.12.17. Most impportantly it introduces GenericStaticType - support for static<...> (#1289), #12485, #11398, #10417, #9807, #9449, #8623, #5512
Improvements 🔧
- Look for overriden property prototype in implemented interfaces (phpstan/phpstan-src@b3ca610)
- AttributeReflection for easy attributes reading (phpstan/phpstan-src@a387fa3), #10443, #9618
- You can now call
->getAttributes()on any thinkable reflection object, including$scope->getFunction()and you'll get a new PHPStan's AttributeReflection class: https://apiref.phpstan.org/2.1.x/PHPStan.Reflection.AttributeReflection.html - See #12510
- You can now call
- Prevent declaring hooked properties as readonly (#3803), #12525, thanks @jakubtobiasz!
- Improved support for enum-string types (#3807), thanks @zonuexe!
Bugfixes 🐛
- Do not check abstract properties as uninitialized (phpstan/phpstan-src@1cc5347), #12466
- Properties might be covariant or contravariant, depending on the allowed operations on the parent (phpstan/phpstan-src@50f8e49), #12466
- Enable usage of
ReflectionClass::isSubclassOf()with invariant@template T(phpstan/phpstan-src@4f2af3b), #12473 - Fix crash on unknown trait use:
array_combine()args must have the same number of elements (ondrejmirtes/BetterReflection@36f3291), #12327
Function signature fixes 🤖
- fix ext-amqp signatures (#3793), #12469, #12461, thanks @esler!
Imagick::getConfigureOptions()returns array instead of string (#3801), thanks @blankse!
Internals 🔍
- Issue bot - skip
phpstanPlayground.configParametererrors (phpstan/phpstan-src@71d0327) - Cleanup (phpstan/phpstan-src@0b28f60)
- Add a test covering a hooked property in a readonly class (#3809), thanks @jakubtobiasz!