PhpStorm 2019.1 EAP #2

PhpStorm 2019.1 EAP build 191.4738.10 is now available!

This build delivers updates for Docker – reusing containers and docker-compose exec support, multiple new intentions for juggling strings, improved autocompletion for function arguments, new inspections and refactorings, Git support improvements, and much more!

You can download it on the website and in the JetBrains Toolbox App. Or, if you have the previous PhpStorm 2019.1 EAP build (191.4212.35) installed, you should soon get a notification in the IDE about a patch update.

Download PhpStorm 2019.1 EAP

If you’re not yet familiar with our Early Access Programs, here are the basics you should know:

  • Every week we publish a fresh build for the upcoming version of PhpStorm.
  • EAP builds provide access to the newest features we’re currently developing.
  • EAP builds are free to use but expire within 30 days of the build date.
  • Important! PhpStorm EAP builds are not fully tested and might be unstable.
  • You can install an EAP build side by side with a stable PhpStorm version.
  • Your feedback is very welcome in our issue tracker: Please don’t forget to mention the build number you’re using.

Docker support improvements

In PhpStorm 2019.1, we’ve made a number of improvements for Docker support. First of all, PhpStorm is now capable of reusing containers!

Earlier, whenever you ran an action via Docker, the IDE would recreate a container, which made the whole process a bit slower. But not anymore! Now all run-configurations will use docker-compose exec or docker-compose up and then docker-compose exec if the service is not yet started.

There are the following limitations:

  • We support docker-compose file version 2.2+.
  • It’s not possible to execute services without daemon entry points (it shouldn’t exit immediately after docker-compose up), i.e. we can run a service based on php:7.1-apache image but we can’t run a service based on php:7.1.
  • The working directory will be always used from the docker-compose file or the image it’s based on.

String juggling toolbox

PhpStorm already has some useful string manipulation actions. For example:
Convert to NOWDOC/HEREDOC syntax:
Replace quotes:
Split string in two strings and concatenation:

You can see them all and run them by calling a quick-fix action on a string: either press Alt+Enter or click the 💡 icon.
We’ve added even more actions now!

Convert string concatenation to interpolation:
Convert concatenation or interpolation to sprintf call:
Copy concatenated string to clipboard:

When you combine this with extract variable refactoring you can do some pretty cool things.

Move to class refactoring for functions and constants

Sometimes you may think that some function belongs to a class. You could move it manually, but that would also mean that you need to manually find and modify all the usages.

The new refactoring does it all for you automatically. Place the caret on the function, press Ctrl+T (Shift+Ctrl+Alt+T on Windows/Linux) and select Move…
With the same way, you can move constants as well.

Check out the many other refactorings available out there in PhpStorm in the documentation
If you like to explore the features on your own, try pressing Ctrl+T in your code and see the available refactorings for the piece of code under the caret.

New inspection: method may be ‘static’

If a class has a method that doesn’t use any instance references, then PhpStorm will now highlight it saying that the method may be declared as static. You then have the option to choose what to do: you can apply a quick-fix and make the method static; you can suppress the warning for the current statement or the whole file; or you can just disable this inspection.

Improved auto-completion for function arguments

Lots of PHP functions expect a specific set of values as an argument. For example, count(): this function accepts an array or a countable as a first argument. However, you could also pass the second optional argument, $mode, which can only be values of predefined constants COUNT_NORMAL or COUNT_RECURSIVE.

In previous versions, PhpStorm would not suggest during auto-completion:

In 2019.1, you’ll see those constants in bold at the top of the suggestions list!

This works for other built-in functions:

And for methods too:

It works based on PhpStorm stubs, which you a very welcome to contribute to and add any missing parts in meta/.phpstorm.meta.php.

Moreover, you may add this kind of argument awareness to your own projects. Basically, you just need to place a metadata PHP file in your project. Let’s say you have the following class:

Now, to help PhpStorm auto-complete method arguments with the correct values, you’ll need to add a file named .phpstorm.meta.php to your project. And then add the following content to it:

Now you’ll have customized completion for the Foo::bar() method arguments:

There is room for many improvement here, and we are planning to work on this in the next iterations. Let us know what you think about this feature!

Version Control Improvements

Fixup and Squash actions in Git log
In the upcoming PhpStorm 2019.1, you can invoke the Fixup and Squash actions from the context menu of the VCS Log tab. These actions help to create commits with the correct fixup! and squash! commit messages.
Cherry-pick a file from a commit in Git log
With the upcoming PhpStorm 2019.1, you will be able to cherry-pick selected files from the commit right out of the context menu in the VCS log.

See all the 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.4738.10 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.
  • Rost

    Very like auto-completion for function arguments.
    But, is it possible to implement similar auto-completion for some functions/methods in “if statement” during result comparison ?
    For Ex: json_last_error function have a bunch of predefined constants, see

    if (json_last_error() === PREDEFINED_CONSTANT_AUTO_COMPLETION ) {}

    • Kirill Smelov

      Thank you for the idea.

      We do have in our tracker similar feature for the return values as well: It should play nice with introduced feature as well as cover your case.
      Please share your insights in the issue if it’s possible.

  • Thomas Klaas

    Improved auto-completion for function arguments looks great,
    but I would prefer to configure my own methods metadata as PHP-doc directly above the method instead adding a new mapping file to configure all my auto completion arguments.

    In this way it even provides information for other users not using the newest PHPStorm or by just looking at the code on github or other repositories.

    • Fabio Chelly

      I agree, same here. Can’t it be done by parsing the PHPDoc above the function instead of using a separate meta file?

      Something like:

      * @param int[0 => FOO_VALUE_1, 1 => FOO_VALUE_2] $baz

      • Kirill Smelov

        Thank you for the suggestions!

        Indeed, we’ve consider an option to implement this feature via PHPDoc as well since it’s have a benefits you described: data will be near the code and no external file is required, but for now we’ve decided to implement the feature via metadata because of the following reasons:
        – It’s EAP and feature is still kinda experimental
        – Updating PHPDocs in source code will be much harder to revert rather than external .phpstorm.meta.php file
        – It’s still not 100% clear, how PHPDocs will evolve in the nearest time (e.g. PSR-5 is still not finished)

        We have an issue for this possibility: It’s suggesting to introduce new PHPDoc tag, but it’s that have to be discussed. Please share your ideas there if you want to :)

        We will continue to look in this direction for possible PHPDoc implementation if feature will become widely accepted and stable, and if so, we’ll provide an automatic way to migrate code from .phpstorm.meta.php to PHPDocs if it will be needed, so stay tuned :)

        • Reindert Vetter

          If this is possible…
          * @param FOO_VALUE_* $baz

  • Thomas Schulz

    Function arguments completion is bugged:

    1) It autocompletes class constants _inside_ string like this: func(”)
    2) It autocompletes global constants as class constants when you use a class with double colon: count($arr, SomeClass::)

    • Kirill Smelov

      Thank you for the reports, we’ll face the issues in the nearest EAP’s.

  • Thomas Schulz

    Function arguments:

    It would be nice to have null and true/false automatically added to completion, when parameter is nullable or boolean respectively.

  • Dotan Cohen

    Still no Focus Mode I see! That is actually one bit of functionality that I’m excited for. It looks very helpful for working with code that is poorly formatted, which unfortunately seems to be most code that I’m inheriting.

    Otherwise, this build is working great. Thank you.

  • David Grudl

    Great news!

    It would be nice if improved auto-completion can be affected by user .phpstorm.meta.php files as well. Like

    • Kirill Smelov

      As far as I can see completion is affected by your file in this project. Could you please clarify what exactly does’t work?

      • David Grudl
        • Kirill Smelov

          I believe it’s not working because you have multiple definitions of Arrays class. I created an issue:, it should be fixed in the next EAP.

          • David Grudl

            You are right!

            But I do not understand why the second occurrence was found in a directory marked as excluded…


          • David Grudl

            It is caused by „Include Paths“. Even if I delete them in settings, they will appear after PhpStorm restart and they cancel exclusion for some subfolders of excluded folder, I don’t know why.