PhpStorm 2019.1 Early Access Program is now open

Today we are starting the Early Access Program for PhpStorm 2019.1 (EAP). A fresh build 191.4212.35 is available for download from our website and in the JetBrains Toolbox App.
PhpStorm 2019.1 EAP

We are planning to deliver a number of cool features, performance improvements, and long-awaited fixes in version 2019.1.
In the current build, you’ll find support for debugging Twig templates, fixing code style errors with PHP_CodeSniffer’s Beautifier and Fixer, the ability to sort use statements, a bunch of bug fixes and other improvements for PHP and the Web, and also the latest improvements from the IntelliJ Platform.

Twig debug support

Step debugging is an extremely useful technique that can help you to quickly find bugs, dive deep into the code, and increase your understanding of what’s going on. In PhpStorm, you could debug PHP files for quite some time now. Check out the Ultimate guide on debugging or this quickstart video on debugging with Docker.

However, part of this still remained uncovered – debugging the template engines’ files. The problem is that the template engine source code is usually compiled to the PHP file, and by default, you could only debug those ugly compiled files, not the original templates.

One of the most popular template engines today is Twig. It’s inspired by Python’s Jinja and is now maintained by Fabien Potencier. It is the default template engine in Symfony and Drupal.

As of 2019.1, PhpStorm will come with support for debugging Twig templates!

To start debugging Twig templates you need to perform the following steps:

  1. Setup your PHP debugger.
  2. Configure PhpStorm for Twig debugging by specifying a path to the compiled templates under Settings/Preferences | Languages & Frameworks | PHP | Debug | Twig Debug
    twig-debug-path
  3. Set up the Twig configuration options:

    debug: true
    auto_reload: true

Having done all that, you can set a breakpoint in the original Twig template files with a .twig extension just like you would with PHP-files. And start step debugging!

twig-debug

Since not every line from the original template has a reference in a compiled one, PhpStorm will warn you if the breakpoint you’ve set won’t be caught.

twig-debug-breakpoint-warning

Try it out and let us know how it works for you!

Our next target is Laravel’s Blade. In order to support step debugging of Blade templates, a couple of changes need to be implemented in the view engine. Check out this GitHub issue for the details: https://github.com/laravel/ideas/issues/1480
If you like the idea of debugging Blade templates, please support the above issue with a thumbs-up so we can put this to the top of the pile and deliver Blade support sooner.

Fixing code style with PHP_CodeSniffer

In the PhpStorm 2018.3, we’ve added support for PHP CS Fixer, which allows fixing code style violations automatically. There is an alternative solution called PHP Code Beautifier and Fixer, or simply phpcbf. It comes bundled with PHP_CodeSniffer and lets you automatically fix code style violations, just as you can with PHP CS Fixer. You may want to have a read about how they are different here.

To start right away, add the PHP_CodeSniffer dependency to your composer.json and run composer install. This will automatically populate the Code Sniffer settings under Preferences | Languages & Frameworks | PHP | Quality Tools:

phpcbf-config-cut

Then make sure that the inspection is turned on PHP | Quality tools | PHP Code Sniffer validation under Settings/Preferences | Editor | Inspections.

phpcbf-inspection-config

If you don’t want CodeSniffer to check the JS files, feel free to remove it from extensions list.

Now if you go to any PHP file containing standards violations, you’ll see the warnings highlighting bad lines, just as before. And if you click Alt+Enter on that line, you’ll get an option to fix the problems. This runs over the whole file, fixing all errors in it, it doesn’t matter which line you call the quick-fix.

phpcbf-in-action

Another neat little addition is the possibility to run either PHP CS Fixer or phpcbf during code cleanup via Code -> Code Cleanup… This basically allows you to run fixers on some file, directory, uncommitted files, scope, or the whole project.

Cleaned up default PHP file template

A couple of months ago Freek Van der Herten published a nice write up on configuring PhpStorm’s code generation. He raised a problem that when you create a PHP file, by default it has a comment on the top:

file-template-dirty

We have removed this redundant comment, and as of now, PHP files will be created clean. Feel free to adjust your file templates or set up more of your own ones for your different needs.

Sort use statements

You can now automatically sort all use statements in a file either alphabetically or by length. Adjust the preference under Preferences | Editor | Code Style | PHP tab Code Conversion.

After that, using Code | Optimize Imports will sort them for you.

optimize-imports

Focus mode for PHP

When working on some method in a PHP class, you may want less distraction from the rest of the file. Specifically for such cases, we have added a brand new Focus Mode. This mode highlights the current method or function, leaving all the surrounding text grayed out. This could be useful for presentations, pair programming, or if you just want to concentrate and reduce noise to a minimum.

To turn the Focus Mode on go to View->Enter Focus Mode.

focus-mode

You may combine Focus Mode with Distraction Free Mode for the ultimate deep immersion experience into the code ‍🧘‍♂️.

UPD: Apparently, we rushed to announce and the Focus Mode is not yet available by default in this build. We plan to deliver it to public soon. Hope you liked the demo and sorry for teasing!

This release brings a lot more with, and we will describe other notable changes in subsequent posts, so stay tuned!

Meanwhile, you may want to check out all the changes we’ve made, including PHP-related bug-fixes and improvements in our issue tracker or the full list of changes in the release notes.

Please report any problems to our issue tracker, or in the comments to this post. Your feedback is much appreciated. And the most active EAPers will get prizes from us!


Download PhpStorm 2019.1 EAP build 191.4212.35 for your platform from the project EAP page or click “Update” in your JetBrains Toolbox App.

Your JetBrains PhpStorm Team
The Drive to Develop

This entry was posted in Early Access Program and tagged . Bookmark the permalink.
  • http://funivan.com/ Funivan

    Focus Mode – awesome =)

    • Maxim Kolmakov

      We’re really sorry but we were too fast with the announcement. The action is available only in internal mode. Please stay tuned, it will be available later on.

  • Xan Bertison

    Was hoping 2019 would finally add something to compete with LiveShare and Teletype.

    • Nicolas Bailly

      I realize it’s probably not the easiest feature to implement (and I think it would need to be done upstream by the IntelliJ team), and would not be useful to everyone… But as a lead developer who works with part of the team in a different location, I’m considering switching to VSCode for Live Share alone.

      If you’re interested in this feature please vote here : https://youtrack.jetbrains.com/issue/IDEABKL-708

  • Пётр Белобородов
    • Matthew Hailwood

      Likewise, missing the option.

      • Maxim Kolmakov

        We’re so sorry. We were too fast with the announcement. The action is available only in internal mode. Please stay tuned, it will be available later on.

    • Maxim Kolmakov

      We’re really sorry. We were too fast with the announcement. The action is available only in internal mode. Please stay tuned, it will be available later on.

  • Matthew Hailwood

    Looks like there’s a new “settings import” setup?
    New layout and it refused to import from my 2018.3 settings.

  • Ruud Kamphuis

    I upgraded to 2019.1 but cannot find “View->Enter Focus Mode”?

    • Maxim Kolmakov

      We’re really sorry but we were too fast with the announcement. The action is available only in internal mode. Please stay tuned! It will be available later on.

  • disqus_A206IMJQiP

    Font antialias glitch is back in Mac. Fonts, both in the IDE and the editor, look terrible. Very thin fonts, with bad antialias. Tried to change the antialias settings (subpixel and greyscale) but none solves the problem.

    Here is how it looks like in 2018.3:

    https://uploads.disquscdn.com/images/707e14383e34c6b34e39dd97368e2fb4a04a6a5b8f8fed277d7e247682e95fdd.png

    And here is how it looks like in 2019.1:

    https://uploads.disquscdn.com/images/ffd68237c3ab3cf352f4ddc671ee787b26a45d1f45754c5835fd6d99b99d1cc8.png

    • Mārtiņš Briedis

      Yeah, same first impression. Instant rollback.

    • Dejan Lukić

      Can confirm, same issue

    • Vasiliy Yur

      In fact, there is an identical issue reported on our bug tracker:
      https://youtrack.jetbrains.com/issue/IDEA-206069

      Please feel free to vote and leave your comments there.

  • Vytautas Smilingis

    Tools > Create Command-line Launcher is missing, also not working via shortcut. Is this because its EAP?

    • Vasiliy Yur

      Could you please tell what OS do you have? Is there any chance that you have installed PhpStorm 2019.1 EAP via snaps/toolbox?

      • Vytautas Smilingis

        macOS Mojave 10.14.2 and yes everything installed vie Toolbox

  • Jexy Ru

    This EAP breaks my usual workflow with testing http requests.

    Previously it was natural for me to comment some parameters in json request body – for example, to test the response if some params are omitted, or just to keep in place similar requests by commenting/uncommenting nesessary params.

    It was convenient, as I had no need to keep 100500+ tabs for each request.

    Now there is error “JSON standard does not allow comments” and I receive error response: “Invalid JSON data in request body: Syntax error.”
    I have to open many tabs to put every single request in separate tab.

    • Dmitry Tronin

      Could you please provide an example or attach a screenshot? Tried some requests with comments & it worked fine

  • tecfreelance

    when is version 2019 going to be available?

    • Eugene Morozov

      You mean release? It’s planned for the last week of March.