Phpstorm Là Gì


PhpStorm 2021.2 is a major update that introduces preliminary tư vấn for generics in PHP, enums in PHP 8.1, one-line array shape annotations, và improved automatic formatting of PHPhường code, as well as new inspections và refactorings.

Bạn đang xem: Phpstorm là gì

PHP.. does not provide tư vấn for generics on a language level at the moment, but their use via annotations has already become quite popular. They make code safer & more predictable when working with collections, containers, factories, và other applications.


template annotation. This makes working with collections more straightforward in many cases, because the suggestions will contain elements of the expected type.

For factory patterns, you can now use the class-string annotation & you will get better code completion.

This preliminary tư vấn for generics is not complete and has known limitations. You can learn more about it in this blog post.

The new 8.1 version of the PHP interpreter is expected to be released at the over of 2021. But as always, we"re starting lớn roll out support early.

One of the most highly anticipated features of the PHP. 8.1 release is enums.

With PhpStorm 2021.2, you can start using enums immediately. The IDE offers code suggestions and validation to lớn protect you from using them incorrectly.

An enum in PHPhường. contains a set of cases, can have sầu methods, & can be used as a type hint – in all of these cases PhpStorm will provide error highlighting and proper suggestions to lớn save sầu you time.

Enum cases can have scalar equivalents. This is useful if you need to lớn save sầu an enum khổng lồ a data store. Such enums are known as backed enums.

With a quick-fix, you can add a scalar type declaration to lớn a backed enum.

Enums also work well with other features, such as conditions & match expressions.

Learn more


If there are object-lượt thích arrays in your code, you can now define their structure with this PHPDoc annotation: arraykey: type, key: type, ....

PhpStorm provides code completion for such annotated arrays, reducing the time you spover on routine typing và protecting you from mistakes.

The tư vấn is limited lớn one-line array shape definitions. For larger structures, it is often better to use real objects and classes.

One of the most frequently used PhpStorm refactorings, Extract Method, just got better.

It allows you lớn split big methods inlớn smaller units, and it also eliminates duplicate code.

To use this refactoring, select any piece of code and press ⌘⌥M (Cmd+Alt+M / Ctrl+Alt+M).

PhpStorm has a Duplicated code fragment inspection. It highlights any chunks of code that are very similar – the formatting, variable names, & statement order can be different as long as the end result is the same.

This inspection highlights the first lines of duplicated fragments. You can now quickly refactor such code by pressing Alt+Enter on the highlighted line và invoking the Extract Method refactoring from the duplicate code quick-fix.

PhpStorm can also find duplicates of smaller code fragments in the current scope (method, class, or file) during refactoring. Select a code fragment and then Call the refactoring with ⌘⌥M (Cmd+Alt+M / Ctrl+Alt+M). You will see the Review và replace duplicates checkbox at the bottom of the dialog.


You can also invoke the Extract Method refactoring without selecting any code. In this case, PhpStorm suggests a list of possible code fragments. The suggestions are filtered and contain only segments that make sense khổng lồ refactor.

You probably already know that you can select a piece of code with the Expvà / Shrink selection action ⌥+Up / ⌥+Down (Ctrl+W / Ctrl+Shift+W). This is one of the fasthử nghiệm ways to select code for refactoring.

This release introduces a small but useful update – the ability to lớn select blocks without curly braces.

The Extract Method refactoring has even more improvements! Check out all the details in this blog post.

Every release comes with a bunch of inspections to reduce the time you spend looking for bugs và fixing them. Press Alt+Enter on any highlighted code in PhpStorm lớn apply a fix.

`" loading="lazy" />

Xem thêm: Age Of Empires Franchise - Age Of Empires 4: What We Know So Far

Replace unnecessary checks for null with the new safe operator from PHPhường 8. Press Alt+Enter khổng lồ persize the transformation.


PhpStorm will highlight constants that are accessed via subclass or subinterface instead of the entity where the constant is defined. Replace the name of the entity with the one where the constant is defined using the Alt+Enter quick-fix.

PhpStorm will now evaluate parts of conditions to lớn identify any redundancies. This can be useful when the checks are not obvious and you can’t tell which ones are redundant just by looking at them.

We’ve sầu added a new group of inspections in the PHP section of Settings / Preferences | Editor | Inspections.

This group includes inspections that can help identify good candidates for refactoring. These inspections are disabled by mặc định, but even in this disabled state, you’ll see an additional gutter ibé

near the code they detect (instead of having it underlined in the editor).

Clicking the gutter inhỏ will invoke the suggested refactoring.

These inspections are combinations of various code quality metrics: cyclomatic complexity, nesting depth, number of variables used, total number of lines, & many others.

You can find the menu of metrics used in the description of each inspection.

Learn more

We’ve sầu expanded the menu of possible pre-commit actions with the ability to lớn exedễ thương tests. Tiông xã the Run Tests checkbox and select the configuration to lớn run. It is useful to get the code verified before it is in the VCS.

You can now also customize the Analyze code & Cleanup options by clicking Choose profile next to them.

We’ve sầu added a new configuration page under Preferences / Settings | Tools | Actions on Save.

There you’ll find a danh mục of actions that can be triggered with Ctrl+S or on implicit autosave. These actions include code checks, reformatting, code cleanup, deployment, & many others.

PhpStorm will open a diff comparison between the initial và changed files in the editor by mặc định, no matter where you’ve sầu invoked the Show Diff action. If tracking the changes in a separate window is more convenient for you, simply drag và drop the desired file from the editor.

Local History has been the unsung nhân vật of many developers, và now it has been improved to lớn allow you lớn quickly find the text you need in the local revisions by using the search field in the Local History dialog.

PhpStorm 2021.2 offers a new way to secure your commits. You can now enable Git commit signing with GPG. Just go to Settings | Version Control | Git & cliông xã Configure GPG Key from the drop-down các mục.

Starting from this version, you can enjoy the fully localized UI of PhpStorm in Chinese, Korean và Japanese. Localization is available as non-bundled language pack plugins, which can be easily installed to lớn your IDE*. More than 1.5 mln users started using the partially localized EAPhường. version of our language packs. Now you can enjoy the full localization experience!

Web Technologies

All the new features and improvements from WebStorm 2021.2 are also available in PhpStorm 2021.2, either out of the box or with không tính phí plugins from the Plugin Marketplace.

PhpStorm can now rename both the useState’s values và functions. Place the caret on a state value and press ⇧F6/Shift+F6 or go to Refactor | Rename from the right-click context menu.

PhpStorm can now add missing import statements when you use code completion when working with CommonJS modules.

Xem thêm: 1 Set Là Gì, Nghĩa Của Từ Set, 1 Set Là Gì

Database Tools

Take a look at What’s new in DataGrip 2021.2 – all these features are available in PhpStorm, too. Here are just a couple of them.

It is now possible lớn generate a DDL data source based on a real one. The DDL files will be created on the disk và the new data source will be based on them. That way you’ll always be able lớn regenerate these files and refresh the DDL data source.