PhpStorm 2023.3

Released: Dec 6, 2023

Actualizaciones en 2023.3

Características

AI Assistant is out of preview [General Availability]

  • JetBrains AI Assistant is now generally available with a number of new and improved features to increase your productivity in JetBrains IDEs.
    • LLM-based code completion - AI Assistant can now generate multi-line blocks of code for you. Simply start typing on a new line, and if an LLM suggestion is available, a grayed-out code snippet will appear. Press Tab to accept the suggestion. Currently, such suggestions are available within class contexts or inside function definitions.
    • Test-code generation - AI Assistant can also generate tests for class methods. With the caret placed on the class method you wish to cover with unit tests, just press Alt+Enter, select AI Assistant, and choose Generate Unit Tests.
    • In-editor code generation - Previously, you could use AI chat to generate code snippets. Now there is an AI Assistant | Generate code… action that opens a prompt right inside the editor. You will be asked to enter a description of the code you wish to generate. Once you do, AI Assistant will provide suggestions, and you can accept part or all of them.
    • AI-based error explanations in the console - Sometimes, when you execute a PHP script or run configuration, or run a Composer action, the job fails for some reason. AI Assistant can help you determine the root cause of the issue. Click the Explain with AI button in a stack trace or error message to get an AI-generated explanation.
    • You can use AI Assistant in PhpStorm as a supplemental feature with a JetBrains AI Service subscription.

Pest updates

  • PhpStorm now supports the Pest test framework out of the box.
  • Just like PHPUnit tests, Pest tests can now be run directly from PhpStorm. When you place your caret inside a test and trigger the run window, a run configuration will be created for that specific test. You can place the caret in the file but not inside any particular test to trigger all the tests in that file.
  • With the new Pest support, you can write assertions by calling functions or methods on $this. It also improves autocompletion in test functions, so you can see what assertions are available as you type.
  • In Pest, you can write custom expectations to reduce boilerplate checks in your tests. PhpStorm can help you find usages of custom expectations and help you rename them.

PHP 8.3 support

  • This release comes with full support for PHP 8.3, including:
    • #[\Override] attribute - PHP 8.3 introduces the new #[\Override] attribute. It can be used to explicitly show your intent when overriding a method. The PHP engine is able to check whether a method marked with #[\Override] actually overrides the parent method, throwing an exception if this is not the case. PhpStorm 2023.3 gives you a warning about such cases in advance. PhpStorm also suggests adding the #[\Override] attribute when applicable.
    • New json_validate() function - PHP 8.3 adds the new json_validate() function to the standard library. Previously, the only way to validate whether a string was valid JSON was to decode it and detect whether any errors were thrown. PhpStorm can detect these patterns and suggest replacing them with a json_validate() function call. This can be beneficial if you only need to know whether the input is valid JSON, since it uses less memory compared to decoding the string.
    • Typed class constants - In PHP 8.3, you can declare types for class constants. All type declarations can be used except for void, callable, and never. For typed class constants, PhpStorm provides:
      • Suggestions to insert the appropriate types.
      • Type hint completion.
      • Compatibility checks with the default value's type.
      • Type redeclaration checks when overriding a constant in a child class.
    • Deprecations - PHP 8.3 introduces a few deprecations, and PhpStorm has added corresponding inspections to spot them.

Symfony support

  • New Project wizard - Added a new built-in project initializer for Symfony which allows you to create new Symfony projects with the desired types and versions right from the Welcome screen.
  • Doctrine Query Language support in QueryBuilder - You can now enjoy full IDE support for DQL inside QueryBuilder method calls. Features include highlighting, field completion, the ability to resolve to the target model class, and more.
  • Conversion of annotations to attributes for Symfony and Doctrine - Following the introduction of attributes in PHP 8.0, Doctrine annotations are being deprecated and will soon be removed. In order to help you make the switch, this release includes functionality for converting Doctrine annotations to attributes. PhpStorm also supports the conversion of Symfony annotations to their corresponding attributes, like #[Required], #[Route], and so on.

Other updates for PHP

  • Option to exclude external library files from your project - As an experimental new feature, the ability to exclude directories that come from indexed libraries has been added. Excluding such files from your project will help you avoid multiple-definition problems and improve indexing performance.
  • Dedicated styling of generic types - It is now possible to set up color-coding for generics, making it easier to distinguish between generic types.
  • Ability to fold multiline PHP attributes - With the adoption of attributes increasing, it can sometimes be hard to read code that is annotated with long multiline attributes from a given framework. In this release, this should no longer be an issue, since you can now fold multiline attributes.
  • PHPUnit metadata conversion from PHPDoc to attributes - PHPUnit 10 introduced support for attributes for adding metadata to test classes and test methods, as well as tested code units. An inspection and a quick-fix that will help you migrate to this new style from the old PHPDoc annotations has been implemented.

Version control systems

  • The all-in-one diff viewer - Introduced a revamped way to review changes. Instead of going through each file one by one, you can now see all of the modified files from a changeset in a single, scrollable frame. This new diff viewer is accessible from the Git Log tool window and currently works with JetBrains Space reviews.

Debugger

  • Added a new Run to Cursor inlay option which allows you to quickly execute up to a specific line of code while debugging. Once your program is suspended, you can hover over the line of code you want to execute up to and use the Run to Cursor popup. The same can be achieved by invoking the keyboard shortcut Alt + F9 after placing the caret on the desired line.

User interface

  • Option to hide the main toolbar in the default viewing mode - It is now possible to hide the main toolbar when using the IDE's default viewing mode, just like in the old UI.
  • Option to revert to the default tool window layout - With the release of PhpStorm 2023.1, the ability to save multiple tool window layouts and switch between them was introduced, enhancing the customizability of your workspace. In this release, this functionality has been expanded by introducing the Default layout option, which provides a quick way to revert your workspace's appearance to its default state. This layout is not customizable and can be accessed via Window | Layouts.
  • Color-coded editor tabs by default - To make it easier to work with a variety of file types in the editor at the same time, color-coding has been introduced for editor tabs by default, mirroring their appearance in the Project tool window.

TypeScript improvements

  • PhpStorm now addresses some of the frustrating inconsistencies that occur when adding import type statements, and it makes working with verbatimModuleSyntax easier. The option to configure the kind of TypeScript import type statement has been added. The behavior for the exports field of package.json has also been improved for TypeScript files.

HTML to JSX single tag closing

  • When you paste HTML code into a JSX file, not only will PhpStorm convert attributes, but it will now also automatically close single tags for you. You can configure this option under Settings | Editor | General | Smart Keys | JavaScript.

CSS custom @property support

  • To support the new @property API for creating custom CSS properties, PhpStorm now offers inspections and completion features for explicitly defining CSS custom properties, allowing you to check and restrict property types, establish default values, and determine inheritance possibilities for custom properties.

Improvements for Vue 3

  • Added support for defineSlots, providing completion and navigation for the slot name, as well as the Rename refactoring. Completion support has also been introduced for properties with defineExpose. In this release, required imports for components will be added based on the name specified by the defineOptions function.