Skip to content

Releases: phpstan/phpstan

2.1.38

30 Jan 17:14
dfaf1f5

Choose a tag to compare

This version brings another 5-10 % faster performance! 🏎️

Improvements 🔧

  • Remove PHP version constraint from the #[\Override] attribute rules (#4436), thanks @johnbillion!
  • OverridingPropertyRule - take checkMissingOverrideMethodAttribute as default only on PHP 8.5+ (phpstan/phpstan-src@64e9776)
  • Support StaticMethodParameterClosureTypeExtension for New_ expressions (#4819), thanks @ruudk!
  • Improve inference on FuncCall === FuncCall (#4513), #13749, thanks @staabm!
  • Don't lose known offset-types in array_merge() (#4554), thanks @staabm!

Bugfixes 🐛

Performance 🏎️

  • Rework phpDoc inheritance to resolve through reflection instead of re-walking the hierarchy (#4829), #10771
  • TemplateTypeHelper: prevent unnecessary work (#4818), thanks @staabm!
  • ConstantArrayType: prevent unnecessary work (#4811), thanks @staabm!
  • ImpossibleCheckTypeHelper: Remove unnecessary late-resolving (#4816), thanks @staabm!
  • Prevent duplicate logic execution for createMethod with includingAnnotations: true if @method does not exist (phpstan/phpstan-src@d5da11e)
  • Find all constant/method types per class at once (#4737), thanks @staabm!
  • Speed up CombinationHelper (#4825), thanks @kaja47!
  • MutatingScope: Faster createConditionalExpressions (#4831), thanks @staabm!
  • Re-use ExpressionTypeHolder (#4832), thanks @staabm!
  • IntersectionType cannot be void (#4835), thanks @staabm!
  • Cache IntersectionType results (#4836) (#4836), thanks @staabm!
  • Prevent unnecessary work in MutatingScope->mergeVariableHolders() (#4837), thanks @staabm!
  • Simplify lowercase-string handling (#4838) (#4838), thanks @staabm!

Function signature fixes 🤖

Internals 🔍

2.1.37

24 Jan 08:25
28cd424

Choose a tag to compare

Improvements 🔧

Bugfixes 🐛

Performance 🏎️

Internals 🔍

  • TrinaryLogic: detect logic errors (#4802), thanks @staabm!

2.1.36

21 Jan 14:00
2132e5e

Choose a tag to compare

Bugfixes 🐛

Function signature fixes 🤖

Internals 🔍

2.1.35

20 Jan 17:35
72f843c

Choose a tag to compare

Bugfixes 🐛

Internals 🔍

  • RuleTestCase - sort actual and expected errors before comparing (#4790)
  • Revert "Keep errors ordering even when nodeCallback executed out of order" (#4790)
  • narrowMethodScopeFromConstructor parameter no longer needed because RuleTestCase sorts the errors (#4790)
  • Prevent unnecessary work around parametersAcceptor->getParameters() call-sites (#4792), thanks @staabm!

2.1.34

19 Jan 19:53
070ba75

Choose a tag to compare

Major new features 🚀

  • Optimized performance 🏎️
    • 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.
    • Solves 10 reported issues: #12234, #11982, #11386, #11079, #10612, #9652, #8936, #12663, #12735, #13353

Improvements 🔧

Bugfixes 🐛

Performance 🏎️

  • Prevent unnecessary scope merging (#4640), thanks @staabm!
  • Prevent reading & json-decoding composer.json multiple times (#4645), thanks @staabm!
  • Cache neon file reads (#4646), thanks @staabm!
  • Optimize keepVoidType (phpstan/phpstan-src@ff39220)
  • TypeCombinator - assume that inner types in UnionType are already normalized (phpstan/phpstan-src@e8f9992)
  • 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 (#4657), thanks @staabm!
  • TypeCombinator: Remove unnecessary md5 encoding (#4658), thanks @staabm!
  • Prevent duplicate super-global-variable detection (#4662) (#4662), thanks @staabm!
  • Prevent Scalar expressions to be specified (#4663), thanks @staabm!
  • Print more precise elapsed time (#4664), thanks @staabm!
  • TypeCombinator: remove unnecessary loop (#4665), thanks @staabm!
  • TypeCombinator: Reduce number of intersect() calls (#4668), thanks @staabm!
  • TypeCombinator: Simplify ConstantStringType handling (#4666) (#4666), thanks @staabm!
  • TypeCombinator: Prevent unnecessary work (#4667) (#4667), thanks @staabm!
  • Prevent unnecessary work when resolving Expr\BinaryOp\Coalesce (#4661), thanks @staabm!
  • VerbosityLevel: early return type traversal (#4670) (#4670), thanks @staabm!
  • ParametersAcceptorSelector: early return type traversal (#4669) (#4669), thanks @staabm!
  • UnresolvableTypeHelper: early return type traversal (#4671), thanks @staabm!
  • LazyInternalScopeFactory: Prevent expensive repeated getService() calls (#4672), thanks @staabm!
  • Use more efficient spl_object_id() over spl_object_hash() (#4674), thanks @staabm!
  • Remove TypeCombinator::union() calls that are not necessary (phpstan/phpstan-src@12f2b23)
  • Remove TypeCombinator::intersect() calls that are not necessary (phpstan/phpstan-src@f1f97c3)
  • Prevent repetative method calls on ParametersAcceptor (#4686), thanks @staabm!
  • Prevent unnecessary node-key calculation (#4691), thanks @staabm!
  • Prevent maybe unnecessary work in MutatingScope::filterBySpecifiedTypes() (#4690), thanks @staabm!
  • Prevent unnecessary work in BetterReflectionProvider (#4687), thanks @staabm!
  • Simplify MutatingScope->invalidateMethodsOnExpression() (#4692), thanks @staabm!
  • Speedup analysis of arrays containing closures (#4684), thanks @staabm!
  • TypeNodeResolver: Reduce number of intersect() calls (#4694), thanks @staabm!
  • TypeCombinator: prevent unnecessary work (#4695), thanks @staabm!
  • ConstantStringType: Prevent creation of unnecessary constant-object types (#4696), thanks @staabm!
  • Remove NodeFinder from MutatingScope->restoreThis() (#4697), thanks @staabm!
  • MemoizingContainer - memoize getService (phpstan/phpstan-src@68815ac)
  • 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 (phpstan/phpstan-src@c993754)
  • Cheap checks first (#4715), thanks @staabm!
  • Store only variables as expression types with maybe certainty (#4719)
  • Prevent unnecessary work in MutatingScope->mergeVariableHolders() (#4720), thanks @staabm!
  • Prevent unnecessary work in NodeScopeResolver::processAssignVar() (#4716), thanks @staabm!
  • Minor optimization (phpstan/phpstan-src@21d86f0...
Read more

2.1.33

05 Dec 10:25
9e800e6

Choose a tag to compare

Improvements 🔧

Bugfixes 🐛

Function signature fixes 🤖

Internals 🔍

2.1.32

11 Nov 15:19
e126cad

Choose a tag to compare

Improvements 🔧

Bugfixes 🐛

Function signature fixes 🤖

  • Make BcMath\Number::$value numeric-string (#4505), thanks @schlndh!

Internals 🔍

Read more

2.1.31

10 Oct 14:53
ead8984

Choose a tag to compare

Bleeding edge 🔪

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 🔧

Bugfixes 🐛

Function signature fixes 🤖

Internals 🔍

2.1.30

02 Oct 16:09
a4a7f15

Choose a tag to compare

Improvements 🔧

  • Alternative solution to disable cloning with --prefer-source that does not need another repository (0eb327e)
  • TableErrorFormatter: Link path in JetBrain IDEs (#4369), thanks @vrana!
  • Improve ConstantArrayType inference (#4376), thanks @staabm!
  • use string instead of __stringandstringable in printf parameter error message (#4377), thanks @schlndh!
  • Inherit PHPDoc return type in child method with narrower native return type (#4384), #12481, #11364, #10600, #13588
  • Rely on RuleLevelHelper in InvalidKeyInArrayItemRule (#4379), thanks @VincentLanglet!

Bugfixes 🐛

Function signature fixes 🤖

Internals 🔍

1.12.32

30 Sep 10:17
2770dcd

Choose a tag to compare

Alternative solution to disable cloning with --prefer-source that does not need another repository