This article brings you relevant knowledge about phpstorm, which mainly introduces issues related to the official release of version 2022.1, including improved Blade and Twig support and new advanced PHP metadata functions , generics in the @method annotation and some improvements to the editor. I hope it will be helpful to everyone.
Recommended study: "phpstorm tutorial"
PhpStorm 2022.1 is officially released! This version includes improved Blade and Twig support, new advanced PHP metadata features, generics in the @method annotation, and some improvements to the editor. The following excerpts introduce some of the new features:
Previously, PhpStorm treated each code block in Blade templates as a separate scope, which caused some issues such as missing code completion:
PhpStorm 2022.1 has major changes to how the IDE handles Blade templates, now with better code completion in the .blade.php file:
Further issues with code completion and formatting in Blade templates have also been resolved:
WI-37741 Autocompletion of PHP variables in Blade
WI-34830 Blade: support namespaces in php
WI-64460 Blade: missing completion for methods inside tags if there is php block()
WI-64463 Blade: Two consecutive @php fragments are merged together and produce an "expected: expression" warning
WI-31196 Blade: html comment Format error
WI-40358 Blade: @section inside @if block throws "Directive not closed"
WI-64594 Blade: Support for @js directives
See the full list on the bug tracker for more information.
New option to disable tag auto-completion
Some users want their Twig tags to not automatically complete after typing {% will be turned off automatically, this behavior is now configurable:
#If you update the start and end tags from {% to {{ , the start and end will now also be edited at the same time mark.
Jump from Hook call to registration
In PhpStorm 2022.1, there is a gutter icon to the left of the call. Click it to see a list of hook usage, including registrations and other calls.
This release adds support for the get_template_directory_uri() function in paths.
PhpStorm 2022.1 Added complete support for multi-line and nested array shapes in PHPDoc and properties Support:
In this case, the array structure can be defined using the array shape annotation to get code completion for the keys and infer the type of the values.
Booth PHPDoc and Attribute syntax can also be used in PhpStorm, which supports return type and parameter type definition:
In addition to multi-line and nested comments In addition to support, there are many other improvements to array shapes.
PhpStorm 2022.1 supports generic types in @method definitions:
In addition to built-in "code awareness" capabilities, PhpStorm also relies on external code knowledge. This knowledge comes in the form of PHP stubs and .phpstorm.meta.php files.
Previously if you relied on __call or __callStatic of magic methods, you may lose its auto-completion function because these methods are undefined. In 2022.1 EAP, it is possible to add corresponding metadata entries and get autocompletion for such calls:
# Even dynamic calls can be automatically handled, receiving from parameter values Specific method name:
You can now specify a union type as @|MyClass:
In Learn more about other metadata features in the documentation.
Enhanced New Project Wizard: When creating a new empty project, you can choose to automatically generate a composer.json file for it, and Provide required dependencies.
After creating the project, PhpStorm will prompt you to install them:
This release introduces support for deployment using a WebDAV server. To configure a new server, go to Preferences | Build, Execution, Deployment | Deployment and add a new server of type WebDAV and provide the connection parameters:
PhpStorm 2021.3 introduces Rsync for SFTP support to significantly speed up deployments. The Rsync tool is executed with the -zar command line option, which compresses the transferred data (z), preserves permissions, ownership, and timestamps of transferred files and folders (a), and recurses into subdirectories (r).
In this release it is possible to customize the set of options: go to Settings | Preferences | Tools | rsync and provide the desired set of options:
A number of new checks have been added designed to simplify the use of regular expressions.
The following new check will report modifiers used in regular expression patterns, but do not affect matching:
/i (case-insensitive) In a pattern that does not contain letters
/D( PCRE_DOLLAR_ENDONLY ) In a pattern that does not contain a dollar sign, or contains the \m(PCRE_MULTILINE) modifier
/s (dot matches newline character) In modes that don't contain dots
PhpStorm provides an Alt Enter quickfix to quickly remove these modifiers.
The /e modifier is deprecated in PHP 7.0 and later.
Replaced the event log instance with a new notification tool window, which can help users better understand notifications from the IDE. By default, the new tool window is located in the lower right corner of the IDE window, and notifications can be divided into two categories: Suggestions and Timeline.
Run commands from Markdown files
README files are generally used to describe the running steps of a software, PhpStorm 2022.1 will allow Run commands directly from such Markdown files - just click the run icon in the gutter to the left of the command.
New options can be managed via Detect commands, which can be run directly from Markdown files in Preferences / Settings |
Copy Markdown code snippet
The new version adds a new copy code snippet operation to the Markdown block, which can quickly copy Markdown code to the clipboard.
In LightEdit mode, you can quickly edit files without creating or loading an entire project. Code can now be reformatted in LightEdit mode as well.
JetBrains’ IDE 2022.1 version has made many improvements to Vue 3. PhpStorm integrates all of WebStorm’s improvements to HTML/CSS/JS and other web technologies. In this release, if you define components as global, the IDE will recognize them in your .vue files.
PhpStorm also correctly supports the createApp syntax, which will correctly match applications created using createApp related elements.
It’s a pity that there is no cracked version
Recommended learning: "phpstorm tutorial"
The above is the detailed content of PHPStorm2022.1 is officially released! See what functional improvements have been made?. For more information, please follow other related articles on the PHP Chinese website!