PhpStorm 2020.3

Adds support for PHP 8, PHPStan, Tailwind CSS, Xdebug 3 and collaborative development via Code With Me.
December 7, 2020
New Version

Features

PHP 8

  • PHP 8.0 is a major language update with many new features. PhpStorm will help you verify that your existing code is compatible with it, update your codebase more quickly, and take advantage of the latest language improvements.
  • See language version - Now you can always see which language version is being used in a project. There is a corresponding indicator in the status bar. From there, you can also change the language version if composer.json doesn’t list any restrictions on the PHP version.
  • Named arguments - Function and method arguments in PHP 8 can now be passed by specifying a parameter name. This eliminates the need to set optional parameters, and it means calls are now self-documented:
    • Check that argument names are correct.
    • Add parameter names automatically with an Alt+Enter quick-fix.
    • Remove redundant arguments.
  • Constructor property promotion - This feature lets you reduce the amount of boilerplate code when you initialize variables through a constructor.
    • You can convert constructor-initialized properties into promoted properties or change them back with Convert to promoted property Alt+Enter quick-fix.
  • Nullsafe operator - Instead of having to use cumbersome conditions with null checks, the new ?-> operator allows you to build chains of calls with implicit checks for null for each element. This version makes sure that the operator is being used correctly.
  • Match expression - The new match expression is a type safe and compact alternative to the switch statement. A match expression can be used as a value and assigned to a variable or returned. PhpStorm will determine whether a switch block can be converted to a match expression, and it will automatically do so with an Alt+Enter quick-fix.
    • With the new expression it might be hard to see misusages, this new release will highlight them for you.
  • New functions for strings: str_contains(), str_starts_with(), str_ends_with() - In PHP 8, you can use the str_contains() function to determine whether a string is part of another string. PhpStorm 2020.3 draws your attention to any usages of strpos() that can be replaced with str_contains(). It also highlights the places where old substr() calls can be replaced with the new, more self-explanatory str_starts_with() and str_ends_with() functions.
  • Other PHP 8 features supported:
    • Trailing comma after the last parameter in a function call and in the use section of closures.
    • Non-capturing catches are useful to catch exceptions when you don’t need an exception object.
    • Throw can now be used as an expression (i.e. it is allowed in arrow functions, the coalesce operator ??, and the ternary/elvis operator ?:).
    • To get a class FQN from an object, you can do $object::class instead of get_class($object). Use an Alt+Enter quick-fix for this.

PHP 8 attributes

  • PHP 8 allows you to use attributes to specify metadata in a structured way instead of having to rely on PHPDoc annotations. PhpStorm provides highlighting, code completion, finding usages, refactorings and other coding assistance for working with attributes. It also has inspections to make sure the attributes are declared and are validly used. This release comes with several PHP 8 attributes available right away in the IDE.
    • #[Deprecated] - Like the @deprecated PHPDoc tag, you can use this attribute to mark methods, functions, classes, or class constants that will be removed in future versions of the software.
      • Specify the reason and replacement so that your users understand why they need to upgrade, and make it possible for them to do so automatically with an Alt+Enter quick-fix.
    • #[ArrayShape] - Use this attribute to define the keys and value types of object-like arrays. This will improve the coding assistance and analysis.
    • #[Immutable] - Mark objects or properties with the #[Immutable] attribute when you want to prevent any attempts at changing the object after it is initialized.
      • This makes the program state more predictable and debugging easier.
    • #[Pure] - Mark functions that do not produce any side effects as #[Pure] to improve the code flow analysis. The IDE will highlight redundant calls of pure functions.
      • If you mark a function as #[Pure] but in its body there is an attempt to change something from the outer scope, then PhpStorm will highlight the unsafe code. All such PHP internal functions, e.g., array_merge(), are already marked.
    • #[ExpectedValues] - Use this attribute to specify which values a function accepts as parameters and which it can return. This will improve code completion and help detect possible bugs.
    • #[ExpectedValues] is an advanced version of expectedArguments() from .phpstorm.meta.php.
    • #[NoReturn] - Mark the functions that can terminate a script execution with a #[NoReturn] attribute to get more accurate control flow analysis.
      • PhpStorm will offer to propagate the attribute down across the hierarchy with a quick-fix to get even more well-defined analysis.
    • #[Language] - Add this attribute to string parameters containing text in another language, such as RegExp, SQL, and so on. This will reveal additional PhpStorm features.

Psalm and PHPStan Support

  • Both of these static analyzers can now be used in version 2020.3 as first-class tools to highlight issues in the editor. Add them as dev-dependencies in composer.json and turn on the corresponding inspection by clicking a wrench icon near the tool.
  • PhpStorm also provides code completion for @psalm-* tags and treats them as special, so there won’t be issues with highlighting, undefined classes, and so on.
    • Many psalm types are supported including:
      • scalar.
      • numeric.
      • types with constants.

Xdebug 3

  • Xdebug 3 is a fresh rework of the PHP debugger. It works much faster and is easier to set up.

Code With Me

  • Version 2020.3 supports Code With Me – A new service from JetBrains for collaborative development and pair programming. Code With Me enables you to share the project you currently have open in your IDE with others and work on it together in real time.

Tailwind CSS

  • PhpStorm can now help you work with Tailwind CSS more productively. The IDE will autocomplete your Tailwind classes, show you a preview of the resulting CSS on mouseover, and support the customizations you make using tailwind.config.js files.

HTTP Client

  • Run Guzzle requests with the HTTP client - Guzzle is one of the most popular HTTP clients for PHP. In PhpStorm 2020.3, you can now test Guzzle requests without running the actual code.
  • Export HTTP requests to cURL - To get a cURL string from an HTTP request, press Alt+Enter in the HTTP request editor and select Convert to cURL and copy to clipboard. You can use the cURL string in the terminal or with your choice of HTTP client.

Editor

  • Markdown editing and preview enhancements - Mermaid.js diagrams and charts can now be rendered inside the IDE.
    • Added an Auto-Scroll Preview button in the top right corner of the preview pane that enables and disables synchronous scrolling with the editor.
    • Added a popular Markdown code style presets that work when you reformat code with Ctrl+Alt+L.
  • Improved spelling and grammar checking - The grammar checking engine supports more languages and provides higher-quality grammar checks. When a mistake is highlighted, there will be a popup with an explanation and a suggested fix.
  • Split the editor with drag and drop - Open multiple tabs side by side by dragging a tab over to the desired side of the screen.
  • Preview Tab - You can now preview files in a special tab without actually opening them. If you start editing a file you are previewing, the tab will become an ordinary file.

IDE

  • Search Everywhere improvements - In the Search Everywhere popup (Shift+Shift), results will be shown in a slightly different way. Instead of being grouped by type, they are now grouped based on their relevance to the search query.
    • Added the ability to perform simple math calculations in Search Everywhere. Type some numbers and math operators and see the results of the calculation right away. This eliminates the need to switch to a calculator app and disrupt your flow.
    • Search Everywhere can also search through Git history, including information about branches and commits.

Web Technologies

  • All the new features and improvements from WebStorm 2020.3 are now also available in PhpStorm 2020.3.
    • TypeScript in the Problems tool window - Integrated the TypeScript language service into the Problems tool window and removed the TypeScript tool window so that it’s easier to review the problems in your code from one place. This release has also moved the actions previously available within the TypeScript tool window to a dedicated widget on the status bar.
    • Create a React component from usage - Place the caret at an unresolved React component in your code, press Alt+Enter, and select Create class/function component from the list – the IDE will create the relevant code construct for you.

Version Control

  • Git stage support - PhpStorm 2020.3 comes with support for the Git staging area.

Database Tools

  • All the new features and improvements from DataGrip 2020.3 are now also available in PhpStorm 2020.3.
    • SQL for MongoDB - You can now use SQL to query MongoDB databases. Version 2020.3 supports SELECT queries with clauses such as JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, OFFSET, and all available MongoDB functions except map, reduce, filter, and let.
    • Couchbase support and new data extractors - PhpStorm now supports the Couchbase Query service. This release also introduced two new extractors:
      • One-Row, which allows you to copy a column to a comma-separated string.
      • SQL-Insert-Multirow, which generates a single INSERT statement with multiple new rows to be inserted.
Nullsafe operator

PhpStorm

PHP IDE with refactorings, code completion, on-the-fly code analysis and coding productivity orientation.

PhpStorm is also available in:

Got a Question?

Live Chat with our JetBrains licensing specialists now.