Read more about this release in a feature article on PHPStan's blog »
Major new features 🚀
Static reflection
- Less configuration needed. PHPStan no longer needs autoloading configuration setup, it works out of the box in most situations. Check out Discovering Symbols guide in the documentation for more details.
- Introduced new related configuration options
scanFiles
, andscanDirectories
. Deprecatedautoload_files
, andautoload_directories
.
- Introduced new related configuration options
- It's now possible to analyse files that mix class/function declarations and side-effects.
Improvements 🔧
- ConstantStringType - mark values coming from
::class
constant explicitly, for performance reasons (phpstan/phpstan-src@9814ab0), #3054, #3193, #1275 - Limit size of ConstantArrayType coming from literal array (phpstan/phpstan-src@8527777), #3055, #1275
- Inherit PHPDocs from internal classes (phpstan/phpstan-src@e686505), #1802, #1682, #2445
- Option
checkExplicitMixed
that will eventually become level 9 (phpstan/phpstan-src@da0b2eb) - Used memory will be printed with
-v
(phpstan/phpstan-src@a90b290) - Update nikic/php-parser to 4.5.0 (phpstan/phpstan-src@876d146)
- Don't merge deprecated tag with parents (#225), thanks @ossinkine!
Bugfixes 🐛
- Add LIBXML_VERSION & LIBXML_DOTTED_VERSION dynamic constants (#203), thanks @schlessera!
- NodeScopeResolver - fix processing args in New_ (phpstan/phpstan-src@9b62d91)
- FileReader - assert is_file() before reading (phpstan/phpstan-src@9fd30bf), #3304
- Do not analyse trait method that's shadowed in the using class (phpstan/phpstan-src@a2044e6), #2935
- Fix yield from return type (#207), thanks @enumag!
- FileAnalyser - fixed unignorable errors that were thrown away (phpstan/phpstan-src@7dc1de3)
- Generics: fix isSuperTypeOf implementations (#206), thanks @hrach!
- OptimizedSingleFileSourceLocator - fix const handling (phpstan/phpstan-src@6204ebe), #2868
- get_class extension: fix support for generics (#209), #3263, thanks @hrach!
- Always accept
isset($array[$string])
(#214), thanks @nobuf! - InstanceOf: fix uncertainty (#211), thanks @hrach!
- IncompatibleDefaultParameterTypeRule - fix analysed functions with reflection from different place (phpstan/phpstan-src@50915ce), #3349
- Check default property value against native type (phpstan/phpstan-src@4329b07)
- Default value property type does not observe strict types - it's always strict (phpstan/phpstan-src@fe72e26)
Function signature fixes 🤖
- Fix
mb_convert_encoding()
(#213), thanks @marcu87! - Added stubs for SplDoublyLinkedList, SplQueue and SplPriorityQueue (#205), thanks @dktapps!
- PDO stub - add missing constants (phpstan/phpstan-src@3734c3f), #2883
- Fix return values for date_parse() (#217), thanks @cxj!
- DynamicReturnType for array search call not strict (#215), thanks @VincentLanglet!
- Fix some SplFileObject signature (#220), thanks @VincentLanglet!
- Make toArray() return list in ext-ds (#221), thanks @simPod!
- Fix sapi_windows_set_ctrl_handler signature (#224), thanks @Seldaek!
- Fix signature of XSLTProcessor::transformToXml (#226), thanks @czjvic!