PhpStorm 2019.2 EAP #3

The third build of the PhpStorm 2019.2 EAP (192.4787.17) is now available!

With this build you can try the following new features: PHPT support, new intentions in String Juggling Toolbox, Method Breakpoints via gutter, shell scripts support, automatic suggestions of related files while you commit to a VCS.
As usual, all the updates from Web, DB, and the IntelliJ Platform are included!

Download PhpStorm 2019.2 EAP from the EAP page or via the JetBrains Toolbox App. Or, if you have the previous PhpStorm 2019.2 EAP build (192.4488.6) installed, you should soon get a notification in your IDE about a patch update.

PHPT support

Looking to contribute to the PHP interpreter source and join the PHP Internals core team? That could be a tough task if you don’t know C well. The best way to start contributing to any open source project is to write documentation or add tests! Fortunately, for the latter, you only need to know PHP. Tests for PHP are written in special .phpt files, which are basically a set of PHP scripts and additional information divided into several sections.

Well, PhpStorm 2019.2 comes with support for .phpt files!

  • Highlighting for sections and scripts
  • PHP and INI languages auto-injection to corresponding sections
  • Completion of section names
  • Jump to files referenced in EXTERNAL sections

phpt_support

Please let us know what you think and report new issues for missing PHPT features or any bugs you find!

Learn more about writing tests for PHP source in this tutorial by Sammy Kaye Powers. You can also find useful information on PHP TestFest Tutorials, PHP Internals Book, and qa.php.net.

New Intentions in String Juggling Toolbox

PhpStorm can help you with routine string manipulations. Whenever you need to split a string, change quotes, convert interpolation to sprintf call, or maybe concatenation to interpolation – just press Alt+Enter on a string and choose the appropriate action from the list.

In PhpStorm 2019.2, we’re extending this list with a couple more neat additions.
Let’s say you have a long sprintf expression, but you need to replace some substring and make it a parameter. Simply select it, press Alt-Enter, and PhpStorm will choose the correct place for a parameter for you:

string_extract_sprintf_param

The same trick works when you need to extract a part of a string and concatenate:

string_extract_concat

Method Breakpoints via the gutter

As you debug, sometimes you want to find out whether the execution flow goes into a certain function, i.e. whether the function did or did not run. To do this, you had to find the first executable line in a function body and put a breakpoint on it.
Starting with 2019.2, PhpStorm will support method breakpoints, so all you’ll need to do is place a breakpoint on the function declaration line and instead of a round icon you’ll see a rhombus.

method_breakpoints

VCS

Predicting forgotten files

When you’re forming a commit, the upcoming PhpStorm 2019.2 will suggest that you include the files you typically modify, together with the files you’re currently committing.

suggest_related_files

Show history for directory works through Git log

In PhpStorm 2019.2, it will be possible to select several folders in Project View and see all changes in any of these folders. Select the folders you want to check the changes in, and then choose Git | Show History from the context menu.

git_show_history

Support for Shell Scripts

PhpStorm 2019.2 will provide rich editing support for shell scripts, including word and path completion, rename refactorings, code generation (Cmd+N), and a number of live templates (Cmd+J).

shell_script_path

The upcoming PhpStorm 2019.2 includes integration with several external tools to enhance the shell script support even further.
For detecting possible errors in your script, the IDE will prompt you to install the inspection tool named Shellcheck, which can detect a ton of issues and provide quick-fixes for them.

shell_script_schellcheck

PhpStorm 2019.2 will also integrate with the external formatter engine known as mvdan/sh. When you invoke the Reformat Code action for the first time, the IDE will suggest installing this tool, and once that’s done PhpStorm will properly format your shell script.
The upcoming release of PhpStorm will have integration with the Explainshell website. Starting with this EAP build, you can select a command in the editor and press Alt-Enter on it. The IDE will then take you to Explainshell where you’ll find a detailed explanation of the selected command.

shell_script_explain


For the full list of changes in this build, including both bug-fixes and improvements, see the release notes.

Please report any problems to our issue tracker or comment on this post. Your feedback is much appreciated!

Your JetBrains PhpStorm Team
The Drive to Develop

Posted in Cool Feature, Early Access Program | Tagged , , , , | Leave a comment

PhpStorm 2019.2 EAP #2

The second build of the PhpStorm 2019.2 EAP is now available!

This build delivers on-the-fly detection of duplicates, supports preserving cookies in HTTP client, and can show more info in project view. It also improves PHP 7.4 support, including arrow functions, spread operator in arrays, and null coalesce assignment.
And, as usual, the build incorporates all the latest improvements from the IntelliJ Platform.

Download PhpStorm 2019.2 build 192.4488.6 on the EAP page or via the JetBrains Toolbox App. Or, if you have the previous PhpStorm 2019.2 EAP build (191.4738.10) installed, you should soon get a notification in your IDE about a patch update.

Note: Menu action Check for updates… for macOS users might not work due to a bug in the previous build. Users should either redownload installer manually or trigger update via check from Preferences | Updates, or using Find Action.

Locate duplicates on the fly

It’s been a while since we added this feature, accessible via Code → Locate Duplicates. It can help you eliminate duplicates and make your code more concise and stable. If you’ve never used it, you definitely should because it’s truly surprising how many duplicates an average codebase usually contains!

This PhpStorm EAP build takes the duplicate analysis to an entirely new level by allowing you to spot them on the fly. Now, if you stumble upon an existing duplicate, or somehow create one, either by writing new code or pasting a piece of code, you will know it instantly:

duplicate_on-fly_crop

The analysis comes with an intention action to let navigate to the duplicates or display them in a tool window:

duplicate_on-fly_actions

These are good candidates for an Extract refactoring, by the way.

The new inspection is called Duplicated code fragment and is enabled by default. To toggle it, go to Preferences | Editor | Inspections | General. You can adjust the relevant settings under Preferences | Editor | Duplicates. And, of course, you can run it on the entire project (or custom scope) anytime via Code → Run Inspection by Name.

PHP 7.4 Support

The first Alpha release of the new PHP version is expected on June 6. Check out all the awesomeness that it will bring in the PHP 7.4 overview post!

Meanwhile, we are regularly adding support for new language features in our EAP builds.

Typed Properties

In addition to parser support, type resolving, and the related quick-fix, we’ve added type checks in this build. Now PhpStorm will help you keep your codebase safe, and the new inspections will highlight the type violation in the editor:

typed_properties_inspection

The inspection will also check if the default values match the declared type:

typed_properties_default_value

??= (null coalesce assign) operator

The new shorthand assignment operator with a check for null is quite handy, especially when you have some long variables or statements. It allows you to reduce noise and keep the code clean.

The syntax support and highlighting in PhpStorm goes without saying, but PhpStorm also comes with a quick-fix to reduce redundancy when the ?? operator occurs:

null_coalesce_assign_quick-fix

Spread operator in arrays

PHP has already supported argument unpacking (AKA spread operator, AKA ...) since v5.6. In its upcoming version, PHP will bring this operator into array expressions, and PhpStorm 2019.2 will support this as well:
spread_operator_in_arrays

Behind the scenes, PhpStorm also checks for correct usage of the operator and makes sure you are unpacking only arrays and traversables and not doing anything that is not supported by the PHP interpreter: spread_operator_in_arrays_inspections

Preserving cookies in HTTP client

PhpStorm’s HTTP client allows you to write and send requests right in your editor and save them as files with the .http extension, so that you can run them later or share them with your colleagues as test cases or API documentation. Moreover, you can write a chain of multiple requests in a single file and in this way describe some scenarios of interaction with API.

One missing feature was support for Cookies. Let’s say you’ve made one request to authenticate on the service and in subsequent requests you would like to call some endpoints that require additional permissions. Previously, you would lose the authentication cookie from the first response. Now this is fixed! PhpStorm will keep all the cookies for you and transfer them in the next requests.

http-client_cookies

To learn more about the capabilities of the HTTP client, see this tutorial.

More info in Project View

We have added the option to display more info about the files in the Project View. Toggle In-place Descriptions under the View menu to get a preview of the file size, and date and time modifications.

project_view_info_crop


For the full list of changes in this build, including both bug-fixes and improvements, consult the release notes.

Please report any problems to our issue tracker, or by commenting on this post. Your feedback is much appreciated! Remember, the most active EAPers will get a prize from us!

Your JetBrains PhpStorm Team
The Drive to Develop

Posted in Early Access Program | Tagged , , , | Leave a comment

PhpStorm 2019.2 Early Access Program is Now Open

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

PhpStorm 2019.2 EAP

We are planning to deliver a number of cool features, performance and stability improvements, as well as bug-fixes in version 2019.2.

In the current build, you’ll find long-awaited RegExp injections, PHP 7.4 Typed Properties, Support for cURL format in the HTTP client, EditorConfig support out of the box, new look for inspection tooltip, a bunch of bug fixes, and lots of other improvements for PHP and the Web. The update incorporates all the latest improvements from the IntelliJ Platform as well.

Download PhpStorm 2019.2 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 to try the latest features.

Regular Expression Injections

RegExps are an extremely useful tool for searching and replacing in strings. They are heavily used with PHP, but in PhpStorm regular expression patterns were not highlighted by default and they appeared just like plain text. While you could use language injections and get highlighting, it was still awkward to do that manually all over the code.

Well, PhpStorm 2019.2 is going to deliver full support for RegExps in PHP and automatic injections! This means that whenever your code uses preg_* functions, the pattern will be highlighted and verified for correctness.

regexp_highlightning

Moreover, you can now test your patterns right in the IDE! Move the cursor over the pattern and press Alt-Enter to see the quick action Check RegExp.

regexp_check

PHP 7.4 Typed Properties

PHP 7.4 is going to be the most amazing and feature-rich release since PHP 7! Check out all the accepted features. And PhpStorm will definitely provide support for all of them in its 2019.2 release.
In this first EAP build, we’ve implemented support for Typed Properties. This includes highlighting and resolving. Type checks inside IDE are coming soon too.

To help migrate your code to PHP 7.4 and improve code quality with typed properties, PhpStorm has a special quick-fix for you. Put the caret over a property without a type, press Alt+Enter, and then choose Add declared type for the field. PhpStorm will detect the type automatically based on the PHPDoc, default value, or argument typehint.

typed_properties

In the next builds we will add support for all the rest features and help you with migration, so stay tuned!

Support for cURL format in the HTTP client

Most web development tools nowadays provide a “Copy as cURL” command so that you can “replay” the request and see how it works. The same cURL-based syntax is also often used in examples in documentation such as https://developer.github.com/v3/. Also, automated documentation tools like Swagger-UI for OpenAPI show the full request in cURL syntax when executing an example.

Although PhpStorm’s HTTP client is text-based and provides completion for all the headers and stuff, wouldn’t it be nice if you could import cURL request in one click? Easy! Just create a new .http file or a HTTP-request scratch file, and then paste a cURL string. It will be automatically converted to a full request. Then, feel free to play around with request params, headers, or body.

http_client_curl_format_short

To learn more about HTTP client capabilities, check out this tutorial.

New look for inspection tooltip

PhpStorm analyzes your code to detect potential and actual problems, and then provides you with quick fixes that can optimize your code or fix the errors. You can see a list of all the possible quick fixes by pressing Alt-Enter or by clicking on the light bulb icon.

With this upcoming release, we’ve made these quick-fixes more discoverable, as we’ve updated the inspection tooltip so that now it not only displays the problem description but also instantly provides you with the first available fix.

To apply the first suggested fix use Alt-Shift-Enter or the standard Alt-Enter to see all the available quick fixes.

inspection_tooltip

EditorConfig support out of the box

Putting an .editorconfig file in the root of your project helps maintain consistent coding styles for multiple developers working on it across various editors and IDEs. The standard includes a bunch of properties that you may specify and customize.

Previously, you had to make sure that all developers in your team installed the EditorConfig plugin in PhpStorm, but in 2019.2 it comes bundled and works with no additional steps.

editorconfig

JetBrains Runtime

By default, the upcoming PhpStorm 2019.2 will come bundled with JetBrains Runtime 11 (the fork of OpenJDK 11 with fixes from the JetBrains team). This transition addresses a range of issues and hopefully will make your experience with our IDEs much more pleasant.
However, builds with JBR8 are still provided on our site for your convenience as a fallback in case of regressions.

Statistics Sending Change

In Early Access Program, we are enabling sending usage statistics by default. This means that we’ll be receiving anonymous data about features and plugins used, configuration, etc. This will not include personal data or any sensitive information, such as source code or file names. The data sent complies with the JetBrains Privacy Policy. You may disable this at any time under Preferences | Appearance & Behavior | System Settings | Data Sharing.
Note: This change affects EAP builds only. In a stable release the data sharing will remain OFF by default.


This release brings a lot more, and we will describe other notable changes in subsequent posts, so feel free to subscribe to updates via RSS, Twitter, or Facebook!

The list of all the changes we’ve made, including the full list of bug-fixes and all improvements, is available in the release notes.

Please report any problems to our issue tracker, or by commenting on this post. Your feedback is much appreciated! Remember, the most active EAPers will get a PhpStorm Elephpant from us!

Your JetBrains PhpStorm Team
The Drive to Develop

Posted in Early Access Program, Newsletter | Tagged , , , , | 4 Comments

A big shout-out to PhpStorm 2019.1 EAP evaluators!

An important part of our release cycle is the Early Access Program. It lasts for around 6-8 weeks, during which, we publish a fresh build each week with all the newest features we’re currently developing. Any PHP developer can download and use EAP builds for free. We really appreciate you using them and giving us your feedback. It is because of this that we are able to find and fix issues, and make PhpStorm better for everyone!

Let me just please take a second to say a big thank you to all the people, who have shared their product experience, feedback, and suggestions with us. Every insight we get from you helps us deliver to you an even better IDE with each release and EAP build!

Previously, as a token of our gratitude, we presented the most active evaluators with a free 1-year subscription for PhpStorm and a limited edition t-shirt.

This time we have something a little bit special for you! We are producing an exclusive PhpStorm elephpant! It is still work-in-progress, but it should be ready very soon. For now, check out some of the first mock-ups of the iconic PHP mascot in a PhpStorm flavor:

PhpStorm Elephpant Mock-up

Meet the wonderful people who have contributed their feedback to help us create an even better PhpStorm and became the most active EAPers of 2019.1 release:

  • Thomas Schulz (YouTrack username: Thomas.Schulz)
  • Dan Wilks (YouTrack username: dwilksatintacct)
  • Ivan Shcherbak (YouTrack username: funivan)
  • Tomáš Fejfar (YouTrack username: Tomáš_Fejfar)

Thank you so much, folks!, You’ll be the first people to get your hands on a PhpStorm elephpant!

Would you like to get one for yourself? This week we are going to start the Early Access Program for PhpStorm 2019.2. Please send your feature requests, bug reports, and suggestions by dropping us a request in our Issue Tracker, by tweeting us at @PhpStorm, or just by commenting in the blog. 🐘❤️

Your JetBrains PhpStorm Team
The Drive to Develop

Posted in Early Access Program | 9 Comments

Twig and Blade templates debugging

In PhpStorm 2019.1, we’ve implemented debugging of Twig and Blade templates.

The problem was that template files are not the files your application runs. They are first compiled into regular PHP and saved to a cache directory, and then the application runs those compiled files.

So before PhpStorm 2019.1, your only option was to identify the compiled file, something like b84f5d6c0f0d85bb9187843.php, locate the line you want to place a breakpoint on, and then debug this file instead.

Luckily, things have changed, and you can now debug your template files directly – there’s no difference between them and regular PHP files in this regard.

To start debugging your templates:

  1. Set up your PHP debugger.
  2. In PhpStorm, go to Settings/Preferences | Languages & Frameworks | PHP | Debug | Templates and specify the directories where your compiled files are stored:

    templates_directories

In the case of Twig, you also need to set the following configuration options:
debug: true
auto_reload: true

In the case of Laravel, just make sure you’re using version 5.8 or later, and you’re good to go.

Now, set a breakpoint directly in your template file, just like you would with a PHP file, and begin step debugging!

twig_breakpoint_hit

New to debugging in PhpStorm? Check out the Ultimate Debugging Guide or this Quickstart video on getting started with debugging in Docker.

Your JetBrains PhpStorm Team
The Drive to Develop

Posted in Cool Feature | Tagged , , , | 2 Comments

PHP Annotated Monthly – May 2019

PHP Annotated Monthly

Greetings everyone,

Please welcome the May edition of PHP Annotated Monthly. Inside we have all the latest news and material from the world of PHP. Read all about the PHP updates, Codeception, WordPress, and other releases. PHP 7.4 is shaping up with a few new RFC proposals accepted including arrow functions, Zend Framework becomes Laminas, news from Laravel, Yii, and Symfony, some async PHP stuff, useful tools, and a whole lot more!
Continue reading

Posted in PHP Annotated Monthly | Tagged , , , , , , , , | 3 Comments

PhpStorm 2019.1.2 is released

PhpStorm 2019.1.2 build 191.7141.52 is now available!

In this second minor update for the PhpStorm 2019.1 we are happy to bring you support for Composer via Docker. This release also contains a Blade templates debugging fix, and a bunch of other bug fixes and improvements for PHP, the Web, and includes all the latest improvements made to the IntelliJ Platform.

Continue reading

Posted in Release Announcements | Tagged , , , , , | 7 Comments

PhpStorm 2019.1.2 Preview 191.7141.35

We’re close to releasing PhpStorm 2019.1.2, the second minor update for PhpStorm 2019.1, and today we have another preview build for you. Please give PhpStorm 2019.1.2 Preview build 191.7141.35 a try and share your feedback with us.

This update brings support for Composer via Docker and has bug fixes and improvements for PHP, support for the Web, and enhancements from IntelliJ Platform.

Support Docker for Composer execution

PhpStorm has support for PHP interpreters via Docker and Docker-compose, but it still missed Composer integration with Docker. You needed a local PHP setup in order to run it. But this might differ from the one you have in your containerized dev environment, or you might not even have a local PHP interpreter at all.

In this build, you’ll be able to run Composer via any Docker image (WI-45865).

Under Preferences | Languages & Frameworks | PHP | Composer you can find a new Docker radio button option, where you’ll be able to configure the Docker server if needed (this is not a PHP server), as well as provide an image, the Composer executable name, and container options:

composer-via-docker

This feature is a subset of a broader request to support Composer via any remote PHP interpreter (WI-23544). According to the survey, the main use-case is Docker, which is why we started with this first. We would like to hear from you on how you like the current implementation and then based on this feedback we will try to improve and expand it to all use-cases.

Other notable changes:

  • Fixed: Cannot type characters that require AltGr (IDEA-209426 +156)
  • Fixed: Node.js: The tool window clear buffer icon (garbage bin) is gone (WEB-37992 +5)

See the full list of bug-fixes and improvements in the release notes.


Download PhpStorm 2019.1.2 Preview build 191.7141.35 for your platform here:

Or simply click Update in your JetBrains Toolbox App.

We appreciate you reporting any bugs and feature requests to our Issue Tracker.

Your JetBrains PhpStorm Team
The Drive to Develop

Posted in Cool Feature | Tagged , , | Leave a comment

Reworked Imports & Code Cleanup

In 2019.1 release, we’ve reworked the inspections and intention actions related to importing namespaces and using FQN. We’ve also added some PHP-specific intentions to the Code Cleanup tool, which will help you automatically run safe transformations on the whole project or a part of it.

Continue reading

Posted in Cool Feature | Tagged , , , , , | Leave a comment

PhpStorm 2019.1.2 Preview 191.7141.5

Every week brings you a fresh update to PhpStorm, and this one is no exception. Meet the preview for PhpStorm 2019.1.2! Try PhpStorm 2019.1.2 Preview build 191.7141.5 and share your feedback with us.

This Preview build brings with it important bug-fixes, performance and usability improvements, and regression fixes.

Notable updates:

  • Blade debug: Support new format of Blade debug info (WI-46191 +1)
    Laravel 5.8.11 has modified the Blade debug info format, so you’ll need to update PhpStorm to the current build to bring debugging Blade templates experience back.
    Thanks a lot to the Laravel community for help with this issue!
  • Fixed: Pieces of code disappear after formatting when using PHP 7.3 HEREDOC (WI-45986 +2)
  • Fixed: Wrong indent heredoc false positive for an empty line (WI-46117)

Check out the list of all PHP-related bug-fixes and improvements and the complete release notes with all changes in this build.


Download PhpStorm 2019.1.2 Preview build 191.7141.5 for your platform here:

Or just click Update in your JetBrains Toolbox App.

We appreciate you reporting any bugs and feature requests to our Issue Tracker.

Your JetBrains PhpStorm Team
The Drive to Develop

Posted in Cool Feature | Tagged , | Leave a comment