The January 2022 update of PHP Tools for VS Code introduces code lenses and full support for PHP 8.1. Additionally we're adding other neat debugging improvements - debugging adornments with contextually appropriate inline values, quick debug configurations, and more.
The editor should always help with the daily routines such as the debugging. Newly PHP developers can take advantage of currently debugging statement adornments with inline values.
PHP debugger choses variables and expressions you might be interested in during debugging and displays their values right in the editor. This allows to quickly focus on the context of the application and see what's happening! Note, debugger won't evaluate variables on the left side of an assignment
= operators, or more complex expressions which might have a side-effect. It shows entries of arrays the code is about to access, control variables of loops, and function parameters.
Whenever you'd like to debug a PHP application without configuring the VS Code Workspace and the corresponding
launch.json, it is now a much simpler. Open a
.php file and just press
F5 - the quick picker with automatically chosen Run and Debug configurations will appear.
The options include the currently configured Xdebug port (
php.debug.port global setting, which can be one or more ports at once), and in case of Built-In PHP Server also determined web root path.
.phpfile currently opened in the editor using
phpchosen as your default (see Choosing PHP for more details).
Recently we have introduced VS Code setting
php.debug.port which specifies the default Xdebug or DBGp Proxy port number. Now it is by default set to array of ports instead of just one number. This means PHP Tools Debugger listens for more ports at once which makes it easier to work with various setups on a single machine. The array of ports can be even used within the launch configuration
With the introduction of Code Lenses, it is appropriate to remind the PHPUnit tests debugging functionality. Navigate to a test case, and click on
Debug code lens action:
The last but not least is excluding paths from the debugger; Specifying
"exclude" launch configuration setting allows to treat certain glob paths as a non-user code; This means handled exceptions and stepping through code using
F11 won't stop in this files.