Phpstorm 2020



2nd note: Xdebug 3 is supported since 2020.3. It still will wok with previous versions, no issues. But Xdebug will complain on old (v2) params that IDE sends + PhpStorm will be showing similar screen (as it checks v2 params only). – LazyOne Dec 13 '20 at 20:58. It is a standalone installation of the complete offline installer of JetBrains PhpStorm 2020. JetBrains PhpStorm 2020 overview. JetBrains PhpStorm is a PHP programming language development environment designed based on the JetBrains IntelliJ IDEA platform and has almost all the functions of JetBrains WebStorm.

PHP 8 Union Types

We have started rolling out support for PHP 8 with support for Union Types. In PHP 8.0 it will be possible to declare more than one type for properties, arguments, and return types. PhpStorm already fully supports this feature and can help you migrate effectively.

Convert PHPDoc to native union types

Union types used to be provided via PHPDoc, and now PhpStorm highlights such occurrences.

With the Alt+Enter quick-fix, they can now be converted into native union types.

This works anywhere that union types are applicable, including function arguments, return types, and properties. For properties, it takes into account default values, too.

Switch Language Level to PHP 8

To enable the PHP 8 related features, switch the language level to PHP 8 in any of the following ways:

  • Use the Alt+Enter quick-fix directly in the code editor.
  • Go to Preferences | Languages & Frameworks | PHP and use the PHP language level list.
  • Specify the PHP version requirement in composer.json, and PhpStorm will pick it up automatically.

Perform type validation

PhpStorm analyzes calls, calculates possible types, and highlights problem areas relating to union types.

The checks work on all levels: properties, arguments, and return values.

In complex code bases, it helps you see the problems at first glance. PhpStorm will highlight places that require attention even before the code is run.

Detect duplicate and redundant types

There are many type combinations that are forbidden or redundant. For example:

  • bool|false
  • Foo|Foo
  • object|User
  • iterable|array or iterable|Traversable

All of them are highlighted by PhpStorm as invalid.

Phpstorm

Work with nullable types

When there is a single nullable type, it is allowed to use either ?Type notation or Type|null in PHP 8.

But when there are multiple types combined with null, using ?Type1|Type2 is forbidden as ambiguous.

PhpStorm highlights these violations and provides an Alt+Enter quick-fix to convert them.

Follow variance rules

During inheritance, PHP allows you to modify types if you follow these basic rules:

  • Parameter types are contravariant, i.e. can be extended.
  • Return types are covariant, i.e. can only be narrowed down.
  • Property types have to evaluate to the same type.

Luckily, with PhpStorm there is no need to remember these rules as it will check the code and highlight any violations.

Use pseudotype false

2020

In PHP 8 there will be a special false pseudotype that can be used only in union type declarations.

It is widely used in the standard library, see strpos() or array_search(), for example, and can be applied elsewhere to indicate a negative result.

PhpStorm highlights incorrect usages and takes type inference into account.

Remove redundant PHPDoc

After adding a native union type declaration, a PHPDoc may become unnecessary because it does not provide any extra information.

You can now remove it with a quick-fix Alt+Enter.

New Control Flow Engine

Phpstorm

Condition always true

PhpStorm can now analyze complex code paths and detect if the condition in an if-else block makes sense or is redundant.

Result of ‘instanceof’ is always true

Similar to conditions, PhpStorm is able to detect when instanceof checks are appropriate, or if they always evaluate to true because of the inferred type in the type hierarchy.

New action: Type Info

The new action lets you see the inferred type of any selected expression.

When coding, you can select an expression and check its type by using the shortcut Ctrl+Shift+P or View | Type Info menu.

Expression is always ‘null’

PhpStorm can detect when the variable is guaranteed to be null only. In this case, the IDE suggests simplifying the expression to make it clearer.

Quality Tools Improvements

  • It is now possible to run quality tools via Docker Compose.
    To do this, go to Preferences/Settings | Languages & Frameworks | PHP, and add a new remote interpreter based on Docker Compose.
  • Reformat action for PHP-CS-Fixer and PHPCBF can now be run through a remote interpreter too.
  • If PHP_CodeSniffer’sruleset.xml has an 'exclude-pattern' section, PhpStorm will now take this into account and not analyze files under the specified path.

Composer Improvements

Managing Composer dependencies can be done in the editor directly inside the composer.json file.

Support for custom Satis/Packagist packages

If there are custom sources specified in the “repositories” section, you will get completion for custom packages.

Phpstorm 2020.1 download

There is now a gutter icon showing the current state of the caching of custom repositories.

Completion for multiple versions

When a package has multiple versions separated with a comma or pipes (||), PhpStorm provides completion with all available versions for this package.

It used to be that completion was lost after typing ~, ^, or >=, but now it works as expected with any of these range constraints in composer.json.

Quick access to settings of tools added as dependencies

PhpStorm provides many integrations with third-party tools. Now, if a supported tool is declared in composer.json, there will be a wrench icon in the gutter beside it. You can click it to go straight to the corresponding section of preferences.

Extract Class Refactoring

If a class gets cluttered and burdened with a lot of additional responsibilities, it is now possible to refactor it by moving methods and properties to a new class with the Extract Class refactoring.

Select a function, a method, or a property you’d like to move and press Ctrl+T and select Extract class.

The refactoring will create a new file, instantiate an object of the class in the constructor, and adjust the usages automatically.

Command Line Tools Improvements

Support for remote interpreters is now available for PHP Command Line Tools.

Under Preferences/Settings | Tools | Command Line Tool Support, add a new tool entry and choose one of the configured remote interpreters.

Laravel Artisan will now be detected automatically! It means that when you open a Laravel project, you can press Ctrl-Ctrl and start typing a command. PhpStorm will provide completion and suggest available commands.

New Inspections

Array used only with write access

If there is an array declared and updated somewhere in the code, but it is never read, it means that the array is very likely redundant and adds noise to the code.

The inspection detects such cases and prompts you to remove the array to make the code cleaner.

Typed property might be unassigned

If a typed property does not have a default value, it is considered uninitialized. Reading uninitialized properties will generate a TypeError (unless magic __get() is defined).

PhpStorm detects uninitialized properties and highlights code that attempts to read them.

Full Support for GitHub Pull Requests

The entire Pull Request workflow can now be done in PhpStorm, and there is no longer any need to switch to a browser. You can manage pull requests; view the timeline and inline comments; add comments and reviews; and accept changes.

To start working with GitHub pull requests, open the Pull Requests tool window either from the toolbar or from the main menu VCS | Git | View Pull Requests.

Then select a pull request in the list to view all its details: the message, branch names, author, and so on.

From here, you can start the review process by checking the changed files and commenting on the changes – on both the commit level and line level.

Merging pull requests without leaving the IDE is also possible. There’s no need to create a local branch from a pull request, it all works out of the box.

OpenAPI Support

PhpStorm 2020.2 supports the OpenAPI Specifications plugin. This is a free plugin developed by JetBrains that provides completion, navigation, and validation in the OpenAPI spec files (openapi.yaml/openapi.json and swagger.yaml/swagger.json).

The plugin also provides:

  • Swagger UI Integration.
  • Code generation.
  • Built-in structure Diff between OpenAPI specifications.
  • Gutter icons to create HTTP Client requests from specification.
  • Autocompletion for endpoints in HTTP Client.

New Inspections Widget and Problems View

In the top right-hand corner of the editor, you’ll see the brand new Inspections Widget with a summary of the problems in the current file.

  • Click arrows to jump between issues (or use shortcuts F2 / Shift+F2).
  • Click on the widget to see a list of all issues in the file in the Problems tool window.
  • Hover over the widget to see the settings popup and choose which issues to highlight.

Web Technologies

All the new features and improvements of WebStorm 2020.2 are available in PhpStorm 2020.2, either out of the box or with free plugins available in the plugin repository.

Prettier as the default formatter in JavaScript projects

Want to use Prettier instead of the built-in formatter to tidy up your code? With this update, it has become even easier than before. Just tick the new On code reformat checkbox and the IDE will use Prettier whenever you reformat your .js, .ts, .jsx, and .tsx files. Other file types can be easily added, too.

Best-in-class Vue.js support

Nuxt.js support, Vue-specific code style settings, improvements around Vue in TypeScript projects, and a lot of other things were added in the past year. Vue support in PhpStorm has never been so advanced!

Save some time with new features for JavaScript

New smart Alt+Enter intentions will help you perform some actions faster. For example, you can now quickly convert a for loop with a numeric index into a forEach array method. Looking through documentation comments in JavaScript and TypeScript files has also become easier as you can now render them right in the editor, minimizing distractions.

Version Control

Support for Git installed in WSL 2

PhpStorm 2020.2 supports Git installed in WSL 2 for working with projects located in Linux and Windows file systems.

The IDE can switch between Git executables depending on the project location. When a project is opened from WSL (via wsl$ path), the IDE will automatically switch to Git from WSL, and it will also provide you with the ability to use all the Git-related features in the IDE.

New UI to compare branches

When you want to compare two branches to see which commits do not belong to one another, PhpStorm 2020.2 will show the logs in the editor instead of the Git tool window. This will ensure that there is enough space to display all the information.

Choose the Compare with Current action from the Git Branches popup menu VCS | Branches.

Drop commit action

You can now easily remove redundant local commits by selecting them in the Log tab of the Git tool window and choosing Drop Commit from the context menu.

Squash local commits

It is also possible to combine several local commits into one single commit, for example to clean up history before pushing.

In the Git tool window, select commits and choose Squash Commits… from the context menu.

The IDE will run an interactive rebase behind the scenes.

Database Tools

Take a look at What’s new in DataGrip 2020.2 – all these features are available in PhpStorm too.

Separate editor for cell values

Now if you have a huge value in your cell, it can be viewed or edited in a separate panel. You can also toggle soft wrap mode using the right-hand toolbar. Use all the power of our code editor for your data.

Google BigQuery dialect

We’ve added a new SQL dialect: Google BigQuery. Full support for BigQuery is not here yet, but all things must begin somewhere. So far, PhpStorm can correctly highlight and provide coding assistance for your queries if you use Google BigQuery.

DML preview

You can review the query that represents your changes in the data editor. There is a DML button that is active if there are pending changes. This query is not the exact SQL that will be run to modify your data, because PhpStorm uses a JDBC driver to update tables, but most of the time it will be the same.

Other Improvements

  • Customizing getters and setters
  • Resolve for multiple projects in one window
  • New action: Add Carets to Ends of Selected Lines
NewsletterReleases

PhpStorm 2020.2 is now available!

This major release includes support for PHP 8 Union Types, a new control flow engine for PHP, full GitHub pull requests workflow support right inside the IDE, a brand-new Inspection widget, OpenAPI support via a plugin, and more.

Read on to check out all the new features and significant updates, along with a ton of GIFs!

PHP 8 Union Types

PHP 8 will have so many new features that to some extent you can almost call it a new language. We’ve started to roll out support for version 8 early, and the first big feature is union types.

Union types T1|T2|... can be used wherever types can currently be specified: arguments, properties, or return values. In this case, a variable can accept any of the listed types.

Phpstorm 2020

Union types have long been used in PHPDoc tags, but now they will really be checked in runtime by the interpreter itself.

Switch language level

To see all the features, you need to switch the language version to PHP 8. You can do this manually in settings under Languages & Frameworks | PHP | PHP language level.

You can also use the Alt+Enter quick-fix to switch if there is already some code with new features.

And if the PHP version constraint is specified in composer.json, PhpStorm will switch automatically.

Converting PHPDoc into native union types

You can call the Alt+Enter quick-fix on a PHPDoc tag union type to convert it to a native union type.

Remove unnecessary PHPDocs

If a PHPDoc tag contained only a type declaration, it may now be redundant and can be removed with an Alt+Enter quick-fix.

We are considering adding the ability to run this fix in the clean-up stage before commit. What do you think? Can it always be considered safe to do so?

Type validation

PhpStorm was already able to analyze types and find violations with PHPDoc tags. But with native declarations, these capabilities became much wider.

This is especially useful in complex code when violations are not obvious at first sight.

Pseudotype false

Some legacy functions may return false in the event of an error. For example, strpos(), array_search(), and 310 other standard functions behave this way.

In these cases, the return type could be declared as a union like int|bool, but in fact it would never return true. This is where the new false pseudotype is useful.

The false pseudotype can only be used as a part of union type. Otherwise, PhpStorm will highlight it as invalid code.

Duplicate and redundant types

Many combinations in type associations are forbidden or simply redundant. For example:

  • bool|false — because false is a part of bool.
  • Foo|Foo or int|string|INT— duplications.
  • object|Userobject contains everything else.
  • iterable|array or iterable|Traversableiterable contains array and Traversable.
  • void — can only be used in the return value and only as a standalone type.
  • false or null — only as part of the union type.

All such violations will be highlighted in PhpStorm.

Nullable types

The existing ?Type syntax is now considered to be shorthand for Type|null.

But you cannot use ? in union types because it causes ambiguity.

PhpStorm provides an Alt+Enter quick-fix for this.

Type variance in inheritance

There are two rules for methods:

The type of the parameter is contravariant, which means it can be expanded.

The return type is covariant, which means you can only narrow it down.

Type order does not matter here, so Type1|Type2 is equivalent to Type2|Type1.

Property type cannot be changed
The type of an inherited property has to match the type of the parent property, for example:

New control flow engine

By redesigning the control flow engine we were able to introduce new inspections and fix many old bugs. As a result, PhpStorm now understands code even better than before.

Here and there you may notice warning highlights from new inspections. Some of them may require your attention as potential sources of bugs, while fixing others can just make the code clearer and easier to read.

Here are some of the new inspections.

Variable is always true or false
Example in Parser.php from doctrine/orm.

Condition is always true
Example in FormValidator.php from symfony/form.

Result of instanceof is always true
Example in Logger.php from symfony/monolog-bridge.

Pseudovariable $this will always be of type ResetInterface, because it is higher up in the hierarchy.

Expression is always null
Example in ProcessUtils.php from symfony/process.

New action: Type Info (⌃⇧P / Ctrl+Shift+P)
You can point the caret at any expression and call this action to see how PhpStorm inferred the type. The action is available under View | Type Info or via the ⌃⇧P / Ctrl+Shift+P shortcut.

Improvements for Composer

Since version 2020.1, it has been possible to manage Composer dependencies directly in the composer.json file in PhpStorm. This release brings a few enhancements.

Support for Satis/Packagist custom repositories
If you specify a custom source in the 'repositories' section, all packages in it will be available for autocompletion, and information about packages and versions will be cached in PhpStorm.

Code completion for multiple versions
If there are multiple versions separated by commas or by pipe (||) symbols, PhpStorm will now handle completion correctly.

Links to homepage and sources
Each package now has links to its websites in the information popup.

Quick access to quality tools configuration
If the list of dependencies contains code quality tools that are supported in PhpStorm, there will be a wrench icon near them that will take you directly to the corresponding section of settings.

Improvements for quality tools

PhpStorm 2020.2 introduces a number of useful updates for quality tools.

Support for Docker Compose
PHP_CodeSniffer, PHP CS Fixer, and PHP Mess Detector can now be run with docker-compose.

Exclude list for PHP_CodeSniffer
If there is an 'exclude-pattern' section in ruleset.xml, it will now be taken into account and the specified files will not be analyzed in the IDE.

Formatting with a remote interpreter
PHP CS Fixer and PHPCBF can be run via SSH, Docker, Docker Compose, Vagrant, and others.

Command Line Tools

All Symfony, Laravel Artisan, Drupal Drush, WP-CLI commands, and Composer scripts can be run very quickly in PhpStorm without opening the terminal.

Do this by adding the tool you want to use in the settings under Tools | Command Line Tool Support.

Then, by pressing Ctrl-Ctrl you will see the Run anything popup, in which all commands are available with autocompletion.

Starting with this release, you don’t even have to configure anything for Symfony, Laravel, and Drush. Just open the project, press Ctrl-Ctrl, and start typing the command.

⚠️ For Laravel on macOS, the artisan file must be executable (chmod +x artisan).

You can now run these tools through any remote interpreter (SSH, Docker, Docker Compose, Vagrant). For example, you can quickly test your application with PHP 8 by adding a Docker Interpreter from the php:rc-cli image.

Extract Class refactoring

Classes always look neat and clean at first. But over time, many methods and properties are often added to them. And at some point, you can find a class that is overgrown with an excess of responsibilities.

Here it can help to extract a bunch of related methods and properties into a new class. This is exactly what the new Extract Class refactoring offers.

Press Ctrl+T on a class member and select Extract class. PhpStorm will prompt you to enter the name of the new class and you can choose more methods and classes to extract.

This refactoring also works for functions.

More for PHP

New inspection: Typed property might be unassigned

If a typed property is defined but not initialized, the TypeError error will appear when trying to read it (if there is no magic __get()). PhpStorm will highlight cases where you are reading from uninitialized properties.

New inspection: Array used only with write access

Example in SchemaTool.php from doctrine/orm.

Phpstorm 2020 License Key

The $pkColumns array in gatherColumns() method is updated but never read nor returned.

Customizing generated getters and setters

Now you can adjust the naming style by choosing between camelCase() and snake_case().

The order in which getters and setters are generated is also configurable now.

Both options are available in settings under Editor | Code Style | PHP on the Code Generation tab.

Correct resolve when several projects are opened in one window

Previously, if you opened multiple projects in one window, you would often see errors about a class being defined multiple times. If you wanted to go to the definition of a class, you had to choose from multiple implementations.

This is no longer the case. Resolve and Go to declaration work as expected in PhpStorm 2020.2.

Lower priority for symbols from vendor

In the autocompletion list, priority will be given to classes from the project. Entities from a vendor folder and PHAR files will get lower priority.

Full support for GitHub pull requests

Phpstorm 2020.1.1

Basic support for pull requests was introduced in PhpStorm 2018.3. Since then there have been some updates, but many actions still required switching to a browser.

In PhpStorm 2020.2 you can manage the entire pull request workflow directly in the IDE!

You can go to pull requests from the VCS | Git | View Pull Requests menu or from the toolbar or using the Alt+7 shortcut. The first thing you’ll see will be a list of the available pull requests with search and filtering options.

Clicking on a pull request will open detailed information about it – its reviewers, tags, modified files, and timeline.

You can work through the whole review flow all at once – start and request a review, comment on changes both at line level and in the whole commit, and submit the review.

Under the timeline, you’ll see the results of pre-commit and CI checks.

To merge a pull request, you previously had to create a local branch first. This is no longer required and you can now merge straight away from the UI.

OpenAPI support

The OpenAPI Specifications plugin is available for all JetBrains IDEs and works starting from this 2020.2 release. It provides highlighting, validation, and navigation in OpenAPI specification files (openapi.yaml/openapi.json and swagger.yaml/swagger.json).

It also provides the following features:

  • Swagger UI integration – rendered directly in the IDE window.
  • Code generation.
  • Structural diff for spec files – this can help spot breaking changes.
  • Gutter icons to create HTTP Client requests to endpoints.
  • Autocompletion for endpoints in the HTTP Client.
  • Rename refactoring – if you rename an endpoint in the spec file, it will automatically be renamed in the HTTP client request.

Add caret per selected line action

The new Add Caret Per Selected Line action creates carets at the end of each selected line, and deselects the lines. Invoke it using the shortcut Alt+Shift+G on Windows/Linux or ⌥⇧G on macOS.

Brand-new Inspection widget

The top right corner of the editor now displays a widget with the number of problems in the current file.

You can quickly jump to the next/previous problem by clicking the arrow icons. This was previously achieved with the shortcuts F2 / Shift+F2.

In the Inspection widget, you can choose which problems are displayed, for example only syntax errors or all problems.

Clicking on the widget will open a new Problems tool window with a list of all problems detected in the file.

Version control

Git from WSL 2

PhpStorm can now use the Git binary from WSL. Moreover, the IDE itself determines whether the WSL is installed and whether Git is available in it.

Settings are available under Preferences | Version Control | Git.

⚠️ Git will only work with WSL 2. Git from WSL 1 is unstable and may cause incorrect results for Git commands, therefore we do not support it.

Improved UI to compare branches

PhpStorm allows you to compare any branches and see which commits belong to which branch. To do this, select any branch available in the VCS | Branches popup and choose Compare with Current from the context menu.

In PhpStorm 2020.2, information about logs and commits is displayed directly in the editor. This allows more information to be placed on the screen.

Updated command dialogs

Dialogs for the merge, pull, and rebase Git commands have been redesigned and unified. Some missing options have been added and you can now see the exact Git command that will be executed.

All commands are available in the VCS | Git menu.

Phpstorm 2020 Key

New action: Drop commit

Unnecessary or temporary local commits can now be removed directly from the PhpStorm log. To do this, call the context menu on a commit and select Drop Commit.

New action: Squash commits into one

It is also possible to combine several commits into one. It’s a good idea to do this to clear intermediate results from the history before creating a pull request or pushing changes.

Select multiple commits in the log and choose Squash Commits… from the context menu.

Database Tools

PhpStorm includes almost all of DataGrip’s features as standard. You can check out What’s new in Database tools for an overview from our colleagues about its new features.

Web

As usual, all the updates for WebStorm 2020.2 have also been incorporated into PhpStorm.

A full list of all the changes in this release is available in the really long release notes.

That’s all for today. Thanks for reading to the end! We’ll be happy to respond to your questions, suggestions, bug reports, and any thoughts you’d like to share in the comments.

Phpstorm 2020.2 Github

2020

Phpstorm 2020 License Server

Your JetBrains PhpStorm team
The Drive to Develop