PhpStorm 2019.2 EAP #5

PhpStorm 2019.2 is shaping up well and today we have the fifth EAP installment for you. In this build, we’re introducing a new popup-less commit flow for VCS, and an intention action to quickly convert comma-separated lists from a single line to multiline and vice versa.
As usual, it incorporates all the latest updates from Web, DB, and the IntelliJ Platform, too.

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 installed, you should soon get a notification in your IDE about a patch update.

New Intentions

Quickly convert a single line list to multiline, and back

Sometimes you have a long array written on one line, which grows and grows and runs off the screen. Sometimes the function argument names are too long to fit. Or you’ve refactored a method and reduced its list of parameters that were written down on multiple lines. In these kinds of situations, you will probably want to quickly reformat your code so that it either places each item on a separate line or, on the contrary, joins all items into one line.

PhpStorm 2019.2 comes with a neat new intention to do that. Just put the cursor on one of the coma-separate elements in the list, press Alt+Enter, and choose the action you need: “Split comma-separated values into multiple lines” or “Join comma-separated values into a single line”.

split_join_comma-separated_lists

This works anywhere in PHP for arrays, argument lists, and parameter lists.

split_join_params_lists
Continue reading

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

PhpStorm 2019.1.3 is released

PhpStorm 2019.1.3 is now available!

This third minor update for the PhpStorm 2019.1 contains a bunch of bugfixes and improvements for PHP, the Web, and includes all the latest updates for the IntelliJ Platform.

Continue reading

Posted in Release Announcements | Tagged | Leave a comment

PHP Annotated Monthly – June 2019

PHP Annotated Monthly

Greetings everyone,

Please welcome the June edition of PHP Annotated Monthly, with all the latest news and notable materials from the world of PHP. Read all about the PHP 7.4.0 alpha 1 release, Doctrine company, new and accepted proposals from PHP Internals, Laravel, Symfony, useful tools, and a whole lot more!
Continue reading

Posted in PHP Annotated Monthly | Tagged , , , , | Leave a comment

PhpStorm and YouTrack: We Want Your Feedback

It’s been 10 years since PhpStorm first came out. Back in 2009, it had the working name ‘WebIDE’, which incidentally is why our tickets in YouTrack have the prefix WI-.

PhpStorm has grown tremendously and added many features and subsystems. Still, our team is small and close-knit. Our developers, QAs, and support engineers work together to deliver the PHP IDE to help you craft the best software. But the biggest part of our team is you – our community. Without your feedback, the product would have never become what it is today!

In this post, I’d like to tell you a little about how we manage feature requests and bug reports, and how to submit your feedback so that it will make an impact faster.
Continue reading

Posted in Newsletter | Tagged | Leave a comment

PhpStorm 2019.2 EAP #4

The EAP for the upcoming PhpStorm 2019.2 is in full swing and today we have build number 4 for you to try out. Here are some of the goodies you’ll find inside:

  • Run Composer via any remote PHP interpreter.
  • Syntax highlighting for over 20 different languages.
  • Control PhpStorm-specific code style settings via EditorConfig.
  • Code completion for mistyped keywords and names.
  • Improvements for .gitignore files.
  • Choose columns to show in the VCS log.

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.4787.17) installed, you should soon get a notification in your IDE about a patch update.

Run Composer via any remote PHP interpreter

Just recently, in PhpStorm 2019.1.2, we added support for running Composer via a Docker image. Building on that, we can confirm PhpStorm 2019.2 will be able to run Composer via any remote interpreter configured in your IDE. It can be Docker, Docker-compose, Vagrant, or just a remote server via SSH.

To check out this feature, go to Preferences | Languages & Frameworks | PHP | Composer and select Remote Interpreter.

composer_via_remote

Choose any interpreter in the dropdown or add a new one!

Syntax highlighting for over 20 different languages

Do you have some files in your project in a language other than PHP? In PhpStorm 2019.2, we’re adding syntax highlighting for over 20 different programming languages, including Python, Ruby, and Go. It just works – no additional configuration needed.

With this change, we want to improve the experience of our users who occasionally have to look through some code written in different languages which are not fully supported in PhpStorm. But PhpStorm is still primarily an IDE for PHP and Web developers, so we don’t plan to extend the support for these other languages beyond syntax highlighting.

syntax_highlightning_python_dark

Syntax highlighting for these languages is built using TextMate grammars, and PhpStorm bundles a collection of grammar files for different languages. Currently, they are shipped as part of the TextMate Bundles plugin, so you can see the full list of supported languages under Preferences | Editor | TextMate Bundles.

Code completion for mistyped keywords and names

As you type, it often happens that you accidentally mix up some characters. For example, you’ll type funtcion or fnction instead of function. Now, code completion can understand this kind of typos and will still suggest the most relevant option for you.

fuzzy_completion

This works in all supported languages and for all symbols – keywords, classes, functions, members, and so on.

EditorConfig supports PhpStorm settings and works per scope

In the last EAP build, we announced out-of-the-box support for EditorConfig.

This update brings two major improvements in that area. First, you can set different code style settings for the selected scope. This can be handy if your project is quite big with multiple teams working on it and using different code style conventions. All you need to do is place the .editorconfig file in the root directory of a folder. You can have as many .editorconfig files as you need in a single project.

Second, the IDE will now be able to manage not only EditorConfig standard properties, but also PhpStorm-specific options in the same file as well! The new IDE-specific options will be introduced to cover most of the code style settings, which before could be configured only via UI. These options will have the prefix ij_ to distinguish them from standard EditorConfig properties.

editorconfig

Also, you will be able to create the EditorConfig file from the Project View. Select a directory, call up the context menu, and choose New | EditorConfig. The IDE will provide you with a choice to create a standard EditorConfig file with standard and/or IntelliJ IDEA-specific properties. In this dialog, you can also choose the language options you would like to include in the EditorConfig File.

editorconfig_uncut

VCS

Working with .gitignore

PhpStorm supports .gitignore and highlights ignored files and folders listed in the Project view.
Now, we’re making it a bit easier to add unversioned files to .gitignore. To do this in the Version Control tool window, right-click on a file in the Unversioned files group and select Add to .gitignore.

gitignore_add

Code completion is available for file and folder names in your .gitignore file. Cmd-click on the name to jump to it in the Project view.

gitignore_autocomplete

Hide author, data or hash from Log

The Log view in the Version Control tool window shows you the latest commits made in your project. By default, it shows you the commit message, as well as the author, date, and hash of the commit. Now you can hide the columns you don’t need – click the eye icon and then select Show Columns.

git_show_columns

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 Early Access Program | Tagged , , , , , | Leave a comment

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