PhpStorm 2020.1 EAP #3

Posted on by Roman Pronskiy

The third of our Early Access Program builds for PhpStorm 2020.1 is now available!
In this blog post, we’ll go through updates for PHPUnit, various additions for PHP including better PHPDoc handling with PHP 7.4, and last but not least, improved Git branches workflow.

If you prefer to watch the updates in video format, you can subscribe to the JetBrains YouTube channel and follow our What’s Coming in PhpStorm 2020.1 SeriesEpisode 1 is already online!

Download PhpStorm 2020.1 EAP

PHPUnit Toolbox

PHPUnit 9 has just been released, and it has several deprecations and removed functionality. To ease migration, PhpStorm 2020.1 will have tools to help with upgrading to PHPUnit 9 quickly and other improvements as well.

Intention to create PHPUnit tests
If you need to create a test for an existing class that you are working on in the editor, you can now put a cursor over the class name and press Alt+Enter alt-enter  to call a quick-action “Creates new PHP test”.


Deprecated @expectedException
It used to be possible, before PHPUnit 9, to use the annotation tag @expectedException to mark that a test method should throw an exception. Now, there is the expectException() method that should be called inside the method instead.

PhpStorm will highlight the deprecated tag, and provide a quick-fix (Alt+Enter alt-enter ) “Replace with …” to upgrade the codebase:


The same works for @expectedExceptionCode, @expectedExceptionMessage, @expectedExceptionMessageRegExp.

Upgrade Assert methods
While technically it is possible to do any assertions with just assertTrue(), the more specific assertion methods help improve test readability a lot.

For example, if you need to check if there is a certain key in an array, you could write:
$this->assertTrue(array_key_exists($key, $array));

Or instead, you could write something more descriptive with no additional function calls:
$this->assertArrayHasKey($key, $array);

The good news is that you don’t need to rewrite everything manually, as PhpStorm 2020.1 will convert this for you with a quick-fix (Alt+Enter alt-enter ):


The same works for assertFalse(array_key_exists ...) -> assertArrayNotHasKey().

Deprecated assertInternalType()
The old assertInternalType() method that ensures a target variable is of some basic type integer, array, and so on is also deprecated in PHPUnit.

PhpStorm 2020.1 will strike through the occurrences of assertInternalType() and provide a quick-fix (Alt+Enter alt-enter ) to replace it with a proper alternative.


Asserting size
Convert assertEquals(42, count($array1)) to assertSize(42, $array1) and

assertEquals(count($array1), count($array2)) to assertSameSize($array1, $array2) with a quick-fix (Alt+Enter):


Deprecated optional params in assertEquals()
Before PHPUnit 9 assertEquals() had 4 optional parameters. Now optional parameters are replaced with a set of specific methods so you will be able to upgrade with respective quick-fixes (Alt+Enter alt-enter ).


Inspection to check the order of arguments (expected, actual)
PhpStorm will analyze the code and suggest flipping arguments (Alt+Enter alt-enter ) if the actual value goes before the expected value.

Other improvements for PHP

Remove PHPDoc with just type annotation
The PHPDoc @param tags that only contain type info can now be removed with a quick-fix (Alt+Enter alt-enter ) in favor of params’ native type declarations.


The Missing PHPDoc inspection will be tweaked accordingly, too, and it will not suggest adding PHPDoc if the method is already fully typed.

Change type to match the default value for PHP 7.4 typed properties
If a property’s type declaration does not match the default value, PhpStorm will highlight this and will propose to either change the type or make it nullable.


New functions in PHP Live Templates
Live Templates are essentially code snippets that can help you save and reuse code.

The real power of Live Templates comes when you add dynamics to it. For example, there are special function calls that will work depending on the context of where you are inserting the live template.

In PhpStorm 2020.1, two new functions are available for your convenience: className() and qualifiedClassName().


Option to keep space before PHP arrow function parentheses
If you prefer PHP 7.4’s arrow functions to have space after the fn keyword, you will be able to do so by checking the Arrow function parentheses option under Preferences(Settings) | Editor | Code Style | PHP in Spaces tab.

Improved Git branches workflow

In the bottom right corner of the IDE window, there is a current Git branch specified. If you click on it, you’ll get a popup to access all the branches. Alternatively, you can trigger the popup by calling menu VCS | Git | Branches.


Firstly, the popup now has an explicit search bar, which simplifies the process of looking for the existing remote and local branches. Previously, a floating search field would appear only when you started typing the name of a branch, which made this functionality difficult to discover.

The other improvement affects the Refresh button: we’ve reworked it so that you can use it to update the existing remote branches.

Lastly, we’ve added incoming (blue) and outgoing (green) commit indicators to the status bar.

This release brings plenty of other exciting features, and we will continue to describe notable changes in subsequent posts. So be sure to follow our updates on Twitter and Facebook!

The full list of changes, including bug-fixes and improvements, 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 feedback is much appreciated, and the most active EAPers will get special limited-edition gifts from us!

Your JetBrains PhpStorm team
The Drive to Develop


Subscribe for updates