What’s New in PhpStorm 2019.1

Experience The Drive to Develop with the first major update for PhpStorm in 2019.

Debug Twig and Blade Templates

Debugging is very effective when you face a nasty bug or dive deep into a codebase. But it's a nightmare to go through the machine-generated code of compiled templates. With PhpStorm and Xdebug, you can now do step-debugging in original uncompiled .twig and .blade.php files of these two popular template engines. All debugging benefits are available here: see the context, local and global variables, add watches, run step-by-step, and more!

Locate Dead Code

If you’re dealing with a legacy codebase and want to clean up things, a good way to start is removing dead code. Now PhpStorm detects redundant code and highlights classes, class members, and functions that are probably never used. The Unused declaration inspection takes into account dynamic usages of the code, for example via magic methods. To check the report for the whole project, select Code -> Inspect Code….

Refactorings, Intentions & Quick-Fixes

String Concat To Strintf

String Juggling Toolbox

We’ve added multiple new intentions for manipulating strings. You can now convert string concatenation to interpolation, convert a concatenation or interpolation to a sprintf call, copy a concatenated string to the clipboard, and do many other things. Press Alt+Enter on a string to see the available actions.

VCS Improvements

Remove Unused Variable

PhpStorm 2019.1 introduces a new quick-fix that helps you get rid of the unused variables that appear in assignments’ or closures’ use lists. The quick-fix is smart enough to detect situations when the assignment expression may have side effects.

Move To Class Refactoring

Move To Class Refactoring

With the new Move to Class refactoring, you can transit functions or constants to the Class they logically belong to, and PhpStorm will find and modify all usages for you. You can move multiple functions simultaneously by selecting them in Structure tool window.

Method May Be ‘static’ Inspection

Method May Be ‘static’ Inspection

If a class has a method that doesn't use any instance references, PhpStorm will detect it and offer a handy quick-fix: press Alt+Enter on the method, and make it static. All the usages will be updated automatically.

Docker

Reuse Containers

Docker Reuse Containers

For interpreters based on Docker Compose, you can now choose between docker-compose run or docker-compose exec for executing containers. If you have a heavy container that you don’t want to restart on each test run, you may reuse it by choosing the docker-compose exec option. Or you can use docker-compose run for lightweight containers or those not working in daemon mode (that is, stopping right after they start).

PHP

Improved Autocompletion

With the help of a special file, .phpstorm.meta.php, PhpStorm is now able to suggest arguments and return values better. This is to cover situations when, instead of some simple type like integer or string, you would like to see a certain set of constants suggested. Or if you expect some function to return a certain constant. You can also improve suggestions in PhpStorm for your library or project by providing your own .phpstorm.meta.php file.

Reworked Imports

Improved Imports

We’ve reworked the inspections and intention actions related to namespaces importing and using FQN. The main idea behind them is to avoid qualifiers as much as possible. Now, PhpStorm will let you simply remove a redundant qualifier if possible, or replace it with the corresponding ‘use’ import statement. Also, when you paste some code into a file, PhpStorm will ask to reuse an existing alias.

Code Cleanup

In PhpStorm 2019.1, the Code Cleanup tool comes with PHP-specific intentions: it can optimize full class name occurrences by either adding the ‘use’ statement or removing the unnecessary part from it. It can also automatically fix code style issues with PHP CS Fixer or PHP_CodeSniffer’s phpcbf. Execute a cleanup before VCS commit, or trigger it manually at any time via Code -> Code Cleanup…..

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 in the repository.

Updated docs and browser compatibility

Updated docs and browser compatibility

The documentation (F1) for CSS properties and HTML tags and attributes now shows up-to-date descriptions and information about the browser support from MDN as well as links to the full MDN articles. Also, to check that all the CSS properties you use are supported in the target browser version, you can enable a new Browser compatibility inspection in preferences.

Improved support for TypeScript in Vue apps

Improved support for TypeScript in Vue apps

PhpStorm now leverages the TypeScript language service together with its own TypeScript support for TypeScript code in .vue files. This means you’ll now get more accurate type checking and type info, be able to use the quick-fixes provided by the service, and see all the TypeScript errors in the current file in the TypeScript tool window.

New inspections for Angular apps

For Angular applications, PhpStorm adds 17 new inspections that will help you detect Angular-specific errors in your app as you type, and will suggest appropriate quick-fixes. Working both in the TypeScript and template files, these inspections will check your use of bindings, directives, components, and many other things.

New debugger console

Meet the new, improved interactive debugger console in the JavaScript and Node.js debug tool windows! It now displays objects using a tree view, and it supports styling of log messages with CSS and grouping them using console.group() and console.groupEnd(). You can also filter out any type of log messages.

Convert function with Promise to async/await

You can automatically change a function that returns a Promise with .then() and .catch() calls to an async function that uses the async/await syntax. Simply press Alt-Enter on the name of the function and select Convert to async function. This is possible not only in TypeScript files, but also in JavaScript and Flow.

IDE

Recent Locations

Recent Locations Popup

In this new navigation popup, you’ll find recently visited code points presented with a context – a couple of lines before and a couple of lines after. All the locations are chronologically ordered in this popup, with the last visited location at the top. To call up the new Recent Locations popup, press Cmd-Shift-E / Ctrl+Shift+E. Type in any text to search within the context.

VCS Improvements

VCS Improvements

A new ‘Uncheck all’ checkbox for partial Git commits lets you uncheck all the code chunks at once, and then choose the ones you want to commit. In addition, fixup, squash, and cherry-pick actions are now available right in the Git log.

Improvements in Database tools

Custom UI Themes

If the default white and Darcula themes are not enough for you, try Dark Purple or create a custom one! The color of any element of your IDE, from icons to radio buttons to arrows, is now configurable. Fine-tune everything to your liking and save it as a new theme plugin!

Database Tools

The database tools in PhpStorm have got some cool improvements thanks to our colleagues on the DataGrip team:

  • Support for new databases: Greenplum, Vertica, and Apache Hive
  • Code completion supports combined statements for CREATE and DROP
  • Support for DEFINER attributes in MySQL and MariaDB
  • Support for the Oracle mode in MariaDB
  • You can now set the default folder for a project

Other Improvements:

  • New coloring options for primitive parameter types and class members by visibility. You can configure the color scheme in Preferences | Editor | Color Scheme | PHP.
  • You can now enable soft-wraps in the editor for specific file types. To do this, open Preferences/Settings | Editor | General and specify the file types in the ‘Soft-wrap files’ field.
  • PHPDoc styling configuration is improved: sort use statements, define the order of tags, and customize the number of spaces. To find all the options, go to Preferences | Editor | Code Style | PHP and look for the PHPDoc tab.
Learn about PhpStorm 2018.3

PHP

Doctrine Query Language

Doctrine Query Language

One of Doctrine ORM's key features is the ability to write database queries in DQL, which is a query language for your object model. It means that in your queries, you’ll be using PHP classes’ and fields’ names to fetch or update data. PhpStorm comes with full advanced DQL support. You’ll get all the inspections and refactorings: find usages, rename entity or field, associations support, and even more.

PHP 7.3 Support

PHP 7.3 Support

The latest PHP interpreter update brings with it a lot of new features for the community. PhpStorm supports all of them, including flexible Heredoc and Nowdoc syntax, trailing comma in function and method calls, literals as the first operand of instanceof, and the list() reference assignment.

Ctrl+Dot Completion

Press Ctrl+. in the suggestions list to get the completed item followed by an arrow. You can then type in the method name right away.

PHPDoc Improvements

PhpStorm adds Support for Intersection Types “&. If you annotate a variable as Foo&Bar, then it is of type Foo and of type Bar at the same time. PhpStorm will also suggest members of both classes.

Improvements for formatted string functions

PhpStorm makes it easier to use printf() / sprintf() and prevent common mistakes.

Refactorings and Intentions
Refactorings and Intentions

Refactorings and Intentions

PhpStorm 2018.3 delivers many refactoring improvements and related intention actions:

  • With the Replace with Alias intention, you can now replace use Foo\Bar with use Foo\Bar as Baz, which will also replace all Bar occurrences with Baz. The opposite action Inline Alias is available as well.
  • The new intention Сhange Class Member Visibility allows you to safely switch public/protected/private modifiers of properties and methods.
  • Private name refactoring is improved and by default PhpStorm will search only context usages when renaming private properties.

Deployment

Remote Deployment To Multiple Hosts

Remote Deployment To Multiple Hosts

PhpStorm lets you copy files and folders to a remote server using FTP/SFTP/FTPS, as well as to a local or mounted folder as a destination. Now you can deploy to multiple servers at once by using server groups. Add as many groups as you wish with an arbitrary number of destinations in each group, and deploy to all servers in a group simultaneously in one click.

Quality Tools

PHP CS Fixer Support

PHP CS Fixer Support

Now with PHP CS Fixer support, it becomes possible to automatically fix code style issues. Not only will PhpStorm detect the path to PHP CS Fixer for you, but it will also autodetect your custom ruleset and turn on the corresponding inspection. Go to some file with code style issues, and run quick-fix that will update the whole file at once.

Autodetect non-PSR coding standards for PHP_CodeSniffer

Non-PSR coding standards for PHP_CodeSniffer will be autodetected from your composer.json for the following frameworks: Symfony, Doctrine, Drupal, WordPress, Joomla!, Magento, MediaWiki, Yii 2, and CakePHP.

Simplified settings of quality tools

The quality tools settings have been simplified: you can now configure all supported tools (PHPCS, PHPMD, and PHP CS Fixer) in one place.

Version Control

GitHub Pull Requests

GitHub Pull Requests

You can now work with pull requests inside PhpStorm. Select VCS | Git | View Pull Requests in the menu to open a new tool window with a list of all the pull requests in your project. You can see the description, assignee, reviewers, labels, and changed files from the pull request. See diffs and create a new local branch from pull requests right there.

Support for Git submodules

All the familiar features in the Git integration, such as update project, commit changes, view diff, and conflict resolution, now work with Git submodules.

Ignore whitespaces

You can now ignore or trim whitespaces while merging – the configuration is available in the new drop-down at the top of the Merge Revisions for… dialog. Whitespaces are also ignored by default when you use Annotate for a file.

And even more

Advanced navigation in the VCS log with arrow keys, a parallel fetch of multiple Git repos, better support for pre-commit hooks, and a lot of other improvements are in store.

Web Technologies Support

Autoimports in JavaScript

Autoimports in JavaScript

In JavaScript files, PhpStorm can now automatically add imports not only for symbols defined in your project, but also for symbols from the project’s dependencies. This works as long as the library has sources written as ES modules or a TypeScript type definition file.

Improved Angular support

Improved Angular support

PhpStorm is now much better at helping you edit Angular templates. Сode completion and Go to definition for variables, pipes and async pipes, as well as for the template reference variables, are now much more accurate. In total, over 50 known issues have been fixed in Angular and AngularJS support.

Better 'null' and 'undefined' check

PhpStorm can now better detect situations that lead to a TypeError because a method is invoked on a value that is undefined or null, or it is passed to a function, or its property is used.

Vuetify support

PhpStorm now provides code completion for components from Vuetify version 1.1 or later.

React improvements

In React apps, code completion now suggests all component lifecycle methods. The Unresolved variable inspection will now warn you about any potentially undefined components.


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

IDE

Search Everywhere

New search popup

The new Search Everywhere dialog is a better way to navigate the project and the IDE – search classes, files, symbols, and even actions and settings. Press Shift-Shift to search everywhere, and switch contexts by pressing Tab.

VCS

High-contrast theme

To make PhpStorm more accessible, we’ve added a new high-contrast UI theme. The IDE now allows screen readers to read line numbers, VCS annotations, breakpoints, and other gutter icons. Learn more about screen reader support in the documentation.

Database Tools

Improvements in Database tools

Database tools in PhpStorm have been improved thanks to our colleagues from the DataGrip team:

  • Cassandra database support
  • Many improvements in code completion
  • Support for extensions in PostgreSQL
  • Introduce table alias intention
  • Auto-reconnect after time-outs

Other improvements:

  • Ever struggled with finding variables while debugging? Start typing anything to Search variables in debug.
  • Run configurations for HTTP Requests are now supported and created for you automatically as soon as you run a request.
  • Aliases References In Italic help to distinguish real class names and aliased ones.
  • PhpStorm will autodetect Configuration for Test Frameworks based on the composer.json and dotfiles and automatically create Run Configuration to run tests.
  • You’ll be able to generate setUp and tearDown methods for PHPUnit which are called every time before and after running each test method, respectively.
Learn about PhpStorm 2018.2

Completion

Custom postfix completion templates

Custom postfix completion templates

Postfix code completion has existed in PhpStorm since version 9, but only provided a limited number of predefined templates. PhpStorm 2018.2 takes postfix completion to the next level by allowing you to add custom postfix completion templates. Create templates to match your project and your personal coding style!

FQCN Completion

FQCN Completion

Completion now matches the namespace in addition to the element name. You don’t have to type or invoke completion for each part of \Illuminate\Auth\Events anymore – just type IAuE instead.

Refactorings

Move Instance Method Refactoring

Move Instance Method Refactoring

PhpStorm already has the Pull Up/Push Down and Make Static/Move Static Method refactorings that help you move methods around. For handling the methods that cannot be made static or moved across the class hierarchy, PhpStorm 2018.2 introduces a refactoring that allows for moving an instance method to a parameter class or to a field class. Simply invoke the Move refactoring on a method declaration, and, if the new refactoring can be applied, you will see a dialog prompting you to choose the target class.

PHP Language

Structural Search and Replace

Structural Search and Replace

In PhpStorm 2018.2, we’ve completely reworked Structural Search and Replace for PHP, which offers lots of new capabilities and greatly simplifies patterns creation. Now you can specify the type of Structural variable, which lets you, for example, find a call to the specific method where the first parameter is a string. You can use a simple pattern to find a foreach loop with an unconditional return statement, or even create your own inspection that will capture an unnecessarily double-quoted string, if your code style enforces this.

Improved SQL Injections

Improved SQL Injections

In version 8, PhpStorm introduced basic support for string concatenations in Language Injections. The dynamic nature of the resulting strings and the strictness of the SQL parser caused a lot of false positive errors in SQL. In PhpStorm 2018.2, we’ve eliminated most such errors and introduced some new features, too. PhpStorm can now substitute the values of constants directly within the injected string, so you can run a query without copy-pasting their values. In addition, we’ve added support for SQL strings that use sprintf parameters.

New Inspections and Quick Fixes

New Inspections and Quick Fixes

PhpStorm 2018.2 delivers handy new inspections such as:

  • Extension is missing in composer.json reports usages of classes/functions/constants from PHP extensions which are not specified in composer.json
  • Non-canonical order of elements in PHPDoc reports tags such as @property, @param, @var, etc. that use a non-canonical order of elements e.g. name Type instead of Type name.
  • Optional parameter before required parameter detects situations when an optional parameter appears before required parameters in a function/method declaration.

Web Technologies Support

New JavaScript Intentions

New JavaScript Intentions

To make you even more productive when working with JavaScript and TypeScript, PhpStorm has a bunch of new intentions that are available when you press Alt-Enter. Here are just some of them: Implement interface, Create derived class, Implement members of an interface or abstract class, Generate cases for switch, and Iterate with for..of.

Completion for events in Vue.js

Completion for events in Vue.js

In Vue templates, PhpStorm now provides code completion for events. Event names are suggested after v-on: or if you use the shorthand notation @event. There’s also code completion for event modifiers.

As usual, all the features and improvements of WebStorm are available in PhpStorm, either out of the box or with free plugins available in the repository. Other noteworthy web-related features include TypeScript 2.9 and 3.0 support, the new Code Coverage feature that helps to find unused code, extract and convert React component refactoring, new integrations with Angular CLI, global file watchers, rerun failed tests and other.

IDE Improvements

TouchBar

Updated UI

We’ve rolled out brand new icons and dark title bars on macOS. Furthermore, PhpStorm 2018.2 brings support for the MacBook Touch Bar! Run and debug your project, commit changes, and update the project right from the Touch Bar.

VCS

VCS

Version control comes with the following changes:

  • Easier resolve of merge conflicts
  • Enhancements in VCS Log tab
  • Browse repository at revision
  • Multiple GitHub accounts
  • Skip the Push dialog

Database Tools

Improvements in Database tools

Database tools in PhpStorm have been improved thanks to our colleagues from the DataGrip team:

  • New SQL formatter
  • Source code migrations
  • Query plan diagram
  • Custom data source

Other improvements:

  • Customizable value for $_SERVER['DOCUMENT_ROOT']
  • Simple CodeSniffer/MessDetector setup
  • The new presentation for Quick Documentation
  • Allow renaming old style constructor to the new style
  • New Add @method tag quick fix for Undefined method
  • Add method quick fix now inserts parameter type hints
  • PHPUnit composite configuration
  • Jump outside closing bracket/quote with Tab
  • HTTP Client: Support environment variables in the request body
  • HTTP Client: Support formatting of POST request body
  • Docker: navigate from compose nodes and containers
  • Docker: wrapping words in Docker logs
Learn about PhpStorm 2018.1