Experience hyper-productivity with this major IDE update
Manage dependencies with ease: all the actions are now available right in the editor of a composer.json file.
We’ve deprecated the old Manage dependencies dialog because working with the packages from inside the composer.json file is a lot easier.
To add a new package, you can start typing its name in the require(-dev)
section, or
press Ctrl+Space, and choose the one you need from the suggestion
list.
All the available versions of the specific package will be listed, too.
When you start a new project, you can create a composer.json file using the template in the IDE. Right-click in the project tree and select New -> composer.json File.
If there’s a dependency that is specified in composer.json but has not yet been installed, PhpStorm will detect and highlight it.
Install it by pressing Alt+Enter and choosing Update package or Update all packages.
You can use Ctrl+Click on a package to have PhpStorm highlight the folder of that package under the vendor directory in the Project Tree. For files, this will open them in the editor.
The same Ctrl+Click, or Ctrl+B, trick works to open any link in composer.json in a browser.
Each entry in the scripts section has a play icon in the gutter that you can click to instantly run the script.
When adding a new script entry, autocompletion now supports script references, binary files from the vendor/bin directory, and any PHP files from your project source.
In addition to Xdebug, it is now possible to use either a lightweight PHP extension krakjoe/pcov or the built-in PHPDBG to generate coverage reports much faster.
You can create a Run configuration for tests. In the Run configurations settings, there is a dropdown to choose your preferred coverage driver: Xdebug, PCOV, or PHPDBG.
Select your preferred driver, click the Run with Coverage button in the main toolbar, and observe the coverage results.
PhpStorm 2020.1 has tools to help you upgrade to the latest PHPUnit version quickly and easily.
Every deprecation will be highlighted in the editor. Put the cursor over a deprecated item and press Alt+Enter, then select your preferred quick-fix from the list that appears. Or just choose it at the bottom of the error description window.
To quickly create a new PHPUnit test class, you can now use the Create new PHP Test intention by pressing Alt+Enter on a class name.
The core of PhpStorm – the type inference engine – has received a few nice improvements.
If the @var
tag with type info is redundant and PhpStorm already knows
the correct type of the variable, then this tag will be highlighted. You can delete it
with the Remove @var quick-fix by pressing
Alt+Enter.
Tracking nullability is a tough task, and there used to be some places where PhpStorm was unable to detect it. This is no longer the case for the 2020.1 version. PhpStorm lets you know whether a variable is null or not and helps you avoid nullability problems.
There is now a full completion option for parameter variables inside of the closures
that are passed to array_map()
and array_filter()
functions.
If you’re iterating over an array with a known set of items, you no longer need an
additional @var
tag to specify the type, as PhpStorm will propagate it
automatically.
We introduced machine-learning-assisted ranking of completion options for PHP back in v2019.3. This feature improves code completion by reordering the elements in the completion popup so that the most relevant items are ranked higher.
By default, ML-assisted completion is disabled. To turn it on, select the checkboxes Rank completion suggestions based on Machine Learning and PHP under Preferences/Settings | Editor | General | Code Completion.
Moving a method from one class to another is now easier, as it can be done with a single atomic action.
Place the cursor over a method and press F6 (or Ctrl+T, 3). Then choose a destination class and you’re done.
If a PHPDoc block has only @param
tags with types, then it can be
completely removed in favor of native type declarations for parameters.
Press Alt+Enter and choose the Remove redundant PHPDoc comment quick-fix.
PhpStorm will highlight any ternary expressions that can be reduced and simplified. And by using a quick-fix (Alt+Enter), you can replace them with a simple equivalent expression.
Using pass-by-reference can lead to unexpected consequences. PhpStorm 2020.1 detects and highlights parameters that are unnecessarily marked as passed-by-reference.
The same works for redundant by-ref values in foreach loops.
There is a way to extend PhpStorm’s “code awareness” by providing additional information in a special file, .phpstorm.meta.php. This area has received several improvements.
Previously, with override()
, map()
, and type()
directives, it was possible to adjust the behavior only of the first parameter of the
functions. In PhpStorm 2020.1 this has been fixed, and it is possible to specify the
index of the parameter explicitly.
If you had to receive some objects via the __get()
magic method, then you
would likely lose type information. Instead of using an @var
or an @property
tags, you can now specify this information in a .phpstorm.meta.php file. This can work
even if the type is not known beforehand.
PhpStorm considers the die()
and exit()
functions, or any
functions throwing an exception, to be terminating calls. But in applications, there
may be some other custom functions that have to be considered as “exit points”, for
example, in debugging functions like dd()
. It is now possible to mark any
function as an exit point.
Metadata assistance already made it possible to retain access to code completion even if you wanted to use an object as an array container for other objects. However, the completion was not available for keys. This has been added in 2020.1.
Last but not least, in the editor you will now see if a behavior has been modified by
the .phpstorm.meta.php file with override()
,
exitPoint()
, or expectArguments()
directives. And since
there can be any number of such metafiles in the project, by clicking the icon, you
will open the one that is used in this specific place.
When developing web applications or API endpoints, you can now easily start debugging without leaving the PhpStorm window.
To do this, create or open an .http file, add a request, and then use the
Alt+Enter intention to run
PHP Debug. This will add an XDEBUG_SESSION
cookie to the request, and it works similarly to the Xdebug browser extension.
All the new features and improvements of WebStorm 2020.1 are available in PhpStorm 2020.1, either out of the box or with free plugins available in the Plugin Marketplace.
Use new smart intentions and inspections (Alt+Enter) to save yourself some time when coding! For example, you can now quickly convert the existing code to optional chaining and/or nullish coalescing, the syntax introduced in the latest versions of JavaScript and TypeScript.
With out-of-the-box support for the Vuex library and the Composition API from the upcoming Vue 3, you can build great Vue.js applications even more smoothly.
With the new Run on save for files option, WebStorm will apply Prettier formatting to all files specified in the IDE settings and edited in the project as soon as you save those files – a file watcher or a third-party plugin is no longer needed.
The advanced proofreading and grammar check plugin Grazie is now available out of the box. Get instant highlighting for typos and mistakes and fix them with a quick-fix action, just like any other errors in code.
Spell checking is enabled by default in markdown files. To get checks in any PHPDoc comments, HEREDOC/NOWDOC strings, or string literals in PHP files, you’ll need to enable it under Preferences/Settings | Editor | Proofreading | Grammar.
In order to get even more profound grammar checks, you can enable Grammar inspection under Preferences/Settings | Editor | Inspections -> Proofreading.
A new LightEdit mode makes it possible to use PhpStorm as a notepad-style light editor to make some quick changes in files without having to open the IDE completely.
To try it, open a file from the command line (see Working with IDE features from command line for more instructions) or from your OS system file manager. And if PhpStorm is not already running, then the file will be opened in LightEdit mode.
It is now possible to open any number of terminal sessions at once and observe the output on all of them simultaneously without switching between tabs.
You can invoke the context menu from the Terminal to create, navigate, and close a split terminal session.
All SSH connections have now been brought into a single place under Preferences/Settings | Tools | SSH Configurations.
This makes it possible to create a connection in one place and then reuse it anywhere in the IDE, for example, in the deployment configuration, for remote PHP interpreter via SSH, or as an SSH terminal.
The light theme is now unified for all operating systems and goes by the name IntelliJ Light. If you’d like to go back to the old theme, you can switch under Preferences/Settings | Appearance & Behavior | Appearance | Theme.
JetBrains Mono is a free and open-source typeface we have developed specially for developers to make reading code easier. And it is now used as the default editor font.
The new Zen Mode combines the Distraction Free Mode with the Full Screen Mode, so that you can dive deep into your code.
To try Zen Mode, go to View | Appearance | Enter Zen Mode.
The Interactively Rebase from Here dialog is now truly interactive and makes it possible to control every aspect of the rebase process:
In order to streamline the commit flow, we’ve developed a new Commit tool window for handling all commit-related tasks. It is enabled for all new users by default.
If you’re an existing user and want to give it a try, select Use non-modal commit interface in Preferences/Settings | Version Control | Commit.
The DataGrip team has made some really cool improvements to the database tools in PhpStorm. Take a look at What’s new in DataGrip 2020.1.
Finally, it is possible to export a query result or a table to Excel file.
Now you can see the results right in the code editor. To try out this feature, check the Preferences/Settings | Database | General | Show output results in the editor option.
The concept of Run configurations is quite familiar to PhpStorm users. In addition to running PHP scripts, Tests, or HTTP requests, it is now possible to execute DB queries too.
@deprecated
are
displayed as .idea
folder and
shared via version control. Open the Run/Debug
Configurations dialog, check Store as project file option.