Bleeding edge 🔪
- Fix invariance composition (#2054), thanks @jiripudil!
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
Improvements 🔧
- TypeInferenceTestCase - do not allow files with no asserts (#1992), #8346, #8094, thanks @herndlm!
DateTimeZone::__construct
throw type extension (#2034)- TableErrorFormatter: allow editor url title configuration (#2035), #7796, thanks @janedbal!
- Various generics variance fixes (#2051, #2064), #3960, thanks @jiripudil!
- Add
deprecationRulesInstalled
configuration (#2062), thanks @villfa!- To be used in phpstan-deprecation-rules and phpstan-phpunit extensions soon!
- ArrayFilterRule should care about
treatPhpDocTypesAsCertain
(#2065), thanks @VincentLanglet! - Discover phpunit-bridge automatically (phpstan/phpstan-src@c760b1f)
- Performance optimizations:
- Cache descriptions in ObjectType and UnionType (phpstan/phpstan-src@da8413c), #8499, #8497
- Remove unnecessary file IO (#2069, #2094), thanks @staabm!
- Reduce calls to
Scope::getType()
. Cheap checks first. (#2071), thanks @staabm! - Cache resolved phpdoc in ClassReflection (#2072), thanks @staabm!
- Don't re-calculate node-key over and over again (#2073), thanks @staabm!
- Improve the CPU core count detection (#2047), thanks @theofidry!
- Optimize path related utils on windows (#2068), thanks @staabm!
- Don't re-calculate node-key over and over again - part 2 (#2074), #8503, thanks @staabm!
- Faster ConstantStringType->toArrayKey() (#2081), thanks @staabm!
- Faster ConstantFloatType->isSuperTypeOf(ConstantFloatType) (#2080), thanks @staabm!
- TypeSpecifier micro-optimization (phpstan/phpstan-src@30e6d19)
- Faster TrinaryLogic->lazyExtremeIdentity() (#2083), thanks @staabm!
- Faster ConstantArrayType->isSuperTypeOf() (#2086), thanks @staabm!
- Loops analysed in linear time instead of exponential time (#2088, #2091), #8503, #6265
- Remove unnecessary method call to already known value (#2092), thanks @staabm!
Bugfixes 🐛
- Improve conditionalExpressionTypes (#1950), #3677, #5623, #5401, #7292, #8212, thanks @rajyan!
- Fix conditional variable types in global scope (#1995), thanks @rajyan!
- Do not invalidate related expressions in ensureNonNullability (#2004), #8361, thanks @rajyan!
- Improve create conditional expressions to handle all expressions (#2007), thanks @rajyan!
- Improve conditional type resolving performance (#2030), #8397, #5805, thanks @rajyan!
- Fix false positive of access to static private property of parent class (#1989), #8333, thanks @staabm!
- Fix intersecting array shapes with different optional keys (#2002), #8373, thanks @rvanvelzen!
- Support PHPDoc asserts on variadic parameters (#2009), #8389, thanks @rvanvelzen!
- Fix
@param-out
on methods (#2028), #8421, thanks @staabm! - Do not set native type to
mixed
on annotation assignment (#2017), thanks @herndlm! - Consistently pass
$nativeExpressionTypes
in MutatingScope (#2021), thanks @herndlm! - Fix infinite loop when fully qualified callback is supplied (#2005), #8376, thanks @cs278!
- Non-static method DOMDocument::loadHTML() can be called statically (#2042), #2759, thanks @staabm!
- Fix FuzzyRelativePathHelper for directories ending in
.php
(phpstan/phpstan-src@bff85e2), #8480
Function signature fixes 🤖
- ImagickPixel::getColor() normalized param accepts int instead of bool (#2020), thanks @blankse!
- Declare more PDOStatement method types (#2096), thanks @staabm!
Internals 🔍
- Fix non-working type assertions in
NodeScopeResolverTest
cases (#1992), thanks @herndlm! - Use ExpressionTypeHolders for conditional expression type (#1998), thanks @rajyan!
- Simplify array collections in
UnionTypeHelper
(#1988), thanks @herndlm! - Avoid specifying scalar types and delete string casts (#1999), thanks @rajyan!
- Add filename and line of the error of assertVariableCertainty (#2008), thanks @rajyan!
- README: how to composer install (#2025), thanks @janedbal!
- Group
$expressionTypes
and$nativeExpressionTypes
in Scope creation methods (#2022), thanks @herndlm! - Use ExpressionTypeHolder when comparing conditionals (#2048), thanks @rajyan!
- UnionType - carry information that it's normalized (phpstan/phpstan-src@96e4443)
- VerbosityLevel offers
getLevelValue()
(phpstan/phpstan-src@4f7e20b) - Get rid of
TypeTraverser
inArrayChunkFunctionReturnTypeExtension
(#2082), thanks @herndlm! - Get rid of
TypeTraverser
inArraySliceFunctionReturnTypeExtension
(#2085), thanks @herndlm! - Get rid of
TypeTraverser
inArrayReverseFunctionReturnTypeExtension
(#2084), thanks @herndlm! - Get rid of
TypeTraverser
inStrSplitFunctionReturnTypeExtension
(#2087), thanks @herndlm!