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.
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.
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
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.
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.
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.
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.
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 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 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.