Early Access Program

PhpStorm 2020.2 EAP #7

Learn more about the brand-new Extract class refactoring, unassigned typed property inspection, and customizing generated getters/setters.

If you prefer watching to reading, check out the What’s Coming in PhpStorm 2020.2 series on our JetBrains YouTube channel!

Download PhpStorm 2020.2 EAP

New refactoring: Extract class

Classes always start out neat and tidy. They do their job and do not interfere with other classes. Over time, however, new methods and fields may be added here and there. As a result, some classes get cluttered and burdened with a lot of additional responsibilities.

To fix this, at some point it can be useful to move method from a bloated class to a new one.

With the new Extract class refactoring it’s as easy as selecting the part of the code you’d like to move and pressing Ctrl+T -> Extract class. PhpStorm will prompt you to enter a name for the new class and choose a namespace.

You can extract methods and properties in this way.

The refactoring will create a new file, inject an instance of the class into the old one via a constructor, and replace the selected code with a new method call.

It is also possible to extract functions to a new class.

Learn more about refactorings in PhpStorm on this help page.

New inspection: Typed property might be unassigned

If a typed property does not have a default value, the property is considered to be uninitialized. Reading uninitialized properties will generate a TypeError (unless __get() is defined).

PhpStorm 2020.2 detects uninitialized properties and highlights code that attempts to read them.

Customizing generated getters and setters

You can adjust the naming and choose between camelCase() or snake_case().

You can also define the order the generated getters and setters should go in.

Both options are available under Preferences(Settings) | Editor | Code Style | PHP on Code Generation tab.


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

  • 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

image description