1.4.0
This release fixes 25 issues! 馃帀
Major new features 馃殌
- Support for PHP 8.1
readonly
properties (RFC)- Readonly properties must be assigned in the constructor of the declaring class
- Memoized type of a readonly property is not invalidated even when calling a method with side effects
- Readonly properties cannot be passed by reference
- Improved detection of incorrect types assigned to properties:
Improvements 馃敡
ParametersAcceptorSelector
- message forShouldNotHappenException
(phpstan/phpstan-src@d3c3483), #6328- Constructor of
BenevolentUnionType
is covered by BC promise (phpstan/phpstan-src@8f28dc8)
Bugfixes 馃悰
- Fix PHPDocs with
require
statement (phpstan/phpstan-src@b5a2c8f), #6348 - Fix inferring template types in
ClosureType
(#921), thanks @canvural! - Fix
random_int()
without args crash (phpstan/phpstan-src@6d7ba0f), #6361
Thanks to some internal refactorings listed below, the following issues have been fixed: #5337, #4910, #5316, #5607, #3766, #3858, #3310, #3264, #2806, #5328, #3044, #6184, #3339, #5656, #5362, #3867, #5707
- Fix scope after for-loop (phpstan/phpstan-src@4fb1a77)
- Improve preserving
ConstantArrayType
after setting new offset (phpstan/phpstan-src@ec117fa) ConstantArrayTypeBuilder
- preserveConstantArrayType
for integer range offsets (phpstan/phpstan-src@3eab462)- Fix generalizing
ConstantIntegerType
in Scope (phpstan/phpstan-src@d6c7595) - Scope generalization for integer range types (phpstan/phpstan-src@3651338)
Function signature fixes 馃
- Changed signature of
gmp_div
(#915), thanks @danielmarschall! PDO::prepare()
might returnfalse
(#916, phpstan/phpstan-src@a9881e3), thanks @staabm!- More precise
preg_match*
return type signatures (#918), thanks @staabm!