PhpStorm 8 – New Features
Jetbrains is famous for the early access program on the IDEs they make – a pre-release version of the IDE is made publicly available months ahead of release time, so people have time to test it, report bugs and provide feedback. It’s like beta, just not the beta we’re used to today (modern “beta” is a kind of excuse for a product to suck for a long time). After the EAP is done, they move onto beta, fully test the features they’ve implemented and fix bugs, and only then release.
PhpStorm, my personal IDE of choice, and one we’ve covered before, is now approaching version 8 and has had its EAP version available since March 6th, 2014. Let’s take a look at what’s coming through their changelogs and EAP posts and additionally explain the most important features with links and/or clarifications (we won’t be covering bug fixes, read the release logs for those).
Drupal 8 Support and Multiple Cursor
EAP 134.1456 introduced the EAP’s beginning and announced several highly requested features like:
- multiple cursor (see detailed post here)
- Drupal 8 support (see detailed post here)
- Improved formatting of chained calls
- Quick Documentation for live templates
- Local History for selected function, class or method
- New PHP formatting options: Class fields alignment
- Unwrap/remove action for control structures
- New PHP debug feature: Copy array/object value path (in variable context menu)
- Generate multiple getters/setters for a field
- Type inference: instanceof with OR, support for array access via constant
- Advanced AngularJS support (details here)
- Bower integration: search through Bower registry, manage components in the IDE
- RequireJS aliases support
- CucumberJS and Less 1.6 support
- Live templates are now suggested in code completion
- Code blocks automatically indent after closing a curly brace
Find the rest here or on the original EAP post.
PhpUnit 4.0 Support
Two weeks later, EAP 136.1255 introduced the following changes:
- WordPress support (see tutorial here and announcement post here)
- PhpUnit 4.0 support (details here)
- Structural Search and Replace is now bundled
- Constant alignment options in coding style
- Debugging with node-webkit
- Updated Dart and Spy-js plugins
- Autocomplete now suggests the input type=file as well
..and more. To see the full list, see the original EAP post or the release notes.
Another week after the last EAP, 136.1382 came out and support for remote PHP interpreters was added (which allows developers to use PHP interpreters over SSH, running debug and testing tools remotely) – see how to use this here – and full support for PHPUnit via SSH (with multiple configurations) was introduced. Likewise, the WordPress and Composer command line tools can now work with pure executable. For an exhaustive list of these minor changes read the full EAP post or the release notes.
Markdown Support in PhpDoc comment blocks
On April 3rd in EAP 136.1476, a notable new feature was added among others – Markdown support in PhpDoc comment blocks. You can read the details of this implementation, as well as see a demo use case, in this post. Markdown was implemented due to PhpDocumentor’s support of MarkDown as stated here, but it’s fair to say that this goes a bit against the grain and exposes bias towards that particular tool. The main competitor to PhpDocumentor, ApiGen, is missing this aspect.
PHPUnit Coverage on Remote Interpreters
Less than a week after the last EAP, the Jetbrains team released EAP 136.1575, with added PHPUnit 4.0 coverage support for remote interpreters – a feature introduced a mere two EAP versions ago – and drastically improved indexing performance, improving the workflow smoothness on larger projects. Debugging with node-webkit was added, too, and a new text editing shortcut was added in which command/ctrl + backspace deletes until the beginning/end of the line.
New PSR-0/PSR-4 inspections
EAP 136.1672 introduced new inspections for mismatching namespace/name in class path, added further improvements to the @throws annotations from the previous EAP, included a filtered stack trace for PHPUnit and skipped or incomplete tests, added an “Add Field” intention for field assignments in constructors, and more.
On the Webstorm side, grunt now gives feedback on successful or unsuccessful builds, and you can edit JS documentation URLs (up until this point you could only add or remove them). Debugging-wise, breakpoints can now have groups and names, and they’re indicated in the right gutter as well.
Disable Drag & Drop
Mostly a fix edition, EAP 136.1768 adds the option to disable Drag and Drop in Project View – a feature that tends to get quite tedious when using unreliable input methods (trackpads and similar) or when jacked up on too much caffeine :) It also added a Restart button to Grunt’s console and some code folding improvements, allowing you to fold only “if” or only “else” in an if-else block, not the whole thing. Nothing major, in any case, but you can read the rest here.
Auto-create @var declarations in foreach statements
If you’re a stickler for well documented code like I am, you’ll appreciate the changes EAP 138.38 brings. This edition added the option to auto-generate @var declarations for temporary variables in foreach blocks – something I do manually every time I “foreach” just to get autocomplete help when using the variables in the loop. A small but very useful upgrade. A new intention was also added which replaces quotes with NOWDOC/HEREDOC. If you’re interested in bug fixes, see here.
Ability to open remote files by URL from the file that references them
EAP 138.84 was a fix release for a bug in the previous EAP release, and introduced a single useful new feature – files you open by URL can open files they reference in the source. For example, opening a remote URL, the source code of the file will load in the IDE. You can now find resources in said source code (CSS or JS, for example) and have them open by URL too, simply by CTRL+clicking them. The full issue is described here while the full release log is here.
EAP 138.184 was the first EAP to introduce initial Behat support. Tutorials about Behat, the behavior driven development framework for PHP, are coming soon on SitePoint. Behat configurations are configured in the same way PHPUnit’s are.
“Skip Into” was added for XDebug so you can skip certain functions when debugging, type inference for variables that implement ArrayIterator or Iterator was added for foreach loops, some new formatting options, option to collapse certain regions by default, and a new PhpDoc tag: @uses and @used-by, indicating usage of a file so PhpStorm knows, for example, to ask you about it before you tell it to delete it. Read the rest here.
In the next EAP, Behat support was improved further by adding intellisense, intentions to create DocBlocks were added, and an update block was introduced which checks for plugin compatibility before upgrading to a new major version of the IDE – something people had been clamoring for, especially those of us who use dozens of plugins and tend to see them break.
This list is far from exhaustive, but it contains what I consider the most important updates and new features. A new EAP is on its way, and when it’s released this article will be updated accordingly. Which of these features make you the happiest? Are you using the EAP versions and testing the novelties already, or are you more of a stable-release kind of developer?