Set any PHP version for the project without modifying
This can be helpful, for example, to see how compatible the codebase is with a newer PHP
version before actually switching to it.
To make it easier to find and change PHP-related settings, we’ve moved this section to the top level Settings / Preferences | PHP.
In the Editor, there is a new icon in the top-right corner that opens a tab for previewing files inside of PhpStorm. It works with HTML and PHP files.
PhpStorm uses a local PHP interpreter that is specified in the project settings under Settings/Preferences | PHP. Docker and other remote interpreters are not supported.
You can turn on the preview icon by enabling at least one browser under Preferences | Tools | Web Browsers and checking the For HTML files checkbox.
You can also use the shortcut Alt+F2 to open a preview tab.
Many content management systems and frameworks allow you to specify a table prefix, which is useful when using the same database for multiple applications.
If a boolean expression contains
PhpStorm can help simplify it. Use an Alt+Enter quick fix to remove redundancies
and improve readability.
=== operator for strict comparison will always result in
false if one operand type is not the same as the other.
PhpStorm will highlight such cases, as they can potentially be a source of bugs. PhpStorm takes into account all type-inferred information, and will help you find issues in less obvious cases.
It used to be common practice to add a variable assignment in a function call to mimic a parameter name.
With PHP 8, use Alt+Enter to replace the assignment with a real named argument.
This code snippet
isset($a) ? $a : $b; is exactly the same as
$a ?? $b, so PhpStorm will suggest an Alt+Enter quick-fix to
else blocks may become redundant after changes
that make their bodies the same. PhpStorm will offer either to extract common parts or
to merge blocks.
Press Alt-Enter on any
if and choose
Invert `if` statement from the menu. This will change the condition to its
opposite and make the necessary code adjustments to preserve the logic. If you are a fan
of the early return practice, this action will help you refactor your code.
In some cases, the leading backslash is redundant for namespaces. PhpStorm helps determine where it can be removed.
Variables for key and value in a foreach loop can clash with the names of other variables or parameters. PhpStorm highlights all of the places where errors could occur.
PhpStorm highlights when the curly braces in the context of string interpolation are redundant and can be safely removed to make the code cleaner.
If the declared type does not match the type of a value, you can quickly update the type using Alt+Enter. Or with PHP 8, PhpStorm will offer to use a union type.
isset() function is only effective for arrays and variables.
In all other cases, it makes sense to verify whether the operand is not
Use Alt+Enter to replace
isset() checks with
http:// protocol usages in strings and offers an
Alt-Enter quick-fix to change them to
https://. You can also add
URLs to the ignore list with a quick-fix.
PhpStorm highlights some typical misusages of parameter names or return values, for
$y. This could be a potential bug or at least very confusing for those
who read the code.
You can now choose a code inspection profile before committing changes to the VCS. Click the gear icon to show commit options, then tick the Analyze code checkbox, click Configure, and choose the desired profile. Profiles can be created in Preferences/Settings | Editor | Inspections.
In PHP, loop constructs like
catch blocks do not have isolated scopes. This can be inconvenient if you
want to rename a variable only inside a block.
In PhpStorm 2021.1, we have introduced a synthetic scope for such blocks, so the rename refactoring (Shift+F6) will be more intuitive.
PhpStorm 2021.1 analyzes how variables are used and injects language references automatically.
For example, if a variable is used in a
preg_* function, PhpStorm knows
it’s a pattern and highlights RegExp.
PhpStorm now considers extensions in both
PhpStorm will warn you when an extension is registered in
as suggested but is used without checks, like
function_exists(). You can use a quick-fix to move extensions to
In this release, our main focus was stability and quality. In total, we fixed 2246 issues submitted to our issue tracker by users and JetBrains team members. Here are just a few of the most interesting ones:
Code With Me is a JetBrains tool for collaborative development and pair programming. We initially introduced it in PhpStorm 2020.3, and this release delivers a number of significant improvements.
Set the needed level of access to your project and share the link with your guests. Peers do not even need to have their own IDEs installed to collaborate, and the platform features embedded audio and video calls, along with chat messaging.
For businesses that require extra security, Code With Me on-premises can be installed and securely run on a company’s own private network.
You can now define SSL settings in the HTTP client by clicking
Add environment file and selecting Private. The IDE will automatically
create a file where you can add your SSL configurations:
There is a new eye icon that contains options for the way the body is displayed. You can switch modes between Text / JSON / HTML / XML, you can enable line numbers, and there is a new button to quickly Copy Response Body to Clipboard.
Split the editor by dragging a tab to the corners of the IDE window. Then double-click the tab to maximize the editor area for it. Double-click it again to restore it to its original size.
Use the JSONPath query language to search through JSON documents. New actions are available under Edit | Find | Evaluate JSONPath.
PhpStorm now supports the newline-delimited JSON Lines format used for working with structured data and logs. The IDE will recognize .jsonl, .jslines, .ldjson, and .ndjson file types.
It is now possible to adjust font variations and a fallback font. Find the new options under Typography Settings in Settings / Preferences | Editor | Fonts.
You can now fix problems in CSS with Stylelint in just a few clicks. Hover over a problem in your file or place the caret on it and press Alt+Enter, then select Stylelint: Fix current file.
Additionally, you can now specify a path to the configuration file under Settings / Preferences | Languages & Frameworks | Style Sheets | Stylelint.
When working with style sheets, you can now check the specificity of your selectors – just hover over a selector that you want to check. Alternatively, focus on a selector and press F1/Ctrl+Q to see this information in the Documentation popup.
To create a new pull request, click on the + icon or go to Git | GitHub | Create Pull Request.
The new dialog includes everything you might need:
Take a look at What’s new in DataGrip 2021.1 – all these features are available in PhpStorm, too. Here are just a couple of them.
The Modify user window, which you can invoke on a user in the database explorer with Cmd/Ctrl+F6, now has a UI for adding grants to objects.
This is available for PostgreSQL, Redshift, Greenplum, MySQL, MariaDB, DB2, SQL Server, and Sybase.
This is our solution for anyone wanting to generate simple statements straight from the database explorer. When you right-click on an object in the explorer, the list that appears will contain special live template items.
Learn more about how to create your own context live templates.