PhpStorm 2019.2 EAP #2

The second build of the PhpStorm 2019.2 EAP is now available!

This build delivers on-the-fly detection of duplicates, supports preserving cookies in HTTP client, and can show more info in project view. It also improves PHP 7.4 support, including arrow functions, spread operator in arrays, and null coalesce assignment.
And, as usual, the build incorporates all the latest improvements from the IntelliJ Platform.

Download PhpStorm 2019.2 build 192.4488.6 on the EAP page or via the JetBrains Toolbox App. Or, if you have the previous PhpStorm 2019.2 EAP build (191.4738.10) installed, you should soon get a notification in your IDE about a patch update.

Note: Menu action Check for updates… for macOS users might not work due to a bug in the previous build. Users should either redownload installer manually or trigger update via check from Preferences | Updates, or using Find Action.

Locate duplicates on the fly

It’s been a while since we added this feature, accessible via Code → Locate Duplicates. It can help you eliminate duplicates and make your code more concise and stable. If you’ve never used it, you definitely should because it’s truly surprising how many duplicates an average codebase usually contains!

This PhpStorm EAP build takes the duplicate analysis to an entirely new level by allowing you to spot them on the fly. Now, if you stumble upon an existing duplicate, or somehow create one, either by writing new code or pasting a piece of code, you will know it instantly:

duplicate_on-fly_crop

The analysis comes with an intention action to let navigate to the duplicates or display them in a tool window:

duplicate_on-fly_actions

These are good candidates for an Extract refactoring, by the way.

The new inspection is called Duplicated code fragment and is enabled by default. To toggle it, go to Preferences | Editor | Inspections | General. You can adjust the relevant settings under Preferences | Editor | Duplicates. And, of course, you can run it on the entire project (or custom scope) anytime via Code → Run Inspection by Name.

PHP 7.4 Support

The first Alpha release of the new PHP version is expected on June 6. Check out all the awesomeness that it will bring in the PHP 7.4 overview post!

Meanwhile, we are regularly adding support for new language features in our EAP builds.

Typed Properties

In addition to parser support, type resolving, and the related quick-fix, we’ve added type checks in this build. Now PhpStorm will help you keep your codebase safe, and the new inspections will highlight the type violation in the editor:

typed_properties_inspection

The inspection will also check if the default values match the declared type:

typed_properties_default_value

??= (null coalesce assign) operator

The new shorthand assignment operator with a check for null is quite handy, especially when you have some long variables or statements. It allows you to reduce noise and keep the code clean.

The syntax support and highlighting in PhpStorm goes without saying, but PhpStorm also comes with a quick-fix to reduce redundancy when the ?? operator occurs:

null_coalesce_assign_quick-fix

Spread operator in arrays

PHP has already supported argument unpacking (AKA spread operator, AKA ...) since v5.6. In its upcoming version, PHP will bring this operator into array expressions, and PhpStorm 2019.2 will support this as well:
spread_operator_in_arrays

Behind the scenes, PhpStorm also checks for correct usage of the operator and makes sure you are unpacking only arrays and traversables and not doing anything that is not supported by the PHP interpreter: spread_operator_in_arrays_inspections

Preserving cookies in HTTP client

PhpStorm’s HTTP client allows you to write and send requests right in your editor and save them as files with the .http extension, so that you can run them later or share them with your colleagues as test cases or API documentation. Moreover, you can write a chain of multiple requests in a single file and in this way describe some scenarios of interaction with API.

One missing feature was support for Cookies. Let’s say you’ve made one request to authenticate on the service and in subsequent requests you would like to call some endpoints that require additional permissions. Previously, you would lose the authentication cookie from the first response. Now this is fixed! PhpStorm will keep all the cookies for you and transfer them in the next requests.

http-client_cookies

To learn more about the capabilities of the HTTP client, see this tutorial.

More info in Project View

We have added the option to display more info about the files in the Project View. Toggle In-place Descriptions under the View menu to get a preview of the file size, and date and time modifications.

project_view_info_crop


For the full list of changes in this build, including both bug-fixes and improvements, consult the release notes.

Please report any problems to our issue tracker, or by commenting on this post. Your feedback is much appreciated! Remember, the most active EAPers will get a prize from us!

Your JetBrains PhpStorm Team
The Drive to Develop

This entry was posted in Early Access Program and tagged , , , . Bookmark the permalink.