Skip to content

Releases: phpstan/phpstan

2.2.1

Choose a tag to compare

@phpstan-bot phpstan-bot released this 28 May 14:45
dea9c8f

Improvements 🔧

Bugfixes 🐛

Function signature fixes 🤖

2.2.0

Choose a tag to compare

@phpstan-bot phpstan-bot released this 28 May 08:41
b4cd983

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

Choose a tag to compare

@phpstan-bot phpstan-bot released this 26 May 17:06
93a603c

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

Choose a tag to compare

@phpstan-bot phpstan-bot released this 18 May 11:59
9eaac38

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

Choose a tag to compare

@phpstan-bot phpstan-bot released this 29 Apr 13:35
8be50c3

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

Choose a tag to compare

@phpstan-bot phpstan-bot released this 28 Apr 16:16
ef67586

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

Choose a tag to compare

@phpstan-bot phpstan-bot released this 28 Apr 12:27
08a34f8

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

Choose a tag to compare

@phpstan-bot phpstan-bot released this 21 Apr 18:23
dc3b523

Improvements 🔧

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

Bugfixes 🐛

Internals 🔍

2.1.50

Choose a tag to compare

@phpstan-bot phpstan-bot released this 17 Apr 13:11
d452086

Bugfixes 🐛

Function signature fixes 🤖

2.1.49

Choose a tag to compare

@phpstan-bot phpstan-bot released this 16 Apr 21:12
d008295

Bugfixes 🐛

Performance 🏎️

  • Use pairwise TypeCombinator::intersect folding for conditional expression holders to avoid exponential union distribution (#5482), #14475
  • Fix more cases (#5482), #14475
  • More pair-wise intersect (#5482), #14475
  • Avoid 2^N getAllArrays() expansion in implode() return type extension (#5482), #14475
  • Avoid 2^N getAllArrays() expansion in ConstantArrayType::getFiniteTypes() (#5482), #14475
  • Bail early in TypeUtils::flattenTypes() to avoid 2^N getAllArrays() expansion (#5482), #14475
  • Batch unionWith in specifyTypesForFlattenedBooleanOr falsey path to avoid O(N²) (phpstan/phpstan-src@7eab3d2)
  • Add flattening optimization for deep BooleanAnd chains in truthy context (phpstan/phpstan-src@3f5f2de)
  • Use hash map for O(1) key lookup in ConstantArrayType (phpstan/phpstan-src@8019f65)
  • Fix infinite hang when analysing src/wp-includes/user.php in wordpress-develop (#5485)

Function signature fixes 🤖

  • Update session_set_save_handler $gc parameter (#5474), thanks @sreichel!

Internals 🔍