Releases

PhpStorm 2022.3: PHP 8.2, New UI (Beta), Code Vision, Redis Support, Quick-Fixes Preview, and More

PhpStorm 2022.3 is now available!

This major update brings a preview of the new UI, complete PHP 8.2 support, Redis support in database tools, Code Vision for PHP, quick-fix preview, Xdebug config validation, support for ParaTest, reader mode for PHPDoc, and many other features.

Download PhpStorm 2022.3

Check out this quick round-up of the key changes from our Developer Advocate, Brent.

Read this blog post for details about all the significant updates, demonstrated through a ton of GIFs!


New UI (Preview)

The brand new UI is now available for everyone to try. It is turned off by default because it’s still in the Beta stage. You can switch to the new UI in Settings/Preferences | Appearance & Behavior | New UI Preview.

The new UI allows you to perform most tasks the same as before while offering a cleaner and faster interface with fewer distractions.

User Experience

In this release, you will find many additional visual improvements. Here are some of the most notable ones.

Code Vision

Some meta information about PHP symbols is now shown right next to the PHP code in the editor:

  • The number of usages of a certain class, trait, interface, method, or function. You no longer have to click on a symbol to find this out.
  • The number of implementations for interfaces.
  • Info from Git about who made the most changes to a certain piece of code. This person may be a code owner or someone who has the most expert knowledge about that part of the code.

You can configure the position of Code Vision text, either above a piece of code or to the right-hand side of it. To change this, right-click on a piece of Code Vision text and choose Configure – this will take you to Preferences / Settings | Editor | Inlay Hints | Code vision.

You can also disable Code Vision insights by right-clicking on one of them and choosing Hide All Code Vision Inlay Hints.


By the way, Code Vision in PhpStorm works for JavaScript and TypeScript files too!

Quick-fix preview

You can fix some code problems automatically by pressing Alt+Enter. Now you will be able to preview the proposed quick-fix or intention action before you apply it, so you can see how your code will be altered once you accept PhpStorm’s suggestions.

The preview appears when you open the list of available intention actions and hover over one of the options.



You can disable the preview feature by pressing F1 / Ctrl+Q while the list of intention actions is open.

Reader mode for PHPDoc blocks

When coding, it is crucial that you can read your code easily. You can now change the appearance of PHPDoc blocks in PhpStorm 2022.3 with an option that provides better looking rendering and support for HTML formatting.


To toggle the new rendered view, click on the gutter icon near any PHPDoc block:

To turn rendering on for all PHPDoc comments, right-click on the gutter icon and choose Render All Doc Comments:

Improved Quick Documentation

If you press F1 / Ctrl+Q on any function, class, or method, PhpStorm will show the documentation right in the editor.

This popup has been significantly reworked. You no longer need to switch to the browser and search for documentation, because everything is right above your code.

Datetime format preview

Date formats that are passed to date() or similar functions can be confusing and more complex than just Y-m-d. But even in this case, do you know the output by heart? You don’t have to. PhpStorm 2022.3 shows a tooltip with an example date when hovering on a date format string.



Shout out to Jason McCreary for this wonderful suggestion!


The datetime preview synergizes well with the quick-fix preview, as you’ll see the formatted date preview in the Alt+Enter quick-fix menu.



Also, when editing a date format string, you’ll get autocompletion with hints for all characters that are recognized as format parameters.


PHP 8.2

PhpStorm 2022.3 comes with full support for PHP 8.2. Most of the changes in the IDE will fit organically into your PhpStorm workflow, so we’ll only mention the new features that you need to know about.

As usual, you can try new features by setting the project language level to PHP 8.2. You can make this switch from the toolbar or by specifying the requirement in composer.json.

Readonly classes

A readonly class is a quick way to declare a class that has only readonly properties. You can use these classes for additional data integrity.

For readonly classes, PhpStorm provides:

  • A quick-fix to convert a class with readonly properties to a readonly class.
  • An inspection to make sure that readonly classes can only have readonly children.
  • The ability to detect redundant readonly properties in readonly classes.
  • Checks for prohibited static and dynamic properties in readonly classes.

Deprecated dynamic properties

Accessing non-existent properties in PHP 8.2 will cause a deprecation notice. PhpStorm highlights these usages and provides quick-fixes for the errors, either by adding the property or by using the #[AllowDynamicProperties] attribute.

Typesystem improvements

PHP 8.2 adds support for disjunctive normal form types, as well as standalone null, true, and false types. We’ve added support for all of them in PhpStorm as well.

Sensitive Parameters

Sensitive parameters can be marked with the #[SensitiveParameter] attribute in PHP 8.2 to make sure that their values are never shown in stack traces. PhpStorm adds support for this attribute as well.

More deprecations

PHP 8.2 introduces a few more deprecations, and PhpStorm has you covered with corresponding inspections to spot them and quick-fixes to update your code.

Deprecated ${ string interpolation

If you need to use a variable inside a string, there are two possible ways to perform interpolation: "$foo" and "{$foo}".

There was one more way before PHP 8.2, but it has been as deprecated and will be removed in the future: "${foo}".

PhpStorm will highlight the occurrences, and you can use an Alt+Enter quick-fix to upgrade the code:

Deprecated partially supported callables

In PHP 8.2, several ways of calling functions have been deprecated. Use an Alt+Enter quick-fix to upgrade your code.


PhpStorm can scan your whole codebase at once to detect all possible instances of specific problems. Go to Code | Analyze Code | Run Inspection by Name. Next, search for the inspection you want to run, “dynamic property”, for example, and PhpStorm will do the rest.


Debugging

If you’re having trouble configuring Xdebug, here are a few things you can now do in PhpStorm to identify the problem.

Validate phpinfo() output

Add a phpinfo() call to your PHP script or page and copy the output of the function that you see in your browser. Then call Run / Web Server Debug Validation, and you’ll see a dialog that allows you to paste the phpinfo() output from the previous step.

PhpStorm will analyze the server configuration and notify you of any problems.

Check the server configuration with a script

If the phpinfo() information didn’t help, you can use PhpStorm’s validation script on the server.

Return value debugging with Xdebug

Xdebug 3.2 has an extra “return from function” debugging step that allows you to inspect the return value.
PhpStorm 2022.3 supports this new feature. To trigger it, press Step Into when you’re on the last statement in the function. As a result, an additional variable will be shown in Watches.

Databases: Redis support

A preliminary iteration of long-awaited support for Redis has been implemented.

Check out What’s New in DataGrip 2022.3 for an overview of the other new features we’ve added for working with databases.

PHP Tool Integrations

Run tests in parallel with ParaTest

The long-anticipated support for parallel testing in PhpStorm has finally arrived!
To run tests in parallel, you need to check the Use ParaTest option in your tests’ Run configuration, and then check that the path to the ParaTest binary is set correctly.

Usually, if you have ParaTest added in your composer.json file, the path should look something like this: ./vendor/bin/paratest_for_phpstorm.

Run single data sets from PHPUnit’s data providers

With the help of PHPUnit’s data providers, you can quickly run a series of tests using various test data.

This can save you time by running just one set of data from the entire provider while debugging tests.

You can run a test with a specific set from the data provider by pressing a gutter icon near it in the editor.

Use external formatters for PHP

It is now possible to choose an external formatter in Preferences | PHP | Quality Tools. You can now use FriendsOfPHP/PHP-CS-Fixer or squizlabs/PHP_CodeSniffer for this purpose, or you can stick to the default PhpStorm formatter.

Robo integration

Robo, a popular task runner for PHP, has received the following extended support:

  • A special Robo tasks tool window becomes available if a Robo class is present in the project.
  • A run configuration for executing Robo tasks is available inside the context menu and invoked from a Robo method.
  • Each public method inside a Robo class has a gutter icon for the respective configurations.

Prophecy support

If you use the Prophecy mocking framework in your tests, working with it in PhpStorm will now be easier.

Code completion is now available after you call the prophesize() or reveal() methods.

Improvements for WordPress

Developing plugins and themes for, and simply customizing, WordPress sites has become a little easier with this release of PhpStorm.

We’ve added support for get_template_part(), get_header(), get_sidebar(), and get_footer(). You can now click on them or press B to go to the corresponding file.

File paths that contain plugins_url() or use get_stylesheet_*() functions are now also recognized, and you can click on them to jump to the source.

Improvements for Blade

Closing directives will now be added automatically when possible.

We’ve also improved detecting (un)used functions in blade templates. So you should see less false highlighting of those.

Other Updates for PHP

ML-assisted sorting of completion lists in PHP

We introduced machine-learning (ML)-based autocompletion sorting for PHP back in v2019.3. It improves code completion by reordering the elements in the completion popup so that the most relevant items are ranked higher.


This was disabled by default, but our studies have shown that it improves completion.
Based on our current research, users choose the top item from the completion dropdown list 65% of the time. With ML-based completion, this statistic increased to 75%, so we’ve decided to turn this setting on by default.


You can disable ML-based completion and change its settings under Preferences/Settings | Editor | General | Code Completion:

Rename class file is renamed on copy-paste

Say you wanted to duplicate a file but give it a different name. Previously, if the file contained a PHP class, you had first to rename the file, and then the class. Now it’s just a single action, and the class name will be derived from a new file name.

Move constants to enum

PHP 8.1 introduced enums, which provide an easier alternative to prefixed class constants for grouping constant values.

To create such an enum, use the Move members refactoring on class constants. In the refactoring dialog, select the Move as enum cases checkbox.

PhpStorm will do the rest for you: create an enum, find all usages of old constants, and replace them with the correct enum cases.

Note that the language level of the project should be set to at least PHP 8.1 for this refactoring to be available.

Support iteration over list array shapes

Support for array shape annotations was added in PhpStorm 2021.2, and then in 2022.1 we added multiline and nested syntax support for array shapes.

The final missing piece arrives in PhpStorm 2022.3 – full code completion for array-shape items in loops.

Move classes with drag-n-drop improvements

We have added drag-n-drop move class refactoring in 2021.3. But previously it only worked in projects with properly configured source roots according to PSR-0/PSR-4.

Now we’ve removed this requirement, and even if the project doesn’t have proper settings, PhpStorm will do checks and detect source roots to perform the refactoring.

In this release, we’ve further enhanced the algorithms that identify target namespaces, so that most of the time, the dialog asking you to enter the target namespace is not even displayed; instead, all files are simply moved correctly with updated namespaces and references.

This is how it worked before:

And with no interruptions at all in this release:

Inject JSON language into Nowdoc/Heredoc strings with JSON tags

Previously, you could use the <<<SQL token or even <<<PHP to automatically switch on code highlighting in Nowdoc and Heredoc lines.

Now you can also use the JSON token:

New Settings Sync solution

We merged two old synchronization solutions (IDE Settings Sync and Settings Repository) into a single one – the new Settings Sync. It allows you to reliably synchronize settings across different IDEs and machines.

If you weren’t using a settings synchronization solution before but want to try the new one, you can enable it via Settings / Preferences | Settings Sync | Enable Settings Sync.


Web

As usual, all of the updates for WebStorm 2022.3 have also been incorporated into PhpStorm.


Docker

Docker executable from WSL without Docker Desktop

You can set up WSL type of connection in Settings / Preferences | Build, Execution, Deployment | Docker.

New context action: Pull image

Call up the context actions (Alt+Enter) on the highlighted image name and then select Pull Docker image to pull a required image without running it from a Dockerfile, docker-compose.yml, or even from tests using Testcontainers.

Support for the .dockerignore file type

You can now benefit from highlighting and completion in .dockerignore files.

Support for the heredoc format in Dockerfiles

You can now use multiline scripts right in your Dockerfiles.

Docker connections from Docker Contexts

It is now possible to set up additional Docker connections using Docker Contexts by calling the Add Service context menu in the Services view and selecting Docker Connections From Docker Contexts.

HTTP Client

Format long requests in the HTTP Client

The HTTP Client now provides better formatting options for requests with long URLs. You can also use the Put query parameters on separate lines context action to break a query into smaller fragments on different lines.

Pre-request scripts

The HTTP Client now supports script blocks that are executed before requests. You can generate some data before request execution and pass it to the subsequent request using variables.

New APIs for JavaScript handlers

PhpStorm now provides the сrypto API, making it capable of computing the md5 or sha1 hash values for an HTTP request.

Additional random functions are now available, which is convenient for quick API testing.

More quality of life improvements

Option to dock tool windows to floating editor tabs

To make it more convenient to arrange your working space and interact with PhpStorm using multiple monitors, we’ve implemented the option to drag tool windows out of the main window and dock them to floating editor tabs.


Improved Bookmarks

For v2022.3, we’ve implemented a few UI improvements to the Bookmarks feature to fine-tune its functionality after merging the Favorites and Bookmarks instances in the 2021.3 release.
It is once again possible to bookmark files from editor tabs. Right-click on a tab to invoke the context menu and select Bookmarks.



In addition, you can add all files in all open tabs to Bookmarks. You can either invoke the same context menu and select Bookmark Open Tabs, or call this action using the kebab (three-dots) icon located on the right-hand side of the editor tabs pane. The IDE will put all open tabs in a new list of bookmarks, which you can name as you like.

Single-line copy/cut/paste

We’ve improved the editing experience in the IDE by adding the option to copy ⌘C / Ctrl+C and cut ⌘X / Ctrl+X single lines of code in the editor without selecting them. The paste action ⌘V / Ctrl+V then adds the contents of the clipboard above the current line. You can still use the old copy and cut behavior by selecting the text you want, and when you use the paste action, the contents will be added at the caret’s position.


You can disable this option at any time and use the old behavior exclusively by going to Preferences / Settings | Advanced Settings | Editor and selecting Don’t copy/cut the current line when invoking the Copy or Cut action with no selection and Don’t select the copied line after invoking the Copy action with no selection.


The full list of changes in PhpStorm 2022.3 is available on the release notes page.

That’s all for today. Thanks for keeping up with the changes! We hope they improve your PhpStorm experience.

image description