Skip to content

Releases: phpstan/phpstan

2.2.2

05 Jun 09:01
e5cc34d

Choose a tag to compare

Improvements 🔧

Bugfixes 🐛

Function signature fixes 🤖

  • Correct xdebug filename/trace function return types in functionMap to include false/null (#5788), #14736

Internals 🔍

2.2.1

28 May 14:45
dea9c8f

Choose a tag to compare

Improvements 🔧

Bugfixes 🐛

Function signature fixes 🤖

2.2.0

28 May 08:41
b4cd983

Choose a tag to compare

Dive into details about this release on PHPStan's blog: PHPStan 2.2: Unsealed Array Shapes, Safer Array Keys, and More!. It explains all the changes and the motivation behind them.

Major new features 🚀

Bleeding edge 🔪

  • Sealed array shapes are truly sealed
    • Array shape like array{a: int, b: string} does not allow for extra keys and does not accept general arrays

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 🐛

Internals 🔍

2.1.56

26 May 17:06
93a603c

Choose a tag to compare

This is the final send-off for PHPStan 2.1.x series! 👋 This release fixes 31 issues 🎉

PHPStan 2.2.0 will be released this Thursday.

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 🐛

Performance 🏎️

Function signature fixes 🤖

Internals 🔍

  • Reflection Golden Tests: Report changes via GitHub Actions annotation (#5697), thanks @staabm!
  • Move list-contradiction NeverType out of unsetOffset into tryRemove (#5707)
  • Extract Type::truncateListToSize() from TypeSpecifier (#5713)
  • Improve variable name (#5736), thanks @staabm!
  • Cleanup ClassExistsFunctionTypeSpecifyingExtension (#5748), thanks @staabm!
  • Test array_key_exists() on subtracted enum (#5749), thanks @staabm!
  • Added regression test (#5750), thanks @staabm!
  • Cleanup instanceof ConstantStringType calls (#5752, #5753), thanks @staabm!

2.1.55

18 May 11:59
9eaac38

Choose a tag to compare

This release fixes 55 issues! 🎉

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 🐛

Performance 🏎️

  • Lazily initialize AggregateSourceLocator to speedup bootstrapping (#5577), thanks @staabm!
  • PhpFileCleaner: Use strcspn instead of regex for fast-skip in clean() (#5600), thanks @staabm!
  • Cap cumulative unroll factor when nesting unrolled constant-array foreach (#5614), #14590
  • DateFunctionReturnTypeHelper: prevent unnecessary TypeCombinator::union() (#5629), thanks @staabm!
  • Memoize ArrayType::isList() (#5680), thanks @staabm!

Function signature fixes 🤖

  • Fix #14499: Mark Lua::__construct $lua_script_file parameter as optional (#5571), #14499, thanks @predictor2718!
  • More concrete return type for opcache_get_configuration ([#5424](https:...
Read more

2.1.54

29 Apr 13:35
8be50c3

Choose a tag to compare

Improvements 🔧

Bugfixes 🐛

  • Process unrolled foreach iteration body in original context to let nested loops stabilize (#5559), #9332, #14543
  • Preserve conditional expressions in invalidateExpression when requireMoreCharacters is true (#5560), #14545
  • Recognize [$obj, $method] as callable when is_callable($obj, $method) is known true in scope (#5547), #4510, thanks @VincentLanglet and @staabm!
  • Replace instead of union when writing to optional keys via union offset in ConstantArrayTypeBuilder (#5566), #14551
  • Check isFirstClassCallable() before calling getArgs() on nested FuncCall nodes (#5564), #14550, thanks @staabm and @VincentLanglet!
  • Preserve non-empty array guarantee in ConstantArrayType::setOffsetValueType when union key expansion produces all-optional keys (#5567), #14552, #14553

Performance 🏎️

2.1.53

28 Apr 16:16
ef67586

Choose a tag to compare

Bugfixes 🐛

  • Treat Expr\UnaryMinus with scalar operand as scalar literal in isExprSafeToProjectThroughVariable and comparison type specifying (fixes TypeError crash) (#5557), #14542
  • Unroll foreach over union of constant arrays in tryProcessUnrolledConstantArrayForeach (#5558), #7978

2.1.52

28 Apr 12:27
08a34f8

Choose a tag to compare

This release fixes 45 issues! 🎉

Improvements 🔧

  • Emit virtual Assign node for List_ destructuring in foreach value position (#5504), #8075
  • Narrow array key type after type-checking the key variable inside a foreach loop (#5505), #7076
  • Support for static::SOME_CONST in PHPDoc (#5510), #13828, thanks @VincentLanglet!
  • Allow GMP in increment/decrement operations (#5530), thanks @Firehed!

Bugfixes 🐛

Performance 🏎️

Function signature fixes 🤖

Internals 🔍

2.1.51

21 Apr 18:23
dc3b523

Choose a tag to compare

Improvements 🔧

  • Include argument index in dumpType message to preserve argument order (#5503), #14508

Bugfixes 🐛

Internals 🔍

2.1.50

17 Apr 13:11
d452086

Choose a tag to compare

Bugfixes 🐛

Function signature fixes 🤖