What’s New in PhpStorm 2019.2

Experience hyper-productivity with the second major PhpStorm update of 2019.

PHP 7.4 Typed Properties

The release of PHP 7.4 is expected at the end of November. PhpStorm is starting to roll out support for it early, so that you have time to test and start planning the migration. The most anticipated feature is probably the new Typed Properties, which PhpStorm 2019.2 already fully supports. New inspections will highlight the type violations, and you can update your codebase using the quick-fix Add declared type for the field. PhpStorm will detect the type automatically based on the PHPDoc, default value, or argument type declaration in a constructor.

Locate Duplicates on the fly

Locate Duplicates on the fly

Having the same code block appear several times in your project can cost you time making changes, or even cause regression bugs if you ever forget to update all the occurrences. PhpStorm helps prevent the creation of code duplicates in your code by highlighting them on the fly so you can easily spot them. Now, if you stumble across an existing duplicate, or somehow create one in your code, you will know it instantly! The new inspection is called Duplicated code fragment and is enabled by default. To configure 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.

Regular Expression Injection

Regular Expression Injections

RegExps are an extremely useful tool for searching and replacing in strings. Now in PhpStorm, you get automatic injections for RegExps in PHP. This means that whenever your code uses preg_* functions, the pattern will be highlighted and verified for correctness. Moreover, you can now test your patterns right in the IDE! Move the caret over the pattern and press Alt+Enter to see the quick action Check RegExp.

Composer via any remote PHP interpreter

Run Composer via any remote PHP interpreter

Previously you had to have a local PHP interpreter to run Composer. The problem with that was the local environment often didn’t reflect the real production setup or there might not even be a local PHP interpreter at all. In PhpStorm 2019.2, you can choose any remote interpreter to run your Composer with: Docker, Vagrant, via SSH, or anything else – you name it!

Go to Preferences | Languages & Frameworks | PHP | Composer, select Remote Interpreter, and choose an interpreter from the dropdown – or add a new one.

Intentions & Quick-Fixes

New Intentions in String Juggling Toolbox

New Intentions in String Juggling Toolbox

PhpStorm comes with multiple intentions Alt+Enter to manipulate strings. There’s a new one for 2019.2.

If you need to introduce a new parameter in a sprintf expression, simply select it, run the Extract selected string part as format function argument intention, and PhpStorm will choose the correct place for a parameter for you. This works for concatenation as well.

Сonvert a single line list to multi-line, and back

Сonvert a single line list to multi-line, and back

According to PSR-2, lines longer than 80 characters should be split into multiple subsequent lines of no more than 80 characters each. So if your parameters list or array has become too long, you can now split it with one-click using the new intention Alt+Enter Split comma-separated values into multiple lines. The reversed intention is also available for cases where you want to combine items into one line.

Intention and inspections for Switch statements

Intention and inspections for Switch statements

It is now possible to add branches faster by copying existing ones and then modify them. You can use Alt+Enter on the body-less case statement and choose Copy ‘switch’ branch. Don’t forget to modify the 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. Also, in PhpStorm 2019.2 if you have a switch statement without a default branch in your code, you can quick-fix this with Alt+Enter too.

PHPT support

PHPT support

The .phpt files can help you write functional tests in a simple way. This format is used to test the PHP core. PhpStorm 2019.2 comes with support for .phpt files, including highlighting for sections and scripts, PHP and INI languages auto-injection to corresponding sections, completion of section names, and jumping to files referenced in EXTERNAL sections.

Docker

Services Tool Window

Services Tool Window

Docker has been moved to the new Services tool window. The goal of this tool window is to provide a single location to view all the connections and running processes. So far in PhpStorm, it includes Docker and Database connections.

Browse Docker container file system

Browse Docker container file system

It is now possible to view the file system of the running Docker container. The file system is displayed in the newly added Files tab.

HTTP Client

cURL format in the HTTP client

cURL format in the HTTP client

Simple as it is, copy the cURL request string from your browser dev tools, documentation, terminal, or anywhere else, and then just paste it to .http file in PhpStorm and see it expanded to a full request! After that go ahead and play around with your request with the power of smart completion.

Preserving cookies in the HTTP client

Preserving cookies in the HTTP client

Let’s say you’ve made a 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 cookies from the first response. But not anymore: PhpStorm now keeps all the cookies for you and transfers them in the next requests.

Web Technologies

As usual, all the features and improvements of WebStorm are available in PhpStorm, either out of the box or with free plugins available from the plugin repository.

Smart intentions for JavaScript and TypeScript

Smart intentions for JavaScript and TypeScript

With the new Propagate to destructuring intention Alt+Enter, you can replace an extra variable with another destructuring. To remove a destructuring completely, use the intention action called Replace destructuring with property or index access.

The IDE will now warn you if a boolean expression in a condition has any unnecessary parts and will suggest simplifying it.

Improved Rename refactoring for JavaScript

Improved Rename refactoring for JavaScript

When you rename a symbol in a JavaScript or TypeScript file, the IDE now groups together dynamic usages and, by default, excludes them from the refactoring. This makes the refactoring more accurate and gives you more control over what exactly should be renamed in the Refactoring Preview tool window.

Better support for Vue.js

Better support for Vue.js

Are you using Vuetify or BootstrapVue in your Vue.js application? Code completion for components and their props from these and other Vue component libraries is now more precise. This was made possible by a new approach we’ve adopted to working with these libraries in the IDE.

Syntax highlighting 20+ languages

Syntax highlighting 20+ languages

PhpStorm 2019.2 provides out-of-the-box syntax highlighting for over 20 different programming languages including Ruby, Python, Go, and others. The highlighting is based on integrated TextMate bundles, so if you need any additional language, feel free to download the corresponding bundle for this language and import it into the IDE.

EditorConfig

EditorConfig

PhpStorm now supports .editorconfig files out of the box! You can have as many of them as you wish. Create them in any folder and the specified code style settings will be applied to the files in that folder only.

In addition to all the standard properties of the EditorConfig standard, you can now also specify PhpStorm-specific code style options. It’s never been easier to define common code-style standards for the whole team.

Shell Scripts

Shell Script support

This release offers rich editing support for shell scripts, including word and path completion, Quick documentation, and even the Rename refactoring. You can also create run configurations for executing shell scripts.

We’ve integrated PhpStorm with several external tools for even more advanced shell script support. From now on, you can use Shellcheck to detect and fix errors in your script, mvdan/sh to properly format your shell script, and Explainshell to get a full description of a command by pressing Alt+Enter.

Version Control

Ignore file handling out of the box

You can now add files to the list of ignored files from either the Project Tree or the Local Changes tab of the VCS tool window. If you prefer editing .gitignore, you can use path completion in the editor.

New commit flow without a dialog

New commit flow without a dialog

PhpStorm 2019.2 brings a big change for projects that use Git or Mercurial. Now you can commit files from the Local Changes tab of the Version Control tool window. There, you can review the modified files and make changes if necessary because the commit dialog doesn’t block the rest of the IDE. To give it a go, select the “Commit from the Local Changes without showing a dialog” checkbox in Preferences | Version Control | Commit Dialog.

Remind about forgotten files

Remind about forgotten files

If you are committing some files and PhpStorm 2019.2 detects that there are other files changed that you often commit together with the currently committed ones, then the IDE will warn you about it so you don’t miss anything.

Customize VCS Log tab

Customize VCS Log tab

Now you can choose which columns you want to see in the Log tab of the Version Control tool window. Click the eye icon, select ‘Show Columns’, and then select the columns you want to display: author, date, or commit hash.

Database Tools

Full-text Search offers comprehensive results

Full-text Search offers comprehensive results

Now you can search for the necessary data even if you don’t know its exact location. Right-click the data source or a group of data sources that you want to search through, and select Full-text Search, or pressCmd+Alt+Shift+F.

The results are filtered to show you only those strings in which the data is found. If you cannot locate the data because there are too many columns, use the text search in the data editor: Cmd+F.

Filtering by a data source available in search and navigation

Filtering by a data source available in search and navigation

Locating an object in the GoTo popup is not easy sometimes, because often there are too many similar items. In PhpStorm 2019.2, you can choose where to search: in a particular data source or in a group of sources. The same works for Find In Path. This is extremely useful if you are looking for source code inside of DDLs of other objects.