Early Access Program

PhpStorm 2021.2 Early Access Program Is Open

Today we’re starting the Early Access Program (EAP) for PhpStorm 2021.2.

You can get the first EAP build via the Toolbox App, download it from our website, use a snap package (for Ubuntu), or from inside PhpStorm, select Automatically check updates for Early Access Program under Preferences / Settings | Appearance & Behavior | System Settings | Updates.

Download PhpStorm 2021.2 EAP

If you’re not familiar with our EAP, here’s a quick recap.

  • For two months before the next release, we will publish weekly new builds and showcase upcoming features.
  • EAP builds can be used completely free of charge and without a license. Every build is available for a month after it’s been published.
  • PhpStorm EAP builds are not fully tested and may be unstable. 
  • You can install EAP side-by-side with your stable version of PhpStorm – there is no need to uninstall it.

Along with the build, every week we will publish a post with a story about new features and changes. Follow us on Twitter @phpstorm and be the first to get each new post.

Occasionally, a video outlining the most recent features appears on our YouTube channel, so subscribe to stay posted.

With that said, let’s take a look at the first portion of the updates in the upcoming 2021.2 release.

PHP 8.1

The new version of the interpreter is expected to be released in late November. As is our tradition, we will start rolling out support for new features early. One of the most significant and expected features will, of course, be enums.

If you don’t want to miss what else is planned for PHP 8.1, sign up for our PHP Annotated newsletter with a roundup of news from the PHP world.

PHP 8.1 will be available in the language level selection for the project. You can switch from the toolbar or by specifying the requirement in composer.json.


Declare a new enum using the keywords enum and case. PhpStorm will, of course, help you with autocompletion and let you know if anything doesn’t follow the language syntax.

Declared enums can be used as type declarations in parameters, return values, and class properties. PhpStorm will check the type and highlight violations in the editor window.

You can quickly create new cases with a quick-fix. Type case usage as if it existed, then press Alt+Enter on it and choose Add enum case.

Backed Enums

By default, enumerated cases are simple singleton objects. But if you want to save them to a database or similar data store, then you can define scalar values for cases. 

Enums with scalar equivalents for cases are called backed enums.

If you define a standard enum (unit enum) and then decide to make it a backed one, PhpStorm will have a quick-fix to add a type of the whole enum. Press Alt+Enter on the highlighted case value and choose the option to add `: type` to the declaration.

Did you know you can call enum Enum? That’s because it’s defined as a context keyword and not a reserved word on its own. So it should not collide with any existing userland implementations of enums that you might have.

Enums implicitly implement interfaces UnitEnum and BackedEnum. As a result, all enums have a static method cases() that returns an array of enums. And backed enums additionally have methods from() and tryFrom(), which basically act as named constructors.

You can declare custom methods in the enums but not constructors, destructors, properties, dynamic properties, or magic methods (except __call, __callStatic, and __invoke). So PhpStorm will check and highlight all the violations for you.

That’s all for enums so far. Let us know if you have any ideas on how to make the support better.

Formatter improvements

For a long time, PhpStorm has had some quirks with formatting. While it worked fine most of the time, it could be very annoying in some fringe cases.

In PhpStorm 2021.2 we decided to fix all outstanding issues with formatting so that you always get what you expect!

To format your code, press Cmd+Alt+L. This works for file and selection too.

All code style options are available under Settings/Preferences | Editor | Code Style | PHP

There is another way to change the code style. Select a piece of code where you want to change the formatting and press Cmd+Shift+A. Find Adjust code style settings in the search window and check the popup.

Because of the formatting issues, some PhpStorm features could be somewhat unusable sometimes. Now they can become real timesavers.

One example would be splitting lists into separate lines and, vice versa, merging them into one. In arrays, argument list, or parameter list, press Alt+Enter and select Split comma-separated values into multiple lines:

When using multiple lines for lists, you can choose how to align items. For example, for parameters with type declarations, you can make them more readable by aligning types and names in columns:

If you come across formatting problems that we missed, please report them to our issue tracker

Other for PHP

Support for dirname levels

The dirname ( string $path , int $levels = 1 ) : string function has a second parameter that specifies how many levels up on the path it will go. 

PhpStorm used to lose path completion when this second parameter was used. Now it works as expected.

And there is a quick-fix to convert nested dirname() calls to a single one with $levels specified. Press Alt+Enter to apply this transformation.

Search Everywhere Ignores Imports

Following your reports on problems with the Search Everywhere dialog, we’ve made some improvements to it. Specifically, symbols from the vendor directory will have low priority on the All tab and will not show up on the Symbols tab.


PhpStorm inherits many improvements from the IntelliJ Platform with every release. Here are the ones that will make it into 2021.2.

Browser pages reload on save

As you may know, PhpStorm lets you preview HTML and PHP files in a browser using the built-in web server.

Now, it can also automatically reload the opened pages when HTML, PHP, or the linked CSS and JavaScript files are changed. Reloading is triggered whenever changes are saved in the IDE, either automatically, using ⌘S / Ctrl+S, or when changes are made to a file externally.

To try this new feature, open an HTML or PHP file, hover over the code, and click on the icon for the browser you want to use (all browsers are supported). You can also preview the file in a browser by going to View | Open in Browser in the main menu.

Reloading on save is turned on by default. To tweak the settings for it or to turn it off, go to the Built-in Server section in Preferences / Settings | Build, Execution, Deployment | Debugger. When you use the feature for the first time, you’ll also see a popup with a link to the same settings.

The new feature may sound similar to the Live Edit feature that PhpStom has had for some time already. But the key difference is that Live Edit does not use the built-in IDE server and is more advanced. With the new feature, we wanted to provide a more straightforward experience and make the reloading process more predictable and available in all browsers.

Improvements for the Preferences / Settings dialog

There’s now a new node with advanced settings in your Preferences / Settings dialog. This node contains some additional configuration options. Most of them were transferred from the Registry. They weren’t used often but were still helpful for some users, so we wanted to make those options easier to access. You’ll also find some new configuration options there, such as the ability to set a left margin in Distraction-free mode.

In the future, we plan to move some of the rarely used options that are currently available under the regular settings to this new node.

Additionally, you can now navigate back and forth between open sections in your Preferences / Settings dialog. To do so, use the arrows in the right-hand corner of the window.

Automatic cache and logs cleanup

Previously, PhpStorm’s logs and cache files could take up a considerable amount of hard drive space over time.

Now, after each major update, your IDE will automatically clean up any cache and log directories that were last updated more than 180 days ago. The system settings and plugins directories will stay intact. 

Or if you want to trigger this process manually, go to Help | Delete Leftover IDE Directories… in the main menu.

To learn more about the directories used by the IDE and their locations, check out this article.

The full list of changes in this build is available in the release notes.

You are very welcome to share your feedback in the comments below, by tweeting @phpstorm, or via our issue tracker.

Download PhpStorm 2021.2 EAP

Your JetBrains PhpStorm team
The Drive to Develop

image description