Early Access Program

PhpStorm 2021.1 EAP #4

The fourth build of the PhpStorm 2021.1 Early Access Program includes a set of new inspections and quick-fixes for PHP, as well as several enhancements in various subsystems.

Just like the other EAP builds, this build is free to use but it will expire 30 days after the build date.

Download PhpStorm 2021.1 EAP

New inspections and quick-fixes

Change parameter type based on a default value

If the declared type does not match the type of a value, you can quickly update the type using Alt+Enter:

In PHP 8, PhpStorm will offer to use a union type here too.

Replace assignment in the function call with named argument in PHP 8

Before PHP 8.0, it used to be common practice for developers to add a variable assignment in a function call to mimic a parameter name. This technique worked, but in PHP 8.0+ this “hint” variable can be replaced with named arguments. This reduces cognitive load and prevents possible bugs of unintended variable usages.

Use Alt+Enter to replace the assignment with a named argument:

Replace `isset` with `!== null`

Checks using the isset() function are only effective for arrays and variables. In all other cases, it makes more sense to verify if the operand is not null.

Use Alt+Enter to replace isset() checks with null checks:

Replace `isset` with coalesce

This code:
isset($a) ? $a : $b;
Is exactly the same as:
$a ?? $b;

So PhpStorm will suggest an Alt+Enter quick-fix to replace it:

Simplify `if` blocks with the common body

Some `if` or `else` blocks may become redundant, for example after some changes that make their bodies the same.

PhpStorm will detect such redundancies and offer a quick-fix to eliminate them:

If there is some common part of the body, then PhpStom will suggest extracting only that part:

Method return value is never used

Let’s say there is a private method in a class with a return statement. It is called in other methods, but the result is never assigned nor is it used in some other way.

For such methods, it may make sense to declare their return type void explicitly in order to not confuse anyone trying to read and understand the code.

You can run the inspections mentioned above on the whole project, to find all the places where the fixes are applicable.

Use Code | Run inspection by name.


Support for a Git commit template

When creating a commit message, PhpStorm now will take into account a Git commit template, if it’s specified in the commit.template option of your Git configuration.

JSON Lines support

PhpStorm now supports the newline-delimited JSON Lines format used for working with structured data and logs. The IDE will recognize the .jsonl, .jslines, .ldjson, and .ndjson file types.

In this format, files contain several lines where each new line is a JSON object separated by a newline character. Commas are not required, neither at the beginning nor the end of lines, and there is no need to enclose the entirety of the file contents in square or curly braces.

Embedded MDN documentation

Quick MDN documentation for JS APIs, HTML, and CSS will be embedded in your IDE. For you, this means that in-editor documentation will be richer, always present, and quicker to display.

You could see that information by hovering over a symbol in your HTML, CSS, and JavaScript files or by invoking the Documentation popup with F1/Ctrl+Q.

Notable bugs fixed:

  • Option to change tab character rendering (IDEA-227988 +39).
  • Darcula theme: unreadable errors in local and SSH terminals (IDEA-182750 +15).
  • List items are not shown on Mac Touch Bar (IDEA-236698 +9).
  • Some colors are not changed on switching theme (IDEA-201293 +8).
  • “Extension is missing in composer.json” should check require-dev (WI-48712 +8).
  • Better callable detection (WI-37850 +7).
  • Composer: missing extension inspection: suggest adding into (WI-43638 +7).
  • IntelliJ terminal dosent match colors on iTerm ZSH theme (IDEA-196703 +7).
  • Don’t warn ‘PHPDoc matches signature’ parameter has type and such parameter is not in phpdoc (WI-24046 +6).

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