Hello!
That was the next release of PhpStorm, the third this year. This time, in addition to adding new features and fixing old problems, we paid particular attention to performance, increasing the editor's responsiveness while typing and increasing the speed of some inspections. In addition, we keep in touch with the authors of popular plugins, helping them to make them as quickly as possible.
For the introduction, I think enough. It is worth adding that the article is a free translation of the “What's new” page. You can download the new version from the previous link or via the Toolbox App . As always, a 30-day trial version is available. The full version can be used by the current subscription to PhpStorm or All Products pack, as well as students and developers of open source projects.
Let's go! (Carefully, under the cut 2873.15 Kbytes of pictures.)
From time immemorial, the REST Client plugin comes bundled with PhpStorm. Even if you are not familiar with it, you can imagine its functionality if you have ever used Postman or something similar. We decided to revise this concept and made a REST client working directly with RFC 2616 requests.
You can either insert an existing request into the editor or write a new one. In the second case, auto-completion and refactorings familiar to any IDE user will simplify the work. The generated request can be executed directly from the editor, and there you can see the answer.
All data is stored in text files with the .http
extension, so reference references can be kept in your favorite VCS right next to the code. Parts specific, for example, for a test or combat environment, can be hidden behind variables.
The file comparison utility built into the IDE can be used for server responses. Just run the query several times and select the desired pair.
In more detail and with pictures about the REST client - in our blog , however, in English.
As mentioned in the introductory section, performance improvements have affected editing. In the PHP world, there are often files with thousands and sometimes tens of thousands of lines! We, for example, love to test the speed of PhpStorm on Mpdf.php . This is a nuclear mix of PHP, HTML and JS in one 1 MB bottle (about 40k lines of code). Usually, if something works fast for mPDF, it works fast for everything.
So, in the new version, the delay in displaying characters on the screen was reduced by four times! Those who work with large and huge files should be more pleasant to edit. If you have an OOP project and a file per class, you can only notice a slightly longer battery life. Speaking of the battery: Power save mode not only saves energy, but also speeds up the IDE.
PhpStorm supports most of the innovations of PHP 7.1 since its release, which took place almost a year ago. However, we continue to improve the product to further simplify the use of the new version of the language. This time, the changes affected the Extract interface and Change signature refactorings.
Modifications made by the mentioned refactorings now retain the nullable ( ?
) Label for parameter types and return type. Dialogues, in turn, allow this label to be added or removed.
The dialogue for creating a new class now makes it possible to choose not only from the existing set of types (class, interface or type), but also from the list of user templates.
The new variable ${NAMESPACE}
allows you to substitute the namespace name in the template. Useful in projects that use the PSR-0 / PSR-4 namespace. Also, in all PHPDoc templates, you can now use variables with the current date and / or time.
PhpStorm has long been able to track exceptions thrown. Since 2012, the Missing @throws tag (s) inspection has been offering to update PHPDoc if there is no corresponding tag in it. However, users wanted more. So three new inspections appeared at once: Unhandled exception , Redundant @throws tag and Redundant catch clause .
Inspection Unhandled exception highlights an expression from which an exception may be thrown. The expression should not be wrapped in a try-catch
block, and the exception should not be declared in the overlying function using @throws
. To quickly fix the problem, generate try-catch
or add @throws
.
Inspections Missing @throws tag (s) has long needed a pair. If you can forget to declare an exception, you can forget to remove the extra declaration, right? Redundant @throws tag reports exceptions that, according to the analyzer, are not thrown from the function. PhpStorm offers @throws
with such an exception to remove or update PHPDoc entirely.
Completes the Redundant catch clause list. If an exception is processed inside the catch
block, which is not thrown inside it, this block will be marked as superfluous by the inspection. To eliminate the problem, it is proposed to remove such a block.
Unlike the existing Missing @throws tag (s) inspection, three new ones work with the code much more intensively. Without analyzer refinement, they would slow down the IDE significantly. However, the speed of the new version of PhpStorm almost did not change, and the single Missing @throws tag (s) was several times faster — another example of work on performance.
The new test creation dialog has been extended with templates for the Codeception Unit , Codeception Functional and PHPSpec tests .
The dialogue itself has undergone changes and now allows you to select one or more methods for which stubs should be created.
If you use PHPUnit-annotation @dataProvider
, then you will be @dataProvider
to be able to restart only one test from the fallen set.
In addition, the new PhpStorm allows you to find and generate the missing provider.
Now it is possible to insert different languages ​​between arbitrary tags or inside named blocks. Such “injections” can be created both on the fly and with the help of pre-prepared rules.
In addition, improved formatting of complex structures. In particular, their alignment.
The WebStorm command has improved support for Vue.js. For example, autocompletion and navigation now work for properties and methods of Vue components. The closing brace is automatically added when printing in Vue templates. And also added a collection of snippet , allowing you to speed up the writing of common pieces of code. The new template Vue-file allows you to accelerate the creation of components.
Updated and support for JavaScript. Now for autocompletion of standard objects and methods, JS PhpStorm “under the hood” uses TypeScript declaration files. Due to this, including, improved documentation for methods (it is taken from these files or downloaded from MDN).
New refactoring Pull member up allows you to move the methods of a JavaScript or TypeScript class to a parent class or interface. If there is no “parent” yet, it can be created using Extract superclass refactoring based on the fields and methods of the “child”.
As usual, all WebStorm 2017.3 enhancements are available in the appropriate version of PhpStorm (either out of the box or by installing plugins). In addition to the above, this includes the Extract type alias and Extract interface refactorings for the TypeScript, support for multiple versions of JavaScript in one project, improved Jest integration, updated CSS support, import of styles from ESLint and TSLint, and much more.
The IntelliJ platform has updated support for version control systems, which means that PhpStorm, as one of the IDEs on this platform, has learned to remember its state for each branch and restores it when switching between them.
Additionally, in the Shelf tab, you can now rename change lists, as well as drag them between the Shelf and Local Changes tabs.
PhpStorm can do everything that DataGrip 2017.3 can. In particular: improved database browsing, SQL generation, autocompletion after JOIN
expression, support for SSH tunnels.
And we reworked the Code Style settings page | PHP (getting rid of the Other tab) added the Composer activity log, improved the PHPUnit test run configuration, added the ability to set the field visibility during refactoring ( Code Style | PHP | Code Generation ).
Perhaps this is all that we would like to tell you. But this is not all that was included in the release. A complete list of changes, as always, can be found in our graduation album release notes . Report problems in our tracker , well, or just leave your comments under this post or in our blog .
Thanks for attention!
Team JetBrains PhpStorm
The Drive to Develop
Source: https://habr.com/ru/post/343474/
All Articles