This release fixes 26 issues! 🎉
Improvements 🔧
- Dropped support for PHP 7.1, PHPStan 1.5.0 runs on PHP 7.2-8.1. Users on PHP 7.1 accounted only for 0.8 % of installatoins.
- Allow null as a return value when resolving return types (#1061), #5855, thanks @matthiasnoback!
- Output elapsed time per file in debug mode (#1062), #5294, thanks @janedbal!
- A bit more precise concatenation of unions of literal strings (#937), #6439, thanks @staabm!
OptimizedDirectorySourceLocator::locateIdentifiersByType()
returns all located classes or functions (#1080), thanks @tomasfejfar!- Backward compatibility promise: ReflectionProvider cannot be extended/implemented by 3rd party code (phpstan/phpstan-src@e60d6d6)
- implement
ArraySearchFunctionTypeSpecifyingExtension
(#1086), #6863, thanks @staabm! - added
ArrayReplaceFunctionReturnTypeExtension
(#1087), #5327, thanks @staabm! - Dynamic return type extension for
curl_getinfo
(#1072), thanks @PrinsFrank! - Support intersection types in template bounds (#1101), #6649, thanks @rvanvelzen!
- Support
value-of<BackedEnum>
(#1082), #6775, thanks @staabm!
Bleeding edge 🔪
- Report useless
array_filter()
calls (#1077), #6840, thanks @leongersen!
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
Bugfixes 🐛
- fix handling of
JSON_THROW_ON_ERROR
with optional bitwise flags (#1025), #6654, thanks @staabm! - Keep non nullability if right expr is
NeverType
(#1063), #5351, thanks @rajyan! - Support more dynamic
$flags
arg inpreg_split()
(#1081), thanks @staabm! - Fix
array_keys
andarray_values
with accessory types (#1084), #6859, thanks @staabm! - Fix memory error when trying to represent big literal string types (#1088), #6866, thanks @mathroc!
- Add throw point for
UnhandledMatchError
(#1056), #6115, thanks @rajyan! - Do not report unhandled match expression value if
@throws
tag is present withUnhandledMatchError
(#1103), thanks @rajyan! - Retain accessory string types in generics (#1096), #6301, #3951, #6845, #5336, thanks @rvanvelzen!
- Simplify
FloatType::accepts
handling ofCompoundType
s (#1097), #6872, thanks @herndlm! - Early termination for NeverType match expression (#1078), #6257, #6251, thanks @rajyan!
- ObjectType - different priority in iterable key and iterable value (phpstan/phpstan-src@1256192), #6494
- Support
enum_exists
in ClassExistsFunctionTypeSpecifyingExtension (#1109), thanks @staabm! - Fix/issue 6870 expr early termination for
BinaryOp
(#1105), #6870, #6890, thanks @rajyan!
Function signature fixes 🤖
- Fix DOMNodeList stub and add DOMXPath::query() (#1052), #6748, thanks @mkrauss!
- Change
ReflectionMethod::$class
type toclass-string
(#1107), #6889, thanks @rvanvelzen! - More precise function signatures (#1110), thanks @staabm!
- Update
context
parameter signature infopen()
(#1113), thanks @bytestream! - clear stat-cache also on
is_writeable()
calls (#1112), thanks @staabm!
Internals 🔍
- PHPStan now utilizes version-based naming of Git branches (
1.5.x
) instead ofmaster
- CI pipeline is faster thanks to several improvements:
- Support for PHP 7.1 was dropped
- Reproducible
phpstan.phar
checksum is computed and compared when running integration tests fromphpstan/phpstan
on pull requests inphpstan-src
. The integration tests run only when the checksum was changed. This means that for example if only unit tests in phpstan-src were changed, PHAR didn't change and those integration tests fromphpstan/phpstan
don't have to run. - Rector downgrade cache was implemented. When transforming sources from PHP 8.0 to various lower PHP versions, cache is utilized instead of making Rector do the hard work each time.