Caching of reflection objects and resolved PHPDocs
Many raw performance optimization tweaks in analyser code (thanks @staabm!)
Projects typically see 25 % to 40 % faster analysis times. Please test this release and report back, we're looking forward to your numbers as well!
Utilization of Fibers for more precise analysis (PHP 8.1+)
Code like doFoo($a = 1, $a) will see better type inference for 2nd call argument.
When a rule hooked onto MethodCall AST node asks for $scope->getType($node->args[1]), without Fibers it gets mixed, because $scope sees the state before the method call.
Fibers allow PHPStan to "pause" the execution of the rule until the precise type of $node->args[1] is available in the analyser.
When the 2nd argument is processed, the execution of the rule is resumed and $scope->getType($node->args[1]) sees 1 as the type, not mixed.
count(non-empty-array, COUNT_RECURSIVE) is int<1, max> (#4515), thanks @staabm!
Fix bitwise operators on mixed (#4423), #8094, thanks @VincentLanglet!
Immediate unwrap AlwaysRememberedExpr after used on NodeScopeResolver (#4651), thanks @samsonasik!
Improve return type of range() function to always yield a non-empty-list (#4688), thanks @FeBe95!
Fix ArgumentsNormalizer - do not overwrite already passed args (https://github.com/phpstan/phpstan-src/commit/7bdd17221f67b9e7e55741f5e9cb67d9f8232ce2)
Prevent crash when analysing curl_setopt (#4722), thanks @schlndh!
Fix the handling of sealed concrete classes (#4567), #13734, thanks @stof!
TypeCombinator - assume that inner types in UnionType are already normalized (https://github.com/phpstan/phpstan-src/commit/e8f999276855d7673b19b67a49b693aec24e51c4)
Remember resolved types after pushInFunctionCall (#4648), thanks @staabm!
Remember function return type extensions (#4644) (#4644), thanks @staabm!
Use sha256 which is cpu optimized in PHP 8.4+ (#4656), thanks @staabm!
Cache ast-parsing in RegexGroupParser (#4655), thanks @staabm!
Microoptimize TypeCombinator (), thanks @staabm!
Function signature fixes ๐ค
Fix getAttributeNode and getAttributeNodeNS (#4484), thanks @VincentLanglet!
Use more efficient spl_object_id() over spl_object_hash() (#4674), thanks @staabm!
Remove TypeCombinator::union() calls that are not necessary (https://github.com/phpstan/phpstan-src/commit/12f2b2318ca8ded98a544452555cb9982a7794b9)
Remove TypeCombinator::intersect() calls that are not necessary (https://github.com/phpstan/phpstan-src/commit/f1f97c30a7ead237704c4f081e3f58d2512c67f0)
Prevent repetative method calls on ParametersAcceptor (#4686), thanks @staabm!
Use static callback for TypeTraverser::map() (#4701), thanks @staabm!
Prevent unnecessary work while Ternary analysis (#4704), thanks @staabm!
Prevent unnecessary work in NodeScopeResolver->processAssignVar() (#4705), thanks @staabm!
Prevent unnecessary work in While/Do analysis (#4706), thanks @staabm!
Prevent unnecessary work in TypeSpecifier->createForExpr() (#4707), thanks @staabm!
NodeScopeResolver: Move condition out of loop (#4708), thanks @staabm!
NodeScopeResolver: determine callCallbackImmediately only for callables (#4709) (#4709), thanks @staabm!
NodeScopeResolver: cheap checks first (#4710) (#4710), thanks @staabm!
NodeScopeResolver: Move assignByReference logic out of generic path (#4711), thanks @staabm!
Process called methods looking for initialized properties only when called from constructor (https://github.com/phpstan/phpstan-src/commit/c9937542b33e288e0b2a126d085ebdd16de7527b)
Various TypeCombinator optimization ideas (https://github.com/phpstan/phpstan-src/commit/3577b698473a7c54387aae8133451fea89c87341)
No need to call rememberConstructorExpressions for each enterClassMethod if rememberConstructorScope is kept (https://github.com/phpstan/phpstan-src/commit/78d946dacc0d8aede1508e5691f501436011c9d7)
Debug-Rules: cheap checks first (#4764), thanks @staabm!
InitializerExprTypeResolver: move work out of loop (#4785), thanks @staabm!
TrinaryLogic: Prevent unnecessary work (#4784), thanks @staabm!
ResultCacheManager - do not invalidate cache when switching Blackfire extension on/off (https://github.com/phpstan/phpstan-src/commit/97c30cacf1ed15d1fc4bf820aacae982404d4fe2)