March 2024 (version 1.79)
Welcome to the March 2024 release of PHP Tools for Visual Studio!
AI Snippets
This update introduces smart snippets. Based on your code, the editor generates inline suggestions with placeholders.

Insert the snippet with TAB key. Your cursor will be placed into the first placeholder. Use TAB again to jump to another placeholder, or to the end of inserted text.
Refactorings
- Concatenation to String interpolation refactoring.
- Smart
if-elsetoswitchrefactorings.

Unnecessary Parentheses
Parentheses that can be safely removed are dimmed in the code now, and a corresponding code fix "Remove unnecessary parentheses" is available.
Formatting
Introduced the wrapping formatting option Compact empty body into '{}', which now automatically converts an empty function body into {} and maintains it on the same line as the preceding symbol, separated by a single space.
function foo() {}
Additionally, we've included support for the wrapping option Always, ensuring that the appropriate syntax construct is always wrapped.
Other Formatting Improvements:
We've changed a default behaviour how braces are indented when present directly in switch items. #1897
Improvements
- Improved type inferring and type checks.
- Improved
foreachtype inferring when taking advantage of generic type arguments and _ide_helper. - IntelliSense for eloquent Model classes.
- Support for
@psalm-yielddoc comment tag, and infersyieldresult type accordingly. - Diagnostics for
#[Override]attribute. - Support for phpdoc types
trait-string,interface-string,enum-string,callable-string. - Support for
phpcs:ignorecomment. - Improves type inferring for
array_rand()andis_array(). - More Laravel Blade tags supported (
@extends,@can), fixes syntax errors in blade tags. - Improves array type analysis for builtin
array_*functions. - Understands more doc block tags prefixed with
@psalm-, i.e.@psalm-property,@psalm-readonly,@psalm-trace, and more. - Inlay hint and variable highlighting for doc block tag
@traceor@psalm-trace. - Respects
neverreturning functions, function that exits, and function that always throws exception. - Type inferring for generic arguments inferred from lambda return type.
- Formatter handles
@formatter:offand@formatter:ondirectives in comments.
Fixes
- Code action to implement interface or abstracts adds correct type hints.
- Fixed rare Visual Studio crashes (out of memory, 100% CPU, and crash).
- Fixed unwanted space after function names which happen to be keywords as well #1481
- Avoids false
6404diagnostic when accessing variable as array. - Stability fixes.
- Fixes an issue where formatter could result in incorrect indentation for complex files containing a blend of PHP and HTML elements. #1881
- Fixes incorrect indentation of comments before class const uses #476
- Fixes a formating case when part of css selector is generated by php #1736
- Fixes incorrect indentation of attributes in function parameters #1899
- Fixes unwanted removal of new lines when formatting a specific case #1895