What’s New in PhpStorm 2018.3
Experience The Drive to Develop with the third major update for PhpStorm in 2018.
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.
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.
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.
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.
PhpStorm makes it easier to use
sprintf() and prevent common mistakes.
PhpStorm 2018.3 delivers many refactoring improvements and related intention actions:
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.
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.
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.
The quality tools settings have been simplified: you can now configure all supported tools (PHPCS, PHPMD, and PHP CS Fixer) in one place.
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.
All the familiar features in the Git integration, such as update project, commit changes, view diff, and conflict resolution, now work with Git submodules.
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.
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.
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.
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.
PhpStorm now provides code completion for components from Vuetify version 1.1 or later.
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.
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.
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 in PhpStorm have been improved thanks to our colleagues from the DataGrip team:
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!
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.
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.
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.
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.
PhpStorm 2018.2 delivers handy new inspections such as:
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.
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.
Version control comes with the following changes:
Database tools in PhpStorm have been improved thanks to our colleagues from the DataGrip team:
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.
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.
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.
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.
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.
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.
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.
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.
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 in PhpStorm have been improved thanks to our colleagues on the JetBrains DataGrip team: