Releases: phpstan/phpstan
Releases · phpstan/phpstan
2.1.11
2.1.10
Bugfixes 🐛
- Fix condition of fall-through case not used for exhaustive checks (#3900), #11064, #3488, #8719, #12722, thanks @rvanvelzen!
- Fix calling getVariableType without checking hasVariableType first (phpstan/phpstan-src@72d2f3b), #12767
2.1.9
Improvements 🔧
- This release includes fixes and improvements from PHPStan 1.12.22
- Collected data: reduce memory consumption & result cache size (#3879), thanks @janedbal!
- Detect accessing static property as non static (#3857), #12692, thanks @jnoordsij!
- Infer types of variables with dynamic name (phpstan/phpstan-src@7d4dcb5, phpstan/phpstan-src@0df0c6f), #12398
- Infer types of property fetch with dynamic name (phpstan/phpstan-src@8bb0670)
- Infer types of StaticCall with dynamic name (phpstan/phpstan-src@51a867f)
- Infer types of MethodCall with dynamic name (phpstan/phpstan-src@244093e)
- Infer types of StaticPropertyFetch with a dynamic name (phpstan/phpstan-src@2fe4e0f)
- Support dynamic Expr name expressions in rules (#3886), thanks @zonuexe!
- Improve
count()
narrowing of constant arrays (#3709), #12190, #3631, thanks @herndlm! - Support narrowing a constant array to a list with count (#3878), thanks @staabm!
- Treat
#[Pure(true)]
in PhpStorm stubs ashasSideEffects => true
(#3880), #6345, #12577, #10342, thanks @zonuexe! - excludePaths: include example for optional path (#3883), thanks @thePanz!
- Narrow type on setting offsets of properties (#3699), #6398, #6571, #12565, thanks @herndlm!
Bugfixes 🐛
- Fix false positives on non-existing array offsets (#3766), #8649, thanks @staabm!
- Fix false positives on existing offsets after assign (#3874), #12406, #11679, thanks @staabm!
- Fix false positives on non-existing offsets of superglobals (#3871), #11447, thanks @staabm!
- Fix
count()
regression (#3895), thanks @staabm! - Remove
count()
narrowing handling of empty array (#3896), thanks @herndlm! - Avoid falsely specifying never types via
count()
(#3898), thanks @herndlm! - Constant array with negative keys cannot be a list (#3870), #12708, thanks @watasuke102!
- Do not report constructor unused parameter if implemented interface has a constructor (#3777), #11454, thanks @carlos-granados!
- Fix JSON error formatter when files are empty (#3798), thanks @shyim!
- Fix readonly property assign with ArrayAccess offset (#3817), #8929, #12537, thanks @herndlm!
Internals 🔍
- RuleTestCase: set
shouldPolluteScopeWithLoopInitialAssignments
to true which is PHPStan's default behaviour (phpstan/phpstan-src@1b56b0c) - ResultCache: allow customization of params not invalidating cache (#3877), thanks @janedbal!
- RegexArrayShapeMatcher - turn more details immutable (#3892), thanks @staabm!
1.12.23
1.12.22
Improvements 🔧
Bugfixes 🐛
- ArrayType - setting new offset with
[]
on array with constant-integer offset will add one to the offset (phpstan/phpstan-src@fe595cb), #9328, #9850, #10650 - Optimize scalar values in oversized constant arrays (phpstan/phpstan-src@791e708), #12671
- StaticPropertyFetch is an impure point (phpstan/phpstan-src@4111d0f)
2.1.8
Improvements 🔧
@readonly
property cannot be passed by-ref (#3850), #12676, thanks @staabm!- ClassReflection - cannot be a subclass of final-overriden class (phpstan/phpstan-src@ed4ea0a)
- Deprecated
ClassReflection::isSubclassOf(string $className)
in favour ofClassReflection::isSubclassOfClass(ClassReflection $class)
- If you just have
string $className
instead ofClassReflection
and you are too lazy to get ClassReflection via ReflectionProvider, you can still useClassReflection::is(string $className)
- If you just have
Bugfixes 🐛
- This release includes fixes from PHPStan 1.12.21
- Cannot override being final for abstract classes (phpstan/phpstan-src@9bb2ed5)
- Fix unsetting array item triggering
unset.possiblyHookedProperty
(#3855), #12695, thanks @staabm! - UnusedPrivatePropertyRule - handle virtual properties that can only be read or only written (phpstan/phpstan-src@da73771, phpstan/phpstan-src@12185ab), #12702
- Faster analysis with a big const array in a class (#3862), #12159, thanks @staabm!
Internals 🔍
1.12.21
Bugfixes 🐛
- Correctly infer template type from various callables (phpstan/phpstan-src@5920c98), #12691
- Fix accepting generic callable in CallableType and ClosureType (phpstan/phpstan-src@0e10531), #12691, #6828, #11942, #11861, #6828, #9167
- Fix generalizing constant arrays when the array is getting smaller (phpstan/phpstan-src@8734057), #12658, #8030
Function signature fixes 🤖
2.1.7
Improvements 🔧
- Introduce
IgnoreErrorExtension
(#3783), thanks @ruudk! - Understand that
new Foo()
cannot be a subclass (#3853) - Object type narrowed after
$a::class
andget_class($a)
cannot be a subclass (phpstan/phpstan-src@772f297) - Teamcity - show rule identifier when verbose output is set (#3804), thanks @kamil-zacek!
- Class constants cannot be directly accessed on a trait (phpstan/phpstan-src@d56d084)
- Hooked properties cannot be both final and private (#3830), #12336, thanks @staabm!
- Hooked properties cannot be both abstract and private (#3839), #12336, thanks @staabm!
- Implement FinalPrivateConstantRule (#3838), thanks @staabm!
- Readonly properties cannot be
unset()
(#3827), #12421, thanks @staabm! - Hooked properties cannot be
unset()
(#3842), #12336, thanks @staabm! - Handle BcMath\Number overloaded operators (#3787), #12099, thanks @schlndh!
- TypeNodeResolver - check for existing
Integer
class before resolving toint
(#3848), #12660, thanks @stepo2!
Bugfixes 🐛
- This release includes fixes from PHPStan 1.12.20
- Fix
ClassLike::$namespacedName must not be accessed before initialization
(phpstan/phpstan-src@948f79d), #12627 - Fix referencing
%env%
inincludes
(phpstan/phpstan-src@d4d7e11), #12606 - Property can be written in get hook (phpstan/phpstan-src@8de182d), #12621
- Fix scope in enum match arm body (#3786), #12422, thanks @dmytro-dymarchuk!
- Fix integer range pow issues (#3787), #7937, #8555, thanks @schlndh!
- Fix GetNonVirtualPropertyHookReadRule on abstract property (#3845), thanks @staabm!
- VarTagTypeRuleHelper - remove namespace and uses from NameScope (phpstan/phpstan-src@189a4cc)
Function signature fixes 🤖
- Change return type of
ResourceBundle::getLocales
(#3840), #12579, thanks @mat-se! - Make precise
scandir()
argument and return type (#3808), thanks @zonuexe! - More precise return type for
mysqli_fetch_all()
(#3778), thanks @oxan!
Internals 🔍
1.12.20
Bugfixes 🐛
- Recreate
@var
PHPDoc type fromType::toPhpDocNode()
before reporting it as wrong (#3797), #12458, #11015, #10861, #11535, thanks @VincentLanglet!
Internals 🔍
FileTypeMapper::getNameScope()
(phpstan/phpstan-src@bca8902)- MissingTypehintCheck: reduce duplicate work (#3843), thanks @staabm!
2.1.6
Improvements 🔧
- This release includes improvements from PHPStan 1.12.19
- PHP 8.4: Overriding property - when overriding readable property, the property has to be readable (same for writable) (phpstan/phpstan-src@924a7a2)
- ClassReflection - hasProperty cache (phpstan/phpstan-src@73d7b88)
- Updated phpdoc-parser
- Allow multiple new lines in union and intersection declaration (phpstan/phpdoc-parser#265), thanks @DaDeather!
- TypeParser - support comments at EOL with
//
(phpstan/phpdoc-parser#264), phpstan/phpdoc-parser#184, thanks @shmax!
Bugfixes 🐛
- Do not report constructor unused parameter if class is an Attribute class (#3776), #7165, thanks @carlos-granados!
Internals 🔍
- Test for set-hooked property being overriden by readonly property (phpstan/phpstan-src@d3909c7)