What’s New in PhpStorm 2018.3

Experience The Drive to Develop with the third major update for PhpStorm in 2018.

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

PHP Language

Inline function/method refactoring

Inline function/method refactoring

Using the method’s body in your code can sometimes be more practical than using the method itself, in which case you will need to replace the calls to the method with the actual method’s content. This can be tricky in some cases since you'll need to handle multiple function calls, maintain proper variables' scopes and default values, and reformat the resulting code. The new Inline refactoring will help you with all of the above.

Refactor your code to functional style

Refactor your code to functional style

To help you easily migrate your code between the imperative and functional coding styles, PhpStorm 2018.1 introduces several new inspections and quick fixes. These will convert loops into the array_map, array_filter and array_fill function calls, and vice versa. Only the equivalent transformations are performed, and the logic of your code does not change.

Configurable unchecked exceptions

Configurable unchecked exceptions

PhpStorm 2017.3 introduced a new exception analysis engine that can catch unhandled exceptions, detect missing @throws tags, and so on. To add the sometimes needed configurability, in PhpStorm 2018.1 we’ve added the list of exceptions to be excluded from analysis.

Tests

Creating class from test

Creating class from test

With TDD becoming more and more popular, the situations are pretty common, in which the test is already in place, but the covered class does not exist yet. To handle such situations, PhpStorm 2018.1 will help you generate a class together with the class methods from an existing test. PhpStorm will also take your PSR-0/PSR-4 structure into account to generate the target class and the class methods in their respective locations.

Codeception: code coverage

Codeception: code coverage

We’ve heard your requests for implementing code coverage for Codeception. It’s implemented in PhpStorm 2018.1, and it works exactly like PHPUnit coverage. You will see the coverage results in the Project view as well as in the code editor’s left gutter: the covered code lines will be indicated with the green markers, while the uncovered lines – with red markers.

HTTP Client

Assertions support

Assertions support

Working with responses in the HTTP client has been significantly enhanced, too. PhpStorm 2018.1 brings support for assertions and custom JavaScript (ECMAScript 5.1) code that you can run upon receiving an HTTP response. Since the response is treated as a JavaScript object, you can quickly get access to all its details. You can also create tests that will assert that the request returns what is actually expected. The test results will be displayed on the Test tab, allowing you to navigate to the originating request and re-run a test.

Simplified first start

Simplified first start

PhpStorm 2018.1 will help you jump-start the new HTTP client and migrate from the now-deprecated GUI-based REST client. Live Templates will allow you to quickly insert a request skeleton without much typing; the collection of the most frequently used requests will provide examples useful requests examples. The default HTTP request template is now non-empty and contains some clues for a quicker start, too.

Web Technologies Support

Reformat with Prettier

Reformat with Prettier

With the new Reformat with Prettier action (Alt-Shift-Cmd/Ctrl-P), you can now format the selected code, a file or a whole directory using Prettier. Note that Prettier should be installed as your project dependency or globally on your machine.

Create new Vue project

Create new Vue project

You can now create new Vue projects in WebStorm using Vue CLI. Install it by running npm install --g vue-cli, then press Create New Project – Vue.js on the IDE’s Welcome screen, and answer questions about the template and tools you want to use in your new project.

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.7 support and Surround with type guard quick-fix for unresolved properties, Extract Vue component intention, debugging React Native apps, new Node.js Debugger Console and other.

IDE Improvements

Partial commits in Git

Partial commits in Git

With the support for partial Git commits you can now commit only selected changes from the file. Use checkboxes in the diff view of the Commit Changes dialog to select chunks of code you want to commit. You can also add changed lines of code to a new changelist using actions on the editor gutter and then commit the changelist.

Database Tools

Improvements in Database tools

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

  • Data editor SQL log
  • Now you can tell PhpStorm how to switch schemas: Automatic, Manual, Disabled
  • External schemas in Redshift and virtual schemas in Exasol

Other improvements:

  • Goto Symbol navigation improvements
  • Hierarchy checks for class aliases
  • Gutter icons for running tests
  • New Composer actions
  • Better @covers support
  • New Documentation UI
  • Better HiDPI support on multiple displays for Windows
  • Improved XDebug Profiler viewer
  • Reworked focus subsystem
  • Open Terminal in a specific folder