Skip to content

1.6.0

Choose a tag to compare

@phpstan-bot phpstan-bot released this 26 Apr 05:48
· 69 commits to 1.6.x since this release
b480ba2

Read the article about PHPStan 1.6.0 »

Major new features 🚀

  • Conditonal return types (pull requests), #3853, big thanks to @rvanvelzen!
    • Allows return types in the form of @return ($i is positive-int ? non-empty-array : array) (don't forget the parentheses!)
    • Another possible form is with generic @template tags: @return (T is positive-int ? non-empty-array : array)
  • int-mask<...> and int-mask-of<...> types (#1166), thanks @rvanvelzen!
  • Allow global constants as PHPDoc types (#1163), thanks @rvanvelzen!
  • Update php-8-stubs to know about PHP 8.1 function signature changes, #7017, #6448
  • Make isset() and null-coalesce (??) operators consistent with each other (#1223), thanks @rajyan!
    • New option checkDynamicProperties to restore the original stricter behaviour (#1234), thanks @rajyan!

Bleeding edge 🔪

  • Fully static reflection engine
    • After feedback is gathered and processed, this will be enabled for everyone later in PHPStan 1.x release cycle.
  • Lower memory consumption thanks to breaking up of reference cycles
    • This is a BC break for rules that use 'parent', 'next', and 'previous' node attributes. Learn more »
    • In testing the memory consumption was reduced by 50–70 %.
  • ArrayUnpackingRule (level 3) (#856), thanks @canvural!
  • Rules for checking direct calls to __construct() (level 2) (#1208), #7022, thanks @muno92!
  • checkMissingIterableValueType: false no longer does anything (phpstan/phpstan-src@50d0c8e)

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 🤖