Early Access Program

PhpStorm 2019.2 EAP #5

PhpStorm 2019.2 is shaping up well and today we have the fifth EAP installment for you. In this build, we’re introducing a new popup-less commit flow for VCS, and an intention action to quickly convert comma-separated lists from a single line to multiline and vice versa.
As usual, it incorporates all the latest updates from Web, DB, and the IntelliJ Platform, too.

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

New Intentions

Quickly convert a single line list to multiline, and back

Sometimes you have a long array written on one line, which grows and grows and runs off the screen. Sometimes the function argument names are too long to fit. Or you’ve refactored a method and reduced its list of parameters that were written down on multiple lines. In these kinds of situations, you will probably want to quickly reformat your code so that it either places each item on a separate line or, on the contrary, joins all items into one line.

PhpStorm 2019.2 comes with a neat new intention to do that. Just put the cursor on one of the coma-separate elements in the list, press Alt+Enter, and choose the action you need: “Split comma-separated values into multiple lines” or “Join comma-separated values into a single line”.

split_join_comma-separated_lists

This works anywhere in PHP for arrays, argument lists, and parameter lists.

split_join_params_lists

By the way, here you may need to fix your code style settings. Select the region in which you don’t like the code style, press Alt-Enter, and choose “Adjust code style settings”. For your ease, PhpStorm will offer to update only those settings that affect the selected lines:

adjust_code_style

Intention and inspections for Switch statement

Firstly, it is now possible to add branches faster by copying existing ones and then modifying them. Press Alt-Enter on the body-less case statement and choose “Copy ‘switch’ branch”.
Don’t forget to modify a copied one, because PhpStorm will warn you if a switch block has a duplicated branch, i.e. the same body, which can either be redundant or written by mistake:

switch_copy_branch

Also, PhpStorm 2019.2 if you have a switch statement without a default branch in your code, you can quick-fix this with Alt-Enter as well:

switch_default_branch

VCS

In the status bar, you may have noticed the VCS section. It will usually show the branch name or commit hash where you are right now. If you click on it, you’ll see a list of available branches. Use it to quickly check-out to the branch you need, or create a new one.

vcs_menu

In PhpStorm 2019.2, we’re making a couple of useful improvements here.

Improved Compare Branches action

When you compare two Git branches (by using the ‘Compare with Current’ action from the Git Branches popup menu), the IDE will display a Log tab which will lists all commits that exist in one branch and do not exist in the other.

git_compare_with_current

Show Diff with Working Tree action

One more improvement in this area is that we’re adding a separate action called “Show Diff with Working Tree” to the Git Branches popup. It will provide you with the ability to view the Diff between the current and selected branches.

compare_with_working_tree

Commit from the Local Changes

Let’s say you have made a bunch of changes in files under different folders in your project hierarchy. To commit them, you go to the Local Changes tab in the Version Control tool window. You select the files and then see another popup to type in a commit message. At this point, you’re blocked by the popup and cannot see your project.

The upcoming PhpStorm 2019.2 lets you commit directly from the Local Changes. There is no longer any need to go through a separate Commit dialog!

Now while working on a commit, you will be able to browse through the source code, view the history for a specific file, view the diff for the file in the same area as the commit, and use the other features of the IDE. Previously, all these actions were impossible because the modal commit dialog blocked off all the other IDE functionality.

popup-less_commit-1

If you use Git or Mercurial, there’s an additional perk. When you press the Commit shortcut (Cmd-K), the IDE will select the modified files for the commit and focus on the Commit message field in the Local Changes tab of the Version Control tool window. You will be able to review the selected files and change the file or code chunk.

More commit options will be available under the settings icon on the Commit toolbar; these can be invoked on demand.

popup-less_commit-options

This is a long-awaited feature, but it also affects the current workflow. If you’d like to go back to the original Commit dialog, deselect the “Commit from the Local Changes without showing a dialog” checkbox under Preferences | Settings | Version Control | Commit Dialog.

For the full list of changes in this build, please see the release notes.

Please report any problems to our issue tracker or comment on this post. Your feedback is much appreciated!

Check out previous EAP blog posts for more:

Your JetBrains PhpStorm Team
The Drive to Develop

image description