PhpStorm 2022.3 Early Access #3: Support for PHP 8.2

In this build, we added full support for PHP 8.2. Keep on reading to learn all about it!

The EAP allows you to try new features from the upcoming PhpStorm 2022.3. EAP builds are free to use. You can install them side by side with a stable version of PhpStorm. If something doesn’t work correctly, you can quickly switch back to the previous version without interfering with your workflow.

Download PhpStorm 2022.3 EAP #3

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 familiar 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.1. You can switch it from the toolbar or by specifying the requirement in composer.json.

Readonly classes

We’ve added full support for one of the most anticipated features of the upcoming PHP 8.2 release. There is a quick-fix to convert a class with only readonly properties to a readonly class, but we also added inspections to make sure that readonly classes can only have readonly children, we detect redundant readonly properties in readonly classes, and we made sure that PhpStorm knows about prohibited static and dynamic properties in readonly classes.

Deprecated dynamic properties

PhpStorm also knows about deprecated dynamic properties and how to deal with them. We’ll tell you when you’re using dynamic properties, and we’ll provide some quick-fixes to fix the errors: either by adding or renaming the property, or by using the #[AllowDynamicProperties] attribute.

By the way, did you know that PhpStorm can scan your whole codebase at once to detect possible problems? Go to Code | Analyze Code | Run Inspection by Name, or use Find Action to quickly find it. Next, search for “dynamic property”, and PhpStorm will do the rest.

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.

New random number generator

PHP 8.2 has a brand-new random number generator. PhpStorm knows about all the newly added classes and can help you work with the new RNG more easily, such as navigating to it, finding its usages, and more.

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.

Constants in traits

Before PHP 8.2, you weren’t allowed to use constants in traits. Luckily, that has changed, and PhpStorm has full support for it as well, from detecting constants in traits to being able to move them via the refactoring menu.

More deprecations

There is an ongoing discussion about whether PHP has to reduce the number of BC breaks and deprecations or not. What do you think?

Anyway, PHP 8.2 introduces a couple 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 you can do interpolation: [code example].

There was one more way before PHP 8.2, but it is now marked as deprecated and will be removed in the future.

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, the following ways of calling functions will be deprecated:

Use an Alt+Enter quick-fix to upgrade your code.

Note that normal calls, like „function“, „Foo::method“, [„Foo“, „method“], and [new Foo, „method“] are not affected by this change, so for them calling through parentheses works as usual:

Other changes

There are too many other small changes in PHP 8.2 and PhpStorm to list here. You can check out our YouTrack page about PHP 8.2 for full disclosure, and don’t hesitate to open a new issue over there if you run into any problems using this EAP (or just comment on this post).

Please see the release notes for the complete list of changes in the EAP #2 build.

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 and don’t require a license. However, they expire 30 days after the build date and then you’ll have to download a new build.

Please let us know about any problems you find by reporting them to our issue tracker or commenting on this post.

The PhpStorm Blog : The Lightning-Smart IDE for PHP Programming | The JetBrains Blog
Read More

Latest News


PHP 8.3.9 released!

PHP 8.2.21 released!

PHP 8.1.29 released!

Generated by Feedzy