In the 5th build (193.4386.20) of the PhpStorm 2019.3 EAP, we’re introducing MongoDB support in DB tools, quick-fixes for the numeric literal separator of PHP 7.4, and last but not least, support for the PSR-12 code style standard.
As usual, the EAP builds of PhpStorm are free to use within 30 days of the build date.
Numeric Literal Separator
The human eye is not optimized for quickly parsing long sequences of digits. Now, when you use PHP 7.4 in PhpStorm 2019.3, you will be able to quickly add visual separators to make numbers easier to read and prevent unintended mistakes.
If you see some long number, place the caret over it, press Alt+Enter and select Add number separators. This will add an underscore ‘_’ between every 3 digits for decimal numbers, and every four digits in hex, binary, and octal:
PSR-12: Extended Coding Style
This new PSR-12 standard supersedes the old dear PSR-2, adapting it to all the new language features that we’ve got in the last years, and cleaning up a few inconsistencies. Kudos to PHP-FIG for this great update! If you’ve been using PSR-2, check out what has changed in PSR-12.
PhpStorm 2019.3 comes with a predefined PSR-12 code style, and the IDE will suggest that you switch to it. You can always switch manually with the Set from… action under Preferences | Editor | Code Style | PHP:
Some PSR-12 rules are added as inspections which are off by default, but PhpStorm suggests to turn on the inspection when you choose the PSR-12 code style. You can adjust the inspections as appropriate, under Preferences | Editor | Inspections in PHP | Code Style | PSR-12:
After this, you can reformat code in the editor by pressing Cmd+Alt+L:
Or you can have PhpStorm run it automatically on the cleanup stage before a commit:
Finally, the day has come for us to start working on MongoDB support. We’ll begin by including some basic functionality. Here’s what we’ve got for you so far.
You can view collections and fields in the database explorer. PhpStorm will fetch the first 10 documents from each collection to get information about the fields.
Open any collection or observe the query result, and sort by columns or filter the values. Paging works as well.
You can run queries and get results by selecting it and pressing Ctr/Cmd+Enter, or by using the Play button on the toolbar.
Please keep in mind that this is still a work in progress. There are some known limitations: no coding assistance for now, and no integration with MongoDB shell, so only a limited number of MongoDB functions can be executed.
Rest assured though that we will extend this functionality in our future releases. The EAP stage is the best time to provide your feedback, so please comment here or report any issues in our tracker.
For the full list of changes in this build, please see the release notes.
Please report any problems to our issue tracker or comment on this post. Your feedback is much appreciated!
Check out the previous EAP blog posts for more features:
- PhpStorm 2019.3 Early Access Program is Now Open
- PhpStorm 2019.3 EAP #2
- PhpStorm 2019.3 EAP #3
- PhpStorm 2019.3 EAP #4
Your JetBrains PhpStorm Team
The Drive to Develop