PhpStorm 2021.3 Early Access Program Is Open
Today we’re starting the Early Access Program (EAP) for PhpStorm 2021.3.
The third major release of PhpStorm this year will bring full support for all PHP 8.1 features, more enhancements for generics, rsync support, other improvements for deployment, a bunch of new inspections, improved refactorings, and a whole lot more.
Join the Early Access Program to be among the first to try out the updates, share your feedback, and influence the development of PhpStorm.
Along with the build, every week we will publish a post with a story about new features and changes every week. Follow us on Twitter at @phpstorm and be among the first to get each new post.
With that said, let’s take a look at the first portion of the updates in the upcoming 2021.3 release.
We started to roll out support for PHP 8.1 back in the last major release – PhpStorm 2021.2 came with full support for enums. Here you can read up on how to use enums in PhpStorm.
The PHP 8.1 RC 2 has been shipped, so the list of changes is now final. Let’s go through the features that await you in the upcoming version of PhpStorm.
As usual, you can try new features by setting the project language level to PHP 8.1. You can switch from the toolbar or by specifying the requirement in
Readonly properties are properties that cannot be changed after initialization, i.e. after a value is assigned to them.
You could achieve similar behavior in previous versions of PHP with a private setter, but the
readonly keyword makes classes cleaner and constraints stricter.
A readonly property can be initialized only in the same scope where it’s declared. This means you can assign a value either in the declaration itself or in a class method.
Properties with the
readonly flag must be typed, but if you don’t know the specific type then you can use the
If a readonly property is initialized by an object, it does not become immutable. That is, its internal state can still be changed.
A readonly property cannot have a default value, but you can initialize it in the constructor as a promoted property. PhpStorm has an Alt+Enter quick-fix for this:
Pure intersection types
Union types were added in PHP 8.0, and now PHP 8.1 is introducing intersection types.
The syntax is
TypeA&TypeB, and it means that the variable must be both
instanceof TypeA and
In PhpStorm 2021.3, code completion for this will be pretty much the same as it is for union types, because a union can contain members of all involved types, and an intersection must contain members of all types.
The feature is called pure intersection types because combinations with union types are not supported and are being left for future consideration. PhpStorm 2021.3 will check the syntax:
In older PHP versions it was quite common to use intersection types in PHPDoc annotations. Those will also be supported in PhpStorm 2021.3, and if you decide to upgrade to PHP 8.1, you can add a native type declaration:
New return type: `never`
In PHP 8.1 a new type for return values will be available:
A function or method declared with the
never type indicates that it will not return a value and will either throw an exception or end the script’s execution with a call of
trigger_error(), or something similar.
This type improves code analysis, and it’s pretty much the same thing that the
#[NoReturn] attribute has been doing in PhpStorm. It’s great that this is a language feature now!
In PHP 8.1 it will be possible to declare final class constants, so that they cannot be overridden in child classes.
Note that in PHP 8.0 and earlier versions, constants in interfaces were implicitly final and you could not directly change them. But in PHP 8.1, they are not final by default.
There are plenty of other changes in the upcoming PHP 8.1. PhpStorm 2021.3 will support them all and will help make your code compatible. Stay tuned for updates.
More for generics
In PhpStorm 2021.2, we added long-awaited support for generics. It covered basic use cases, but there’s still work to be done. Thank you for your feedback and tickets in the tracker!
Here’s what’s in the upcoming batch of enhancements for generics:
Improved support for Doctrine Collections
We’ve added support for the
IteratorAggregate interface in
As a result, iterating over Doctrine Collections now works out of the box!
Support for future Laravel collections
In the upcoming Laravel release, the illuminate/collections package is getting generics annotations. With PhpStorm 2021.3, you’ll get a better completion for them too.
Infer generic types from constructor
Let’s say there is a generic @template parameter in a constructor, and you want to specify the type by passing an object as an argument. This would not have worked before, as the type would be missing and you would not get code completion. It is now possible, however.
This is also a common scenario for collections, and has been supported since PhpStorm 2021.2.1.
Support for the phpstan-* annotation for templates
PhpStorm now supports any annotations for generics. You can either use a
@phpstan-* prefix or use pure tags without prefixes, like
Faster and better deployment
In PhpStorm 2021.3 it will be possible to use rsync and multiple connections as deployment options. This brings a tremendous speed improvement. There will be a few more updates, so stay tuned!
Follow us on Twitter @phpstorm!
New debugger UI
Our built-in debugger is a powerful tool that, in conjunction with Xdebug, helps you explore code behavior and fix bugs.
However, its design has become cluttered over the years, and as a result, the workflow has become overly complicated. In PhpStorm 2021.3 it will be simpler, neater, and more concise.
The new design is more modern and minimalist, which speeds up the debugging workflow and makes popular actions more discoverable.
New debugger layout
There is now a single horizontal toolbar at the top of the window. We’ve removed the vertical toolbar on the left and collapsed all the others. This layout reorganization lets us save a lot of space and makes the UI more intuitive. The changes help you focus better on essential debugging tasks like analyzing variables and navigating frames.
The most popular actions can now all be found in one place, and you can access the rest using the More icon. If the default configuration doesn’t work for you, you can customize it in Preferences | Appearance & Behavior | Menus and Toolbars | Debug Header Toolbar.
We’ve also made the Evaluate expression dialog more discoverable – you can now access it right from the Debug tool window.
Other notable improvements
Here are some other notable fixes available in this build:
- It’s now possible to use the mouse wheel to change the font size in your editor for all opened files, not only the current one. To enable this setting, go to Preferences / Settings | Editor | General and choose All editors under Change font size with Command / Ctrl + Mouse Wheel in (IDEA-158642).
- You can now turn off smart list editing in Markdown. To do so, go to Preferences / Settings | Languages & Frameworks | Markdown and deselect Automatic assistance in the editor checkbox (IDEA-273049).
- We’ve fixed a known issue that was causing the IDE to crash on Linux (IDEA-248140).
The full list of changes in this build is available in the release notes.
If you’re not familiar with our EAP, here’s a quick recap.
- We publish new EAP builds every week and showcase upcoming features.
- 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.
- 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.
- EAP builds are free to use and don’t require a license.
Your JetBrains PhpStorm team
The Drive to Develop
Subscribe to Blog updates
Thanks, we've got you!
PhpStorm 2023.2 Beta
In this build, we’ve added new inspections for PHP assertions and revised the integration with third-party quality tools.
PhpStorm 2023.2 EAP #6
This build brings improvements for generating PHPDocs, support for Laravel Pint, a single point of access to all PHP framework plugins, and much more!
AI Features in PhpStorm: PhpStorm 2023.2 EAP #5
The next EAP build for PhpStorm 2023.2 is now available, and it’s an exciting one! It is the first build to include features leveraging the enormous potential of generative AI and large language models (LLMs). Our Early Access Program (EAP) allows you to try new features from the upcoming PhpStor…
PhpStorm 2023.2 EAP #4
This build includes a bunch of usability improvements, such as abilities to pin Run configurations and sort files by modification time in the Project view. The EAP allows you to try new features from the upcoming PhpStorm version, 2023.2. EAP builds are free to use and you can install them side b…