PhpStorm 2022.2 Early Access Program Is Open
Our Early Access Program (EAP) for PhpStorm 2022.2 starts today!
In this first EAP build, you’ll get a chance to preview many new features related to generics, Rector support, and a bunch of quality-of-life improvements.
If you’re not familiar with our EAP, here’s a quick recap:
We publish new EAP builds every week and showcase upcoming features.EAP builds are free to use and don’t require a license.You can install the EAP version side by side with your stable version of PhpStorm – there is no need to uninstall it.The Toolbox App is the easiest way to get the EAP builds and keep both your stable and EAP versions up to date.Download builds from the EAP page or receive them automatically in the IDE by selecting Check IDE updates for Early Access Program under Settings / Preferences | Appearance & Behavior | System Settings | Updates.
With that said, let’s take a look at what’s new in the first EAP release of PhpStorm 2022.2!
Rector helps you with automatic PHP upgrades and code refactorings in bulk. It’s an amazing tool, and we’re happy to provide built-in support in PhpStorm for it.
In order to use PhpStorm’s Rector support, you first need to install Rector and configure it. Next, you should create a new run configuration specifically for Rector. PhpStorm can do this automatically for you: simply right-click the folder you want Rector to fix and then select Run | Rector:
As you can see, PhpStorm will give you a list of files that Rector will change. You can then review changes in PhpStorm, select individual files and folders, and finally apply all selected changes.
Since Rector is a run configuration, you have the option to configure it, as well. Either go to Run | Edit Configurations or choose Edit Configurations from the search actions menu:
Alternatively, you can manually create new Rector configurations on the Edit Configuration screen as well.
When we announced basic support for generics in PhpStorm back in 2021, we knew there was plenty more work to be done in the future. With this EAP release, we’re happy to say we’ve made significant progress. Let’s take a look at what we’ve done with our generics support.
This EAP comes with a lot more improvements to generics. For example, we now support the int<min, max> type:
Generic support for iterables
PhpStorm will now also be able to infer types when looping over iterables:
Infer types from closures
PhpStorm is now able to infer generic types from closure return values. This feature is used a lot in, for example, Laravel collections where you pass a closure to a collection function like map or first:
Generics in traits
You can now use generics in combination with traits by using the @use annotation:
Support for by-passing generic types
PhpStorm now handles methods like Collection::lazy() better, where generic types are proxied into another object:
And quite a lot more features:
Improved support for nested generics (WI-66014).Flipping generic types (WI-66015).Support for generics in iterators: Iterator<Type> now works as expected (WI-62323).Support for generics in iterable: iterable<KeyType, ValueType> now works as expected (WI-56037)[email protected] SplFixedArray<Token> now works as expected (WI-65964).Improved generic type inference (WI-60891).
We’d like to keep improving our generics support, so don’t hesitate to submit an issue when you run into cases that aren’t supported yet.
Improved complete statement support in arrays
Using complete statement, you can instruct PhpStorm to write boilerplate code for you. In this release, we’ve added support for automatically inserting arrows and commas in arrays:
Code Style: trailing commas
You can configure PhpStorm to automatically insert trailing commas in parameter lists, closure use lists, and function calls. Go to Settings / Preferences | Editor | Code Style | PHP | Code Conversion to configure these options.
Blade: @props and @aware directives
We now support the @props and @aware directives in blade components.
Running code quality tools with local PHP binary
You can now configure which PHP binary to use when running tools like PHP CS Fixer or PHPUnit. Go to Run | Edit Configurations and select a specific run configuration where you can fill in the Command Line options. You can choose an interpreter and then configure extra options for it if needed.
Various quality-of-life improvements
Support for @psalm-yield (WI-57590).
Important! PhpStorm EAP builds are not fully tested and may be unstable.You can install an EAP build side by side with a stable PhpStorm version to try out the latest features.EAP builds are free to use but expire 30 days after the build date.
Please report any problems you find to our issue tracker, or by commenting on this post.
Your JetBrains PhpStorm team
The Drive to Develop
The PhpStorm Blog : The Lightning-Smart IDE for PHP Programming | The JetBrains Blog