Debug Twig and Blade Templates
Debugging is very effective when you face a nasty bug or dive deep into a codebase. But it's a nightmare to go through the machine-generated code of compiled templates. With PhpStorm and Xdebug, you can now do step-debugging in original uncompiled .twig and .blade.php files of these two popular template engines. All debugging benefits are available here: see the context, local and global variables, add watches, run step-by-step, and more!
Locate Dead Code
If you’re dealing with a legacy codebase and want to clean up things, a good way to start is removing dead code. Now PhpStorm detects redundant code and highlights classes, class members, and functions that are probably never used. The Unused declaration inspection takes into account dynamic usages of the code, for example via magic methods. To check the report for the whole project, select Code -> Inspect Code….
Refactorings, Intentions & Quick-Fixes
String Juggling Toolbox
We’ve added multiple new intentions for manipulating strings. You can now convert string concatenation to interpolation, convert a concatenation or interpolation to a sprintf call, copy a concatenated string to the clipboard, and do many other things. Press Alt+Enter on a string to see the available actions.
Remove Unused Variable
PhpStorm 2019.1 introduces a new quick-fix that helps you get rid of the unused variables that appear in assignments’ or closures’ use lists. The quick-fix is smart enough to detect situations when the assignment expression may have side effects.
Move To Class Refactoring
With the new Move to Class refactoring, you can transit functions or constants to the Class they logically belong to, and PhpStorm will find and modify all usages for you. You can move multiple functions simultaneously by selecting them in Structure tool window.
Method May Be ‘static’ Inspection
If a class has a method that doesn't use any instance references, PhpStorm will detect it and offer a handy quick-fix: press Alt+Enter on the method, and make it static. All the usages will be updated automatically.
For interpreters based on Docker Compose, you can now choose between docker-compose run or docker-compose exec for executing containers. If you have a heavy container that you don’t want to restart on each test run, you may reuse it by choosing the docker-compose exec option. Or you can use docker-compose run for lightweight containers or those not working in daemon mode (that is, stopping right after they start).
With the help of a special file, .phpstorm.meta.php, PhpStorm is now able to suggest arguments and return values better. This is to cover situations when, instead of some simple type like integer or string, you would like to see a certain set of constants suggested. Or if you expect some function to return a certain constant. You can also improve suggestions in PhpStorm for your library or project by providing your own .phpstorm.meta.php file.
We’ve reworked the inspections and intention actions related to namespaces importing and using FQN. The main idea behind them is to avoid qualifiers as much as possible. Now, PhpStorm will let you simply remove a redundant qualifier if possible, or replace it with the corresponding ‘use’ import statement. Also, when you paste some code into a file, PhpStorm will ask to reuse an existing alias.
In PhpStorm 2019.1, the Code Cleanup tool comes with PHP-specific intentions: it can optimize full class name occurrences by either adding the ‘use’ statement or removing the unnecessary part from it. It can also automatically fix code style issues with PHP CS Fixer or PHP_CodeSniffer’s phpcbf. Execute a cleanup before VCS commit, or trigger it manually at any time via Code -> Code Cleanup…..
As usual, all the features and improvements of WebStorm are available in PhpStorm, either out of the box or with free plugins available in the repository.
Updated docs and browser compatibility
The documentation (F1) for CSS properties and HTML tags and attributes now shows up-to-date descriptions and information about the browser support from MDN as well as links to the full MDN articles. Also, to check that all the CSS properties you use are supported in the target browser version, you can enable a new Browser compatibility inspection in preferences.
Improved support for TypeScript in Vue apps
PhpStorm now leverages the TypeScript language service together with its own TypeScript support for TypeScript code in .vue files. This means you’ll now get more accurate type checking and type info, be able to use the quick-fixes provided by the service, and see all the TypeScript errors in the current file in the TypeScript tool window.
New inspections for Angular apps
For Angular applications, PhpStorm adds 17 new inspections that will help you detect Angular-specific errors in your app as you type, and will suggest appropriate quick-fixes. Working both in the TypeScript and template files, these inspections will check your use of bindings, directives, components, and many other things.
New debugger console
Convert function with Promise to async/await
Recent Locations Popup
In this new navigation popup, you’ll find recently visited code points presented with a context – a couple of lines before and a couple of lines after. All the locations are chronologically ordered in this popup, with the last visited location at the top. To call up the new Recent Locations popup, press Cmd-Shift-E / Ctrl+Shift+E. Type in any text to search within the context.
A new ‘Uncheck all’ checkbox for partial Git commits lets you uncheck all the code chunks at once, and then choose the ones you want to commit. In addition, fixup, squash, and cherry-pick actions are now available right in the Git log.
The database tools in PhpStorm have got some cool improvements thanks to our colleagues on the DataGrip team:
- Support for new databases: Greenplum, Vertica, and Apache Hive
- Code completion supports combined statements for CREATE and DROP
- Support for DEFINER attributes in MySQL and MariaDB
- Support for the Oracle mode in MariaDB
- You can now set the default folder for a project
- New coloring options for primitive parameter types and class members by visibility. You can configure the color scheme in Preferences | Editor | Color Scheme | PHP.
- You can now enable soft-wraps in the editor for specific file types. To do this, open Preferences/Settings | Editor | General and specify the file types in the ‘Soft-wrap files’ field.
- PHPDoc styling configuration is improved: sort use statements, define the order of tags, and customize the number of spaces. To find all the options, go to Preferences | Editor | Code Style | PHP and look for the PHPDoc tab.