Changelog
(pre-release)
1.53.16417
Code Actions for adding use
have ID
More code action has been documented (see Code Actions List), so they can be hidden or marked as autofix. Autofix is a neat feature allowing you to implicitly apply useful code actions (when available) on file save or as using "Autofix" command.
PHP 8.4 Syntax
The editor respects the new PHP 8.4 asymmetric visibility syntax. In case your PHP version does not support it yet, the syntax is underlined as error.
Stable
1.53.16379
Code Actions Settings
Code Actions Severity can be changed now. It means certain refactorings or suggested quick fixes can be either hidden or marked as a warnings or error.
To hide a code action, use either:
- the corresponding quick fix "Do not show"
- or add the code action to
"php.problems.exclude"
VSCode setting. - or add the code action to your
.editorconfig
file.
To change its severity, add the code action to your .editorconfig
file. The following sample marks all the redundant closing tags ?>
as errors, forcing you to clean it up:
For details, see:
[*.php]
php_remove_redundant_closing_tag = error
Code Action Autofix: a code action can run as auto-fix now. See Auto-fix for details.
Diagnostics
- New diagnostic checking invalid use of
instanceof
with a trait on right side.
Fixes
Stable
1.53.16338
Formatting
We’re excited to announce the introduction of a new PER code style option in our extension, aligned with the PHP-FIG PER coding style standard. This coding style is designed to help PHP developers maintain consistent, high-quality code that follows the latest industry standards. By using PER, you ensure your project’s code adheres to a standardized format, enhancing readability, maintainability, and collaboration with other developers.
To apply this style, simply set "php.format.codestyle"
setting to "per"
in your configuration settings, and the formatting adjustments will be automatically applied to your project. This new option is a great way to streamline code formatting and ensure alignment with the PER guidelines across your PHP codebase. Happy coding!
Code Actions
The Sort Uses Code Action is a powerful tool that can be applied in several contexts: as a code action, during auto-import, and in conjunction with the editor.codeActionsOnSave
setting. This feature allows developers to automatically organize their use
statements in a consistent order, making the code cleaner and more readable.
To further customize the behavior of this feature, you can control its case sensitivity. The setting "php.sortUses.caseSensitive"
lets you specify whether sorting should take case sensitivity into account. Set this option to true
for case-sensitive sorting, or false
for case-insensitive sorting. By default, sorting is not case sensitive, so all use
statements will be ordered without distinguishing between uppercase and lowercase letters.
For more details, check out the related discussion #2127 on our community forum.
Diagnostics
- Added diagnostic for using invalid class name, i.e. a reserved class name.
Fixes
- Copilot chat window does not break IntelliSense and code diagnostics; after closing changes suggested by Copilot chat are ignored.
- Fixed finding references between methods in class and traits used by this class.
- Fixed indexing composer packages symlinked outside the project folder.
- Fixed language server crash when class is named 'parent' or any other reserved keyword.
Stable
1.52.16273
Format Settings in .editorconfig
Newly, the code formatting rules can be fully adjusted using the standard .editorconfig
file. See "customize formatting" for details.
Improvements
- Tool-tip text keeps the PHPDoc summaries formatted as they are (#2145)[https://community.devsense.com/d/2145].
- Type inferring improvements.
- Added quick action to ignore specific diagnostic globally.
Fixes
- Fixes
function
import code actions. - Fixes format on type.
- Diagnostic:
FFI\CData
can be used as array.
Stable
1.52.16226
Features
- New
PHP > Format Multiple Files
command that lets you batch format multiple.php
files. First enter the glob pattern. All the format changes will be first collected and shown in a preview window. Files will be modified upon confirmation. - New code action to change fully qualified function name to an alias (#693).
- New setting
php.format.exclude
. This allows to specify one or more glob patterns for files that won't get formatted using PHP formatter. This includesformatOnType
, format document,formatOnSave
, and format selection. Also when using the newFormat Multiple Files
command, excluded files will be implicitly unchecked during the final format review.
Improvements
- Default language level changed to 8.3.
- Inlay hints with named parameters can be inserted on double-click only when labguage level is set to PHP 8.0 or greater (#686).
.vscode-server
excluded from indexing by default (#2132).- Respecting
@property-write
together with@property-read
. - Structured array syntax in tool-tips (array types are not oversimplified in tool-tips).
callable()
with...
is properly parsed and variadic arguments are shown in tool-tips and respected by inlay hints.@template-contravariant
PHPDoc keyword (#695).- Parentheses are not inserted when completing function name after the
use function
construct or as a trait alias. - Parses
covariant
andcontravariant
modifiers in PHPDoc generic type specfication (#699). @param
from inherited class respected #702.- Anonymous function's
$this
infered from containingClosure::bind()
call #701.
Fixes
- Fix of unused use falsely reported when used in
@phpstan-import-from
. /** @var */
annotation above assignment does not mismatch types further below.private
typed properties are not shown in code completion when in non-private context.InstalledVersion.php
from composer is indexed by IntelliSense.- Fixed typo in diagnostic message.
- Falsy warning about private properties while having magic
__get
method. - Code completion after
identifier( new )->
(#678). - Fixes completion after
default
function name (#692). - Fixes falsy check for
ArrayAccess
method overrides in PHP < 8.1 (#689). - Fixes completion after function return type hint and keywords (#670).
Stable
1.51.16099
Improvements
- Checking special array function for by-ref arguments.
- Recognizes
"php-64bit"
version requirement incomposer.json
. #665 - PHPDoc
Closure()
with...
alone. #661
Debug
- Added support for
skipEntryPaths
setting, which allows specifying glob patterns to skip if the initial entry file is matched.
Fixes
- Fixes navigation to static object members through
::
operator (tooltips, goto definition, code completion). #666 #2126 - Fixes indexing of
vendor
when excluded from workspace #2100. - Fixes unwanted transformation of
FILTER_NULL_ON_FAILURE
constant to lowercase #2085. sodium
included in stubs by default.object
type hint respecting structuredobject
phpdoc type hint.- Code completion works after multiple
::
expression chain. - Fixes binding of template type arguments in inferred types #2106.
- Fixes caching of composer packages when composer is still running.
- Fixes formatting issue with
php.format.rules.alignConstants
not correctly aligning constants outside of class context when a namespace is declared. #2114 - Faster initial indexing when there's many composer packages in
vendor
folder. - "auto-import" adds
use
to the correct namespace scope. - Fixes possible language server crash when having too many
@import
directives withfrom
aliasing.
Stable
1.51.15986
Improvements
- Not showing useless tooltips (#611).
- Respects
class-string<T>
annotation when accessing static class members through indirect type. - Property access visibility check.
- Colorize constant values in PHP doc blocks in a uniform color.
- Type inferring improvements,
@global
tag inherited from base if necessary. - Refactoring suggestion
switch
->match
only for PHP>=8 (#2098). - Refactoring and find-references resolving dynamic member access to get better results (#2093).
- Enabled standard inlay hints by default.
Fixes
- Fixes missing code folding that started at the beginning of the file.
- Fixing variables completion inside double-quoted strings.
- Fixes updates to
php.stubs
not being respected. - Fixes updates to
.phar
files in workspace not being included in IntelliSense. - Fixes align
php.format.rules.alignConsecutiveAssignments
when left value of the assignments is multiline expression. #642 - Fixes mouse hover for typed const declaration.
- Fixes false warning for using
@extends
on interface. - Fixes (re-enable) quick fixes for unknown class warning.
- Keeps
@internal
functions in packages cache (i.e. keeps them in IntelliSense).
Stable
1.50.15906
Improvements
- Class constant and enum case checks are correctly case-sensitive.
- Generic type arguments syntax accepts
*
token. - PSR-4 checks for
"autoload-dev"
rules as well. - Updated integrated PHP manual, adds
SimpleXmlElement::saveXml
. - More checks for parameters passed by-ref.
Fixes
- Fixes problem after document rename on Windows, code actions were corrupted after the renaming file with different letter casing.
- Fixes PSR-4 class name and file path checks and corresponding rename code action.
- Fixes invalid type inferring after
is_numeric()
. - Fixes incorrect refactoring suggestion of
A ? A : B
. Instead?:
is correct. - Fixes override checks with implicit nullables,
never
, and traits. - Fixes use of
Function
keyword in a namespace name. - Fixes use of
Collection<T>
with just a single generic type parameter.
Stable
1.50.15872
Editor
- Highlighting of names in structured array/object types (#597).
- Highlighting of PHPDoc tag names and reserved type names using
keyword
color (depends on selected theme) (#612). - Highlights PHPDoc block above trait
use
.
PHP 8.4 Support (Preview)
This update adds support for the new PHP 8.4 features, including:
- Property hooks, and
__PROPERTY__
magic constant. new
without parentheses.- Formatting for properties and property hooks.
Formatter Blank Lines Settings
PHP code formatter has a whole new group of settings "Blank Lines
" for adjusting blank lines between various kinds of code sections. You can adjust spaces above declarations, class bodies, comments, functions, and more. See the settings for the full list of php.format.rules.blankLines***
options.
Features
"php.docblock.colorMode"
user-scope setting allows to simplify colorization of PHPDoc blocks (#612).- Checking for PSR-4 autoload rules, class names, and file names. Quick Fix for PSR-4 file name mismatch (#609).
Improvements
- Adjusted completion sorting for not-imported global types (#598).
- Magic constants (
__METHOD__
,__PROPERTY__
, etc.) are checked if they are used in a correct context. - Diagnostics improvements, fixes for
try
/finally
control flow and reachability analysis. - Improved type inferring.
Fixes
- Fixes code folding when there is a HTML folding crossing a PHP code folding. (#594)
- Fixes argument type check for
self
. - Fixes use of
@suppress
above function or class. - Fixes an issue causing unwanted spaces after formatting
require
and similar statements. - Fixes an issues when formatting complex expressions in array initializers when using the
php.format.rules.arrayInitializersAlignKeyValuePairs
setting. - Fixed an issue where unwanted line wrapping occurred in code blocks during formatting. #2057
Stable
1.49.15728
Improvements
- Doc Comment generated upon typing
/**
above declaration. This features does not requireformatOnType
enabled anymore. - Triggering suggestion after typing
$
inside double-quoted strings. - Triggering suggestion when typing a type hint inside a Doc Comment.
- Initial support for
@phpstan-assert
,@phpstan-assert-if-true
,@phpstan-assert-if-false
. - PhpUnit tests discovered in nested directories, and respecting
prefix
configuration. "source.organizeImports"
code action on save won't remove unused uses, as it might not be desirable. (#1883)- Added explicit code actions for
"editor.codeActionsOnSave"
setting:"source.source.sortImports"
: only sorts uses. The same as"source.organizeImports"
."source.source.sortAndRemoveImports"
: removes unused uses and sorts the rest.
- Recognizes unsealed array shape type (#587)
- Blade respects short open tags.
IntelliSense
- Laravel's
Macroable::macro()
gets better$this
inferrence inside nested lambda function. @param
completion with missing parameter names.
Hints (...
)
Code with an available quick refactoring is annotated using three small dots. There is a mouse tooltip with more details and a quick fix which performs the corresponding code action.
Debugger
- Added support for Unicode array keys and property names.
- Debug console provides completion for variable names.
Fixes
- Fixes
Align Properties
format rule, ensuring proper alignment even after consecutive formatting actions. - Crash fix when having
@extends parent<>
annotation, with template arguments (#585).
Stable
1.48.15635
Improvements
- Improves initial indexing, postpones discovering test cases after indexing is done.
- Optimizations, memory usage improvements.
- Better
ReflectionClass::getMethods()
type inference. - Unified logging into OUTPUT panel.
- Implementing abstract functions adds universal
@inheritDoc
doc comment. Sort uses
code action removes duplicates.
Formatting Improvements
Align Properties
The formatter now provides Align Properties
functionality to align the properties within class definitions for improved code presentation and readability. Activate this feature using the php.format.rules.alignProperties
option.
class X
{
var $a = 1;
public $bb = 2;
protected $ccc = 3;
}
Fixes
- Function override check respects
#[ReturnTypeWillChange]
attribute. - Fixes false unused variable warning about object that is used as an array (#533).
- Fixes code folding when there is
array()
or single-lined blocks. - Fixes code completion right after a comment.
- Rename and highlight occurences of private fields fixes.
- Stability fixes.
- Fixes formatting issues when php is mixed within javascript #2012
Stable
1.47.15512
Blade .blade.php
Support
- Supports
@use
directive including type aliases. The code completion and IntelliSense recognized imported and aliased classes properly. - Highlighting of
@class
directive and other inside HTML tags. - Opening and closing blade tags highlighted as PHP keywords and HTML begin/end token.
- Improves completion of PHP code, PHP functions signature help, and PHP code folding in blade files.
- Stability fixes.
Diagnostics
- Respects
/** @ignore $variablename */
so if the$variablename
is unused, the problem is not reported. - Supports more complex conditional return type, i.e.
@return ($name is class-string<T> ? T : bool)
(#538). - Fixes false unreachable code warning (#556).
- Handles checks for
method_exists
andfunction_exists
to avoid false warning about unknown functions.
New Features
- Infering lambda function parameters type from target
callable()
PHPDoc type annotation. - Added inlay hint for infered lambda parameter types. Enable
"php.inlayHints.types.lambdaParameter"
setting.
Rename Refactoring
The rename refactoring has been partially reimplemented, new rename scenarios have been implemented, and various cases fixed. The refactoring handles class/const/function imports correctly, template type names, occurences of names in strings and arrays, and more.
New Features
- Renaming aliased type names correctly so when renaming a type alias which differs from the original type, only the alias is renamed.
- Renaming aliased functions and constants behaves correctly now.
- Renaming generic types has been fixed and optimized.
- Renaming imported template types has been implemented. This works for various PHPDoc tags like
@phpstan-import-from
,@psalm-type
, etc. - Find references to template type names and type names fixed and new scenarios handled correctly.
Please let us know if there any issues with rename refactoring - we're keen to improve.
Known missing features: rename namespace, rename named arguments. Work in progress.
Improvements
- Folding for colon blocks (
if:
,switch:
,while:
,for:
,foreach:
). - Improves mouse hovers for
by-ref
functions. - Blade formatter indents PHPDoc blocks in
.blade.php
files correctly. - Adds selection range inside function header parameters.
- Expanding selection range to corresponding PHPDoc block.
- Generating getters/setters adjust the whole identifier to match
"php.completion.namingConvention"
setting. (#2011)
Fixes
- Fixes unwanted space before named arguments which happens to be keywords as well. #555
- All PHP child processes are killed after stopping debug sessions. #542
- Fixes Outline when there is an anonymus
class
(#557). - Fixes L-Value variables type in mouse hover.
- Fixes unwatend space after
empty
in lambda function #564 - Resolved an issue where setting or removing breakpoints during an active debug session caused VSCode to incorrectly flag them as unverified.
Stable
1.46.15409
Features
- Inline suggestion after
namespace
. - Folding blade blocks.
- Completion for blade tags.
.blade.php
files formatting (must be opened as a PHP file).
Blade Formatting
The blade (.blade.php
files) code formatting has been implemented. The formatter combines HTML/CSS/JS and PHP pretty print and PHP indentation, together with blade blocks indentation.
There are no further settings (yet). Based on your feedback, we'll be adding more settings and fixes!
Note, if you have another Blade extension, this feature might not be available. Make sure, the language of opened
.blade.php
file is set toPHP
(the lower right corner of your VSCode window).
HTML Auto Closing Tags and Attributes
In PHP code, HTML tag elements now close automatically when you type the >
of the opening tag. Similarly, when you enter the /
of the closing tag, a matching closing tag is inserted seamlessly.
Additionally, HTML attribute quotes are now automatically included when you type =
.
Auto Renaming HTML Tags
Auto-renaming HTML tags is enabled by default now. You can disable this feature using the following setting in your VSCode's settings.json
:
"[php]": {
"editor.linkedEditing": false
}
Improvements
- Performance and memory usage improvements.
- Shrink/expand selection works in HTML part of the php files and blade files (
Shift+Alt+Left
andShift+Alt+Right
)
Fixes
- Fixes override checks for
static
return types. - Fixes inlay hints in
.blade.php
files when modifying code.
Stable
1.45.15272
Outlining of Javascript and CSS in PHP files
You can now fold Javascript and CSS code blocks within PHP files, enhancing code organization and readability.
Fixes
Stable
1.45.15260
New Features
- Completion list shows function signatures (experimental) - enable setting
"php.completion.showParameters"
. - New code action to change
define
toconst
if applicable. - Code action to fix invalid casing of
string
PHPDoc type hint. - Diagnostic for possibly wrong
foreach
variables. - Setting
"php.completion.showDeprecated"
to control whether to hide or strikethrough deprecated symbols in completion list. They are shown and strikethrough by default.
PHPUnit Test Explorer
The test explorer respects the #[Test]
attribute and shows corresponding tests in the list.
Improvements
- Override dignostic respects possible
class_alias
of the type hints. - Override dignostic underlines trait use, it the trait introduces an incompatible method.
- Type inferring improvements.
- Handling some invalid PHPDoc type annotations.
- More quick code suggestions.
- Optimizations.
Fixes
Stable
1.45.15192
Auto renaming HTML tags
You can now rename HTML tag pairs in php files with a single edit. Turn this feature on by enabling editor.linkedEditing
in your settings.json
:
"[php]": {
"editor.linkedEditing": true,
}
Improvements
- Function hover information displays generic type arguments if any (#1915).
- Improves displaying template type arguments of trait members in hover tooltip.
Fixes
- Fixes unwanted space before parenthesis in
empty
,isset
orexit
(#522) - Fixes possible freezing when code contains complex array initializers.
- Fixes override diagnostics for
Closure
-typed parameters. - Fixes parser to allow
namespace private;
construct. - Fixes type inferring of inherited template type arguments (#503#comment)
Stable
1.45.15145
New Settings
- php.hover.parametersFullName: show full type names (shortened tu the current namespace) in tool tips.
- phpTools.suppressPremiumFeatures: disables some notifications about premium features like code actions.
Override Diagnostic
Added diagnostics for correct method override (#234), including checks for correct use of #[Override]
attribute.
Additionaly, the editor provides quick fixes for common override errors.
Improvements
expectedArguments()
from.phpstorm.meta.php
respects class name scoping, use of mixins, and traits. (#1929)- Type inferring improvements.
Fixes
- Automatic
organizeImports
andfixAll
does not slow down VSCode when premium not active. (#504) - Fixed missing
mixed
in code completion. - Fixed some missing Eloquent model functions.
- Fixed structured array doc comment type with
@
in an entry name. (#508) - Fixed unwanted space after
return
when formatting. #509 - Fixed initial load of Test Explorer (#1934).
- Fixes wrapping of
unset
statements, it's controled bycallParametersWrap
option. #518
Stable
1.45.15061
Improvements
- Automatic parentheses completion works in combination with IntelliPHP suggestions.
- Improved type inferring and type checks.
- Improved
foreach
type inferring when taking advantage of generic type arguments and _ide_helper. - Blade syntax highlighting for inline tags.
- Code formatter pretty prints PHP code in
.blade.php
files. - IntelliSense for eloquent Model classes.
Refactorings
- Concatenation to String interpolation refactoring.
Formatting
Introduced the php.format.declCompactEmptyBody
option, 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.
Fixes
- Fixed semantic highlighting in
.blade.php
files. - Updating problems after adding/removing
"php.stubs"
, or adding/removingext-**
incomposer.json
'srequire
. - Code action to implement interface or abstracts adds correct type hints.
- Fixed rare language server crashes (out of memory, 100% CPU, and crash).
- Fixed unwanted space after function names which happen to be keywords as well #1481
- Fixed formatting that was not working at all.
Stable
1.44.14997
Improvements
- Improved format selection for mixed PHP, HTML/CSS/JS code, improving
editor.formatOnType
andeditor.formatOnPaste
behaviors. - Support for
@psalm-yield
doc comment tag, and infersyield
result type accordingly. - Diagnostics for
#[Override]
attribute. - Support for phpdoc types
trait-string
,interface-string
,enum-string
,callable-string
. - Support for
phpcs:ignore
comment.
Tool-Tips Improvements
- Tool-tips show shorter type names (can be changed using
"php.hover.parameters.fullname"
setting). - Signature help tool-tips shows
never
return types if appropriate. class-string
type hint fixes.
Fixes
- Highlighs blade tags correctly inside HTML comments.
- Fixed completion of function override.
- Fixed incorrect indentation of multiline expression parts when preceded by line comments.
- Avoids false
6404
diagnostic when accessing variable as array. - Updates related diagnostics in other files when a file changes.
- Stability fixes.
Stable
1.44.14950
Improvements
- Automatic format-on-type after typing
default:
orcase ... :
. - Improves mouse hover for function signatures with more detailed
array
type specification. - Improves type inferring for
array_rand()
andis_array()
. - Fixes use of
{{
in PHP code. - More Laravel Blade tags supported (
@extends
,@can
), fixes syntax errors in blade tags.
Stable
1.44.14925
Laravel Blade Editor
This update enables experimental colorization of PHP syntax inside Laravel Blade tags:
- colorize code inside
{{
/}}
,{!!
/!!}
,{{{
/}}}
,@php
/@endphp
- colorize code in Blade tag expressions, i.e.
@if ( ... )
- colorize blade tags
- colorize blade comments, i.e.
{{-- ... --}}
Additionally, all the nested PHP code gets the standard features including IntelliSense, diagnostics, code actions, code fixes, tooltips, and more.
Improvements
- Automatically formatting code after applying a code action or a code fix.
- 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
@trace
or@psalm-trace
. .blade.php
files overall parser improved - respects@php
and<?php
blocks, respects most documented blade tags and blocks.- Respects
never
returning functions, function that exits, and function that always throws exception. - Shows tripple dots when code action available.
Code Actions
- Quick refactoring of
if
intoswitch
if possible. - Remove unnecessary parentheses, and dim them.
Formatting
We've changed a default behaviour how braces are indented when present directly in switch items. #1897
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 tooltip of
never
returning functions. - Fixes incorrect indentation of attributes in function parameters #1899
- Fixes unwanted removal of new lines when formatting a specific case #1895
- Stability fixes.
Stable
1.43.14858
Unnecessary Parentheses
Parentheses that can be safely removed are dimmed in the code now, and a corresponding code fix "Remove unnecessary parentheses" is available.
Improvements
- Type inferring for generic arguments inferred from lambda return type.
- Formatter handles
@formatter:off
and@formatter:on
directives in comments.
Formatting
Based on user's feedback #395, we've added a new code style for Joomla developers! To enable it set "php.format.codeStyle"
setting to "joomla"
.
Fixes
- Code style (
"php.format.codeStyle"
setting) for"drupal"
fixed - inserts spaces. - Completion after
::
operator fixed. - Avoids triggering completion when typing a new array
[
... - Fix of wnwanted space after
case
identifier #469 - Fixes incorrect occurences highlighting when there are arrays with two empty strings.
- Memory and performance improvements.
- Fixes bug causing constant CPU use, and never-ending devsense.php.ls process.
Stable
1.43.14756
Code Completion for $_SERVER
and $GLOBALS
Code completion provides known array keys for $_SERVER
and $GLOBALS
superglobal variables. Type inferring also takes them into account.
Code Completion for Array Keys
Array keys are listed and completed as possible. This works great with structured array doc comments (e.g. array{name:string,id:int}
) and array initializers (e.g. new ['name' => "John, 'id' => 1]
).
Code Actions and Refactorings
- Code Action to generate getter/setter for a constructor property.
- Code Action to simplify
isset(A) ? A : B
.
Improvements
- Doc Block with multiline
array<>
syntax supported. - Doc Block with
@psalm-type
definition using=
character supported. - Doc Block with
@var
defining a type of a whole expression (not just a variable) is handled. - Type analysis improved in case there is a lot of array types with key names.
- Type analysis handles complex L-value of
instanceof
operator. - Type analysis improved in case there are a lot of array types with key names.
- Type analysis for
??
operator improved. - Improves handling global variables in WordPress source code.
- Code completion for array keys, type inferring for array entries, and trigering completion after
[
. - Inlay hint for variables by reference (
&
) and expressions type won't be inserted on double-clicking. - PHP language level respects
composer.json
if no specificphp.version
is set.
Formatting
- Implemented chained method calls wrapping based on user request (#1868). Currently, only the
always
option is allowed for this setting. - Added the ability to specify the placement of the semicolon on a new line when method chaining wrapping applies.
Debug
We've added maxConnections
launch setting to control the maximum number of simultaneous debug sessions. #353
Fixes
Stable
1.42.14626
Improvements
- Improved
array_unshift()
type analysis. - Refactoring of
private
properties. - Refactoring of property names specified inside
property_exists()
function. - Improved detection and completion for eloquent local scopes.
- WordPress's structured array/object doc comment syntax is recognized and respected by code analysis and code completion.
- Tooltip for variable annotated with
@var
with inline description. - Workarounds diagnostics in incorrectly generated type names in
_ide_helper.php
. - Diagnostic for
${}
deprecated string interpolation and corresponding code action. - Diagnostic for redundant closing
?>
tag and corresponding code action.
Fixes
- Updated PHP parser to handle keywords in PHP8+ FQN namespace syntax.
- Startup fix when opening a workspace from
ftp://
remote using some FTP extensions. - Fixes falsy diagnostics of unreachable code.
- Not reporting unknown property if it was checked with
property_exists()
. - Fixed inlay hints in ambiguous function calls (function defined on two places or opened in two files).
- Crash fixes.
Stable
1.42.14434
PHP Stubs UI
Adding a quick command > Workspace Stubs
which popups quick selection of stubs (PHP books and other stubs including "WordPress"
) to be available to IntelliSense and Code Analysis.
"source.fixAll"
Action
Safe quick fixes, such as simplifying a name, can be auto-fixed on file save. Use the following settings to apply safe quick fixes on file save:
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
}
Debug
Breakpoint Resolution
Improved breakpoint resolution by validating breakpoint locations through information from Xdebug. Notably:
- Bound breakpoints are highlighted in red.
- Unbound breakpoints are visually distinguished in grey.
- In cases where a valid location close to the breakpoint couldn't be bound, the breakpoint is automatically adjusted to the valid location.
xdebug_notify Support:
Added support for xdebug_notify()
, enabling the sending of information and objects to the debug console. This feature enhances the debugging experience by facilitating the communication of relevant data directly to the console.
Error and Warnings
We've implemented the output of PHP warnings and errors to the debug console. This approach provides a centralized location for developers to monitor and address issues during debugging sessions.
Improvements
- Quick Fix for missing function
use
. - Added
php.stubs
fornewrelic
. - Implicitly includes PHP stubs from
composer.json
into IntelliSense and Code Analysis. - More complex PHP executable: This allows using a remote
php
, or a custom command to runphp
. Settingsphp.executablePath
orphp.executables
can have a command with arguments (i.e.ddev exec php
). NOTE: double-quotes might be needed now. - PHPUnit path can be absolute: Put the setting
phpunit.phpunit
into double-quotes to keep the path to your custom phpunit as it is, i.e."phpunit.phpunit": "\"phpunit\""
. - PHPUnit command can be customized: Using new setting
phpunit.command
you can customize the command to run PHPUnit etirely. Use variables for customize the command:${cwd}
: workspace root path, local. The command will be executed in this directory.${phpunit}
": path to phpunit binary. It's automatically resolved or it can be cutomized withphpunit.phpunit
setting.${phpunitxml}
: path to the phpunit.xml relative to the workspace root.${phpunitargs}
: constructed PHPUnit arguments. (we need --teamcity and --filter to function properly)${phpargs}
: optional arguments to PHP which we use to ensure PHP runs and debugs correctly.
Formatting
In response to feedback from you (source) we've implemented two additional options aimed at enhancing code formatting flexibility:
Keep Functions on a Single Line
Introducing the `php.format.rules.keepFunctionsOnOneLine`` option, which allows users to instruct the formatter to refrain from wrapping functions or methods if they are on a single line. This empowers developers to maintain a concise and consistent coding style.
Keep Classes on a Single Line
With the new `php.format.rules.keepClassesOnOneLine`` option, you now have the ability to prevent the formatter from wrapping classes when they are on a single line. This feature supports the preservation of a streamlined and compact structure in your codebase.
Fixes
- Code Action to sort and remove
use
s fixed, when in a global namespace. - Improves resolution of methods returning
static
/$this
(#1820). - Inlay hints position fixed, when editing code near them.
- Fixed Go To Source in Test Explorer.
- Rename refactoring shows Preview when change might be dangerous.
- Rename refactoring handles constructor properties propertly (#450).
- Various code analysis improvements.
- Workarounds for various
_ide_helper.php
bugs. - Fix of conditional breakpoints. Previous version broke this feature in certain cases.
- Fix code action to implement interface with
static
functions (#446). - Fix of incorrect formatting in nested associative array with multiple functions (#432).
- Fix for the
invalid or missing options
warning when starting a debugger with an older Xdebug version #1816
Premium
- Note: Code Actions, and Code Fixes are available in PREMIUM. It may have worked unintentionally without a license before this update.
Stable
1.41.14263
Formatting Improvements
Comments
In this update, we've made improvements to how comments are handled. Now, comments that follow after an expression are preserved in their original positions, giving users the flexibility to indent them as they prefer.
$x = [
1 => 'one' // first comment
42 => 'fortytwo' // second comment
]
Align match arm bodies
The formatter now offers "Align Match Arm Bodies" to align the bodies (results) within match
expressions for enhanced code clarity and structure. Enable this feature with php.format.rules.alignMatchArmBodies
option.
match ($day) {
'Monday' => 'Work',
'Tuesday' => 'Tacos',
'Wednesday' => 'Waffles'
};
Doc Comments and Type Annotations
-
Structured
object
Type: dynamic objects can be annotated within doc comment usingobject{property:type,}
syntax. -
Global
@type
Aliases: type aliases can be defined in the scope of the entire file using doc comment@type
,@phpstan-type
,@phpstan-import-type
,@psalm-type
,@psalm-import-type
. Previously, it only worked above classes and functions. Now it is also valid in a doc comment/** */
anywhere in the global file scope. -
Code Actions for qualified names in doc comments (#428)
-
@method syntax with modifiers is supported, i.e.
@method public static foo()
. This is an unusual syntax, although we do understand it now.
redis
Stubs Added
"redis"
can be added to your "php.stubs"
VSCode setting. This adds type checking and IntelliSense for using the redis
extension.
Diagnostics in Rename Preview
When renaming a symbol with preview (F2
, Shift+Enter
), newly the preview window gets analyzed and errors and warnings are underlined.
Debug
Random Xdebug Port
As of now, specifying "port": 0
in your launch.json
is treated as a random available port. php
is started automatically with the corresponding xdebug.port = ${port}
directive. By default, the port is already chosen randomly if you don't specify anything. Most of Run & Debug commands simply work now.
The sample launch configuration, which starts Built-In Web Server, initiates debugging, and opens the browser:
{
"name": "Launch Built-in server",
"type": "php",
"request": "launch",
"runtimeArgs": ["-S", "localhost:8888", "-t", "public"],
"port": 0,
"serverReadyAction": {
"action": "openExternally"
}
}
You can also omit "port": 0,
completely since it is a default value for this launch configuration.
Note, default ports when just listening for Xdebug are still
[9003, 9000]
.More at: https://docs.devsense.com/en/vscode/debug/launch-json#built-in-php-server
Quick launch commands (pressing F5
without having launch.json
) uses random available Xdebug port as well. There is nothing you need to do.
Expression Evaluation Enhancement
Now, expressions can be expanded into deeper levels in various contexts, including the Debug Console and Watch Window. Enjoy enhanced debugging with improved evaluation results.
Run/Debug current PHP File
Now, you can run or debug the currently opened PHP file with quick Run/Debug buttons in the top right corner of the editor.
Fixes
- Fixes the wrapping behavior, ensuring that comments are maintained on their original lines when they follow an expression. #1760
- Fixes
php.inlayHints.parameters.suppressNameMatchingValue
setting. - Fixes code indentation after applying "Implement abstracts" code action.
- Fixes
use
code action insideenum
. #425 - Fixes web extension running in browser (vscode.dev).
- Fixes navigation and completion in
@see
tag when in a namespace. - Fixes LS crash (stack overflow). #427
- Fixed unwanted space removal between
readonly
and type in property promotion #433 - Improves mouse hover tool-tips in case there are ambiguous symbol declarations.
Stable
1.40.14103
Introducing IntelliPHP 🚀
We're thrilled to announce, that PHP extension bundles with IntelliPHP now.
IntelliPHP: Your Local PHP AI - provides whole-line suggestions as you type, instantly. Complete the suggestion with TAB
key and be more productive! Read more ...
Minor Features
"php.inlayHints.insertOnDoubleClick"
setting to enable or disable inserting the inlay hint on double-click (#1717).array_multisort()
does not treat the first argument as strictly passed by reference (#1729).- go to and code completion of file paths improvements (#1735).
@see
and@exception
in tool tips.list{}
doc comment shape.
Formatting
New PHP 8.3 syntax is supported by the formatter.
Final New Lines
By default, the formatter will no longer trim final new lines. Final new lines will be preserved as they are. However, if you have files.insertFinalNewline
enabled and a final new line is missing, the formatter will automatically add one for you.
Fixes
- Fixed installation on code-server and GitHub CodeSpaces.
- Fixed
vendor
folder with recursive symlinks (#1720). - False named argument error in case the method accepts variadic arguments (#1722).
- Fixed possible stackoverflow and language server crash (#1724).
- Fixed analysis of generators return type.
- Fixes improper formatting when named argument as a keyword #408
- Fixes incorrect indentation inside constructor #409
Stable
1.39.13943
Class Name Inline Suggestion
Newly, when typing a new class, the class name is suggested based on the file name. The suggestion takes advantage of the Visual Studio Code's inline completion UI, so it's non disruptive; accepted with TAB
key.
In combination with IntelliPHP, the inline code suggestions are even more detailed and powerful!
Completing File Paths
Since this update, the editor is completing and navigating to files #402.
Fixes
- Old-style
composer/installed.json
file supported. - Fixes some formatting issues that occurred when mixing PHP with HTML.
Stable
1.38.13918
Setting for Getter/Setter Naming Convention
Added setting for naming convention of generated getters and setters.
PHP 8.3 Syntax
Adding support for PHP 8.3 syntax features including:
- Typed class constants
- Anonymous readonly classes
- Dynamic class constant fetch
Formatting
In response to user feedback(#384, #1691, #684), we have introduced additional formatting options that allow users to precisely control the automatic placement of commas in their PHP code.
These new options include:
php.format.rules.addCommaAfterLastArrayElement
: Adds a comma after the last element in an array.php.format.rules.addCommaAfterLastCallParameter
: Adds a comma after the last parameter in a function call.php.format.rules.addCommaAfterLastDeclParameter
: Adds a comma after the last declared parameter in a function or method signature.
In addition to the above, we've also introduced the following formatting options:
php.format.rules.booleanConstantCasing
: Defines casing fortrue
andfalse
constants.php.format.rules.nullConstantCasing
: Defines casing fornull
constants.
Fixes
- debugger handles file paths with
%
character #380 - caching /vendor/ fixes
- problems gets updated after composer updates
- memory use optimizations
- avoids showing keyword tooltip if it's not a keyword
- avoids showing duplicit items in peek window
- When using Drupal code style, the formatter changes all True/False/Null constants to upper case. #870
- When multiple changes to settings changes for formatting or inlay hints were performed at once, only the first change was considered; subsequent changes were ignored.
- Resolved formatting issue related to the PSR-12 coding standard for multi-line argument lists. The closing parenthesis and opening brace are now correctly placed together on their own line with one space between them, in accordance with the PSR-12 standard.
- More fixes of code diagnostics and IntelliSense.
- Array initializer values are now formatted with an additional level of indentation. #935
- Fixes other formatting issues related to multi-line array inititializers.
- Stability fixes.
Stable
1.38.13779
Fixes
- sticky scroll #387
- tooltip for
default
case #1692 - tooltip for attributes
- fixes type analysis of parameters without type specified
- fixes problems analysis setting
- caching of /vendor/ fixes
- fixes use of
static
in /vendor/ files #389 - fixes temporary cache incorrectly created in the workspace X/1697612088196137243
Stable
1.38.13759
Optimized Loading and Memory Use
With this update, we're starting to cache composer.lock
with vendor
folder. This significantly improves opening workspaces based on Composer packages, and drops the RAM usage to bare minimum.
For our insiders, see your OUTPUT
/ PHP Language Server
panel for what it's doing.
Inlay Hints for Attributes
Newly, attributes above classes will have inlay hints with parameter names (#383), if enabled.
scalar_objects
Support
Thanks to the suggestions #378, we're adding native support for the scalar_objects
extension by Nikita Popov.
The editor recognizes register_primitive_type_handler()
calls, and allows completion for specified scalar types.
Formatting
In direct response to user request we've added formatting options to align constants php.format.rules.alignConstants
and enum cases php.format.rules.alignEnumCases
. Maintaining consistent alignment is now effortless:
class X {
const a = 1;
const bb = 2;
const ccc = 3;
}
Code Analysis in Virtual Files
We have enabled full code analysis for files that are virtual - i.e. diff views, peeks, git preview, etc. This allows to analyse for changes you're about to submit easily!
Outline with Symbol Details
Thanks to the suggestion #109, we have added more details to the document outline. It shows methods access, class access, and interface
, trait
, enum
kinds.
Fixes
- Fixes lag when closing VS Code or a Workspace.
- Fixes
use
statements sorting. - Fixes go-to-def of a method defined in a
trait
. - Fixes
@psalm-import-type
phpdoc tag support. - Fixes inlay hints when there is a
new
without parameters. - Fixes rename refactoring of static methods.
- Optimizations.
- Fixes formatting issues that occurs when using reserved words in namespaces, such as default
Stable
1.37.13534
Completion Namespace Label
Newly, the code completion shows namespaces next to class names. This feature is enabled by default, and can be controlled with "php.completion.showNamespaceLabel"
setting.
Completion Colored Details
The code completions popup is formatted and colorized as well.
IntelliSense
- Class name completion in single-quoted strings has been added.
Fixes
- Fixed infinite RAM usage (#343)
- Fixed array not automatically aligned #364
- Duplicit warnings have been fixed.
- When Folding HTML tags, the closing tag stays visible. #363
- Fixed removing spaces for variadic arguments #1639-2
- Resolved multiple issues pertaining to the nesting and combination of HTML tags with PHP tags. #1634
Stable
1.36.13417
Debugger & trigger
Setting
New launch setting "trigger"
allows to control whether to debug or ignore certain requests.
{
"name": "Debug built-in server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-S",
"localhost:8000",
"-t",
"./public"
],
"trigger": "THIS",
},
The launch.json
setting above will start the built-in Web Server, configure all the Xdebug directives, and waits for requests. Only requests with the GET
parameter XDEBUG_TRIGGER=THIS
will be debugged. Any other request will be ignored by the debugger. I.e. request to http://localhost?XDEBUG_TRIGGER=THIS
will initiate debugging, but http://localhost
will not.
IntelliSense & IteratorIterator
IteratorIterator
and RecursiveIteratorIterator
are extended with generic type argument TInner
, @mixin TInner
, and their __construct()
infers this TInner
. Therefore, IntelliSense knows the inner iterator type and so it can provide inner iterator's members. (#1613)
New IntelliSense Features
@phpstan-type
and@phpstan-import-type
are supported (#1543).phpstan.neon
(and.dist
alternatives) in containing directories processed; supporting their global type aliases (phpstan.neon
file's"typeAliases"
setting).- Handling
Collection<TValue>
,Iterator<TInner>
correctly. - Undefined properties accessed with magic
__get()
reported with lower severity. - Fixes trait adaptation and class inheritance analysis. Classes with complex inheritance with trait
use
with adaptation are analysed correctly giving unseful insights about missing method implementation. - Fixes control-flow analysis of certain
try
/finally
blocks. - Improves Laravel IntelliSense.
Namespace Auto-Import
There is already namespace auto-import feature, which seamlessly adds correspding use
or fully-qualifies names when using code completion. There are also code actions where you can choose a new namespace to import. Additionally we're adding commands Import class ...
and Fqn class ...
to import a namespace using command bar (F1
) and quick-pick window (#450).
Stability Fixes
- Memory leak when having
.phar
files in the solution has been fixed.
Stable
1.35.13327
Organize Uses
The action known as Organize Imports can be invoked anywhere in source code now (#349). Removing and Sorting use
statements affects the entire block of code, not just a single line.
Composer
Path to composer.phar
can be set explicitly using the setting composer.bin
. Also, resolving composer.phar
has been improved so it mostly uses your own already installed composer. Otherwise, if user does not have composer installed, it gets downloaded and used seamlessly, witnout the need of doing anything.
Refactoring
Trait function members are resolved in semantic highlighting, finding references, code lenses with method overrides, and rename refactoring.
Debugger & Phar
The extension parses and understands .phar
files. Since this updated, debugging and stepping through a code inside a .phar
file works. Phar file is decoded, opened, and current statement highlighted as it would be a regular .php
file. Local variables can be also inspected and inline debug values works as well.
Stability
This update fixes an issue related to the process not being terminated when code
gets closed.
Stable
1.34.13295
IntelliSense & @phpstan-type
and @psalm-type
Since now, we have a basic support for local type aliasing.
IntelliSense & Traits with Generics
Newly, trait
use can be annotated with @use
doc comment to specify the trait's generic arguments (#840), i.e.:
class MyClass {
/** @use MyTrait<int, string> */
use MyTrait;
}
IntelliSense & static
Type
We have reimplemented the internals and improved type analysis for various cases involving use of static
and $this
within traits, protected properties, and class inheritance in general. Moreover generic arguments and trait members are resolved better with more inherited type information (#931).
PHPUnit Tests & Continuous Run
Newly it is possible to run tests continuously. The watch icon in Testing panel allows to keep all the tests, test suites, or just specific test cases always up-to-date. (#1479)
Minor Improvements
- Code completion of named arguments completes the
:
at the end. (#1600) - Code completion of hinted array keys within single quotes. (#1600)
- Completion triggered after typing SPACE after
instanceof
keyword.
Fixes
- Fixed a few memory leaks!
match
,fn
, andinterface
are not reported as syntax errors when within a qualified name (PHP 8.0+).- PHP 8.2 standalone
true
,false
, andnull
type names. (#338) - Fixed a few type inferring cases.
- Fixed reporting functions annotated with
@ignore
tag as unknown. - Type hinting through
/** @var */
aboveif
fixed. - Fixed check of
define()
. (#340) - Fixed issue causing removal of new lines when formatting after abstract method. #1525
- Arrow functions now respect php.format.rules.spaceWithinDeclParens to add spaces within parentheses. #1536
- Fixed unwanted space when function is named as keyword #335
- Do not increase indentation if previous sibling node ends on the same line #333
- Fix of array items aliging when keys are not simple literals #1602
Stable
1.34.13120
IntelliSense
Trait Adaptation Blocks
Code completion and tool-tips in trait
adaptation blocks have been implemented. (#582)
Other Improvements
- Type inferring in the context of
is_a()
analyzed correctly. - Less falsy warnings for non-static methods called statically in case there is
__callStatic()
magic method. - New quick refactorings through code actions.
- Updated integrated PHP manual and localizations.
Add Missing PHPDoc
The Add Missing PHPDoc
code action inserts the doc comment as a snippet (#157(comment)). This replaces template variables and allows you to type into placeholders.
Formatting
We've added an option that enables you to turn formatting on or off within a specified range of code. The code between a comment // @php-format off
or /* @php-format off */
and a corresponding comment // @php-format on
or /* @php-format on */
will not be formatted.
Additionally, We've added a new option php.format.rules.declKeepRightParenAndOpenBraceOnOneLine
which will keep the right closing parenthesis )
of a function or method declaration header on the one line as opening brace of the body {
.
The other options that allows for more formatting customizations include:
php.format.rules.openBraceOnNewLineForNamespaces
which place open brace{
on a new line for namespace declarations.php.format.rules.openBraceOnNewLineForBlocks
which place open brace{
on a new line for all types of code blocks, except for those controlled by other formatting rules.php.format.rules.spaceBeforeParenthesesInControlStatements
which insert a space before parentheses in control statements.php.format.rules.spaceBeforeParenthesesInCalls
which insert a space before parentheses in method, function and constructor call parentheses.php.format.rules.spaceBeforeParenthesesInDeclarations
which insert a space before parentheses in method, function and constructor declaration parentheses.
Inlay Hints
We've added an option to show return type inlay hint only for named functions, not for anonymous functions and arrow functions (#326).
Fixes
- Respecting
class_alias()
within type checks and type inferrence checks. - Respecting
@return $this
and treating it asstatic
return type hint. - Respecting
"php.completion.autoimport-docblock"
setting when generating PHPDoc above functions (#896). "mongodb"
stub updated and fixed some missing MongoDB classes and functions. Use setting"php.stubs": {"*", "mongodb"}
to use it (#927).- Find All References performs type analysis if necessary to provide better results (#322)
- Fixed use of named parameters of methods introduced with PHPDoc
@method
tag (#921). - Properly handling the nullable
?static
type. - Code diagnostics improvements, avoids a few falsy warnings.
- Fixes internal error when completing user snippets.
- When multiline php code was present inside javascript string, formatting wasn't working correctly #908
- Fix of incorrect indentation when named arguments were used in multi-line static function calls.
- Fix of unwanted compacting of new lines when multiple foreach colon blocks were used. #893-12
- Fix of incorrect indentation of named arguments in certain cases #928
- Fix of incorrect indent of pseudo class constant #932
- Fix of formatting when php was inside script/style tags. #1460
- Fix of lossing indentation in multiline comments delimited with
/*
#1489 - Fix of formatting removing empty lines in
/*
comments #1522 - Fix of incorrect indent in multiple nested multiline lambda functions#1500
Stable
1.33.12934
IntelliSense
Supporting .phpstorm.meta.php
with expectedArgments()
and argumentsSet()
now.
Fixes
- Formatting was compacting whitespaces after arrow or lambda functions (#913).
- Internal exception fix when navigating to definition ("Go To Definition" command).
- Crash fix for rare cases in huge files in Drupal.
- Added the missing
static
keyword in code completion in function body. - IntelliSense/Code analysis handling
iterable<K,T>
(with 2 generic arguments) the same as PHPStan does (#914).
Stable
1.33.12924
Test Explorer
The Test Explorer looks and watches for any PHPUnit XML configuration file matching glob pattern **/phpunit*.xml
or **/phpunit.xml.dist
(outside the vendor
folder) #313. This allows having multiple configuration files in the same directory with custom names.
Additionally, we have fixed:
- Executing all tests within a configuration file.
- Executing all tests within a single test suite.
- Correct Xdebug directives so it won't cause unnecessary warnings when debugging tests.
ParaTest
This update allows running ParaTest in the same way as PHPUnit tests. To do so:
- Install ParaTest composer package using the command
Composer: require dev package
, and search packagebrianium/paratest
. - Update your workspace settings:
{ "phpunit.phpunit": "./vendor/bin/paratest" }
- Navigate to Testing panel and run or debug your tests.
Sort Uses on Save
The following setting works for sorting and organizing use
statements on save:
{
"editor.codeActionsOnSave": { "source.organizeImports": true },
}
IntelliSense
Now it's possible to Ctrl
+Click
(or go to with F12
) on @inheritdoc
to navigate to base Doc Comment directly. #897
Additionally, return type hint in signature help is respecting template (generic) arguments.
Composer "composer.workingPath"
Setting
Thanks to the feedback #909, we've added setting "composer.workingPath"
where users can specify the relative path for the composer.json
and vendor
folders.
Fixes
- Memory leak happening when updating/removing
.phar
files in the workspace fixed. (happens usually oncomposer update
andrequire
.) #291 - Not auto-completing parentheses
()
afterarray
,require
/include
,exit
, anddie
. - If a multiline HTML attribute was enclosed in single quotes and located within a PHP blocks, it would be indented during every formatting session. 882
- Fixed rare case when mixed html/php formatting resulted stopped the formatter. 887-B
Stable
1.32.12895
IntelliSense
null
specified as Doc Comment@param
type is reported as invalid.true
pseudo-type correctly handled within union types.- Methods named
new()
are handled correctly in mouse hover and code completion. - Detecting Laravel services improved.
- Initial implementation for
expectedArguments()
PHPStorm meta. - Completing
declare
anddeclare(strict_types=1);
after<?php
tag.
Refactoring
- PHPDoc
@see
and@uses
is recognized during rename refactoring, find all references, and highlight occurrences. - Unused
use
check works even if problems setting is turned off. - Namespace import for any simple class name. We have code action suggestions to import a namespace or fully qualify the class name if there are more classes with the same name.
Organize Imports
We have added support for VS Code's "organize imports" command and eventual "editor.codeActionsOnSave"
setting allowing you to organize imports (aka remove unused uses) when saving documents automatically.
Fixes
- Stability fixes.
- Smart select fixes.
#!
at the beginning of file not reported as syntax error.- Properties on some
mixed
types not reported as unknown. - Format supports indenting PHP8 attributes which are spread over multiple lines #879
- Format was removing whitespaces when
readonly
orstatic
was used as function argument name. - Fixed the case where formatter was adding an extra space between
new
and()
#883
Stable
1.31.12821
Fixes
- Breadcrumbs fixed. (#302)
- Unrecognized Psalm and PHPStan special type names. (#860)
- Global variable type check fix (#303)
- Mouse hover looks into
@mixin
s for properties. - IntelliSense: Methods from both Laravel facade and DocComment
@method
gets resolved as expected. - Fixes
rg
processes spawned by VS Code (#877). - Fixes a complex html/php mixed formatting issue. #852
- Fixes incorrect indentation of multi-line chained call. #862
- Fixes position of open brace in method or function declaration when multiline header is provider in
PSR-12
. #305 - Fixes unwanted newline after lambda function passed as an argument to a method or function. #306
- Fixes formating of enums with backing types implementing interfaces.
- Fixes indentation of named arguments when function call is multiline. #863
- Format selection didn't work in certain cases when invoked with html/php mix.
- Format doesn't indent php code block in html comments #872-3
Stable
1.31.12740
Inlay Hints
Newly Inlay Hints for PHP code are available!
The inlays are available for parameter names, by-reference arguments, and inferred function return types.
To enable or disable the inlay hints, change the following settings:
"editor.inlayHints.enabled"
"php.inlayHints.parameters.enabled"
"php.inlayHints.parameters.byReference"
"php.inlayHints.types.return"
"php.inlayHints.types.variable"
See the documentation for more details.
Quick Fix for missing Doc Comments
New code action adds missing doc comments with inferred type information and summary placeholders. The functionality is the same as by typing /**
above a function/class/property/constant or define()
call, but it can be invoked through a code action and it can be invoked over a whole selection of code for multiple declarations at once. (#226)
Smart Select
Visual Studio Code's selection range feature allows to quickly select syntactic elements; the PHP extension provides selection range for all the statements, declarations, and blocks of code.
Formatting
Another feature request we received quite often was to introduce Drupal
code style #795. So we're happy to announce Drupal
code style has been introduced in this version.
Formatter respects files.InsertFinalNewLine
option now. #837
Fixes
- Fixes highlighted range when peeking definitions (#288)
- Fixes some internal exceptions.
- Fixes mouse hover when code is syntactically invalid.
- Fixes "Search TODO" command if there are remote:// or git:// files in the workspace, possibly after using git merge, or diff window.
- Fixes indexing directories inside
.git
and other special directories when changed. - Types specified in Doc Comments can be
$this
keyword as an alias toself
, i.e.callable($this)
(#843).
Formatting Fixes
- Fixes formatting when multiple method calls chained when object was inside parenthesis.[#820/8].(https://community.devsense.com/d/820-heredoc-with-interpolated-variables-breaks-auto-formatting-for-the-entire-file/8)
- Fixes formatting of mixed JS and PHP. #820/5
- Fixes case when JS formatting with php code inside was moving
}
on each format. #820/7 - Fixes case when insides of multi-line HTML attributes, comments or CDATA were indented on each format. #820/12
- Fixes case when linux line endings caused different format output when mixed languages were present in php file.
- Fixes case when
use
with alias same as class stopped the formatter. - Fixes double indentation when array access and member use is combined in multi-line expression. #842
- Fixes unwanted space after ampersand in ref assignment #846, but in the same time respects this notation as well
$a =& $b;
. - Fixes unwanted double indentation in multiline expression containing array item access.
- Fixes unwanted new line when line comment precedes
elseif
,catch
,finally
. - Fixes unwanted space between
static
orself
and(
when creating a new instance of the object. - Fixes formatter removing spaces aroung bitwise
&
operator. - Fixes unwanted double indentation of object's field access in constructors calls when spread along multiple lines.
- Fixes
php.format.rules.alignConsecutiveAssignments
when combined with different kind of left expressions. - Fixes missing space when reseved types were used as a type hint.
- Fixes incorrect commend indentation when used in multiline chained function calls.
- Fixes ocassional missing space after
)
whenphp.format.rules.keepControlStatementsInOneLine
option is used. #852-2 - Fixes unwanted space in multiline ternary operator.
- Fixes unwanted space after function with the same name as PHP keyword.
- Fixes static member access double indent when
static
keyword was used. - Fixes incorrect indent when member was accessed in multiline constructors call.
- Fixes unwanted space after identifier named
default
. - Fixes case when attributes in function declaration parameters stopped the formatter.
- Fixes case when trait use in namespace might have stopped the formatter.
- Fixes case when trait use with changing visibility to public stopped the formatter.
Stable
1.30.12484
Fixes
- Code Formatter fixes.
- Fixes various standard functions missing, and missing ambiguities.
- Homebrew
php
recognized on macOS. - Fixed formatting of heredoc with interpolated variables #820
Stable
1.30.12450
Editor
Folding use
has been added; this allows to collapse the block of use
statements (tweet).
Getter/Setter
Newly, code inserted by adding getters and setters can be customized using settings "php.completion.getterSnippet"
and "php.completion.setterSnippet"
. In this way, you can add various value handling and customize return values, or add comments for yourself (#813), i.e.:
"php.completion.setterSnippet": "{PROPERTY} = sanitize(${NAME}) ?? throw new InvalidArgumentException('Invalid ${NAME}!');\n//done\nreturn {THIS};",
Formatting
-
Backed enumerations are supported.
-
New setting
php.format.rules.keepControlStatementsInOneLine
. #810 -
Setting
php.format.rules.SpaceBeforeColonInControlflowStatements
renamed tophp.format.rules.SpaceBeforeColonInControlStatements
. -
Fixed unwanted space in type declaration #271
-
php.format.rules.alignConsecutiveAssignments
now aligns only assignment if they directly follow each other. Inserting a new line between assignments will force them to align differently.Fixes
-
Documents opened in diff view won't appear twice in symbol searches and symbol navigations (#549).
-
Fixes symlinks recursion on Unix (#269).
-
Fixes blank What's New screen.
Stable
1.30.12417
Doc Comments
Supporting literals and constants inside Doc Comments (i.e. inside key-of<>
and value-of<>
), so the type information in Doc Comment is parsed and IntelliSense works inside it (#801).
Diagnostics
- Duplicate promoted property reported.
- Reports modifying read-only properties.
- Reports use of undefined property if there is
__get
/__set
but also@property
doc comment declaration. - Added diagnostic for unknown attribute class.
Rename Refactoring
Renaming a class
, interface
, trait
, or enum
suggests to rename the corresponding file as well, if appliable.
Hover Tool-Tips
Newly, there are two more settings to configure the hover tool-tip.
"php.hover.fullname"
adds the full class member name at the top of tooltip (including the fully qualified name of the class) (disabled by default) (#808)."php.hover.containingClass"
lets you to enable/disable showing class name as a part of a function tool-tip (enabled by default).
Fixes
- Overall workspace processing time (source code parsing) has been optimized.
- Added missing
ZipArchive::
constants (#256). - Constants defined inside lambda functions are shown in IntelliSense, and code diagnostics (#257).
- Rename refactoring and semantic highlighting of constructor promoted properties.
- Context-aware completion after
extends
/implements
keywords. - Fixes
"Problems: Exclude Git Ignore"
in case there are many.gitignore
files in the workspace. - Fixes use of
@global
type defined above function declaration. - Fixes generating Doc Comment upon
/**
above trailing comma (#265) - Fixes updating problems and code analysis when using
includePath
overlapping the workspace path(s).
Stable
1.29.12304
IntelliSense Improvements
Respecting @internal
annotation
Symbols annotated with @internal
doc comment tag are hidden in the completion list now;
Correct ordering
We have updated how the code completion is ordered depending on context and so-far typed text; Symbols from imported namespaces are listed first, then top-level symbols, and at the end there are symbols that can be auto-imported.
Deprecated classes
Additionally, deprecated classes and interfaces are striked-out in the code completion list, and when used in the source code. Previously, we did that only for functions.
Performance
More frequent operations have been moved to a background thread to make the user experience fluent and uninterrupted.
Short Open Tags <?
We have enabled parsing of PHP code inside short open tags (<?
) by default. It handles the case where <?xml
is at the beginning of the source code;
Parsing inside short open tags can be disabled using the setting "php.workspace.shortOpenTag"
.
Composer
The local development version of composer.phar
is updated automatically every 30 days.
Fixes
- Missing
pcntl
constants added to IntelliSense. - Fixed
#region
/#endregion
collapsing. - Fixed collapsing in various situations.
- Fixed update of IntelliSense after
composer update
. - Fixed incorrect
integer
type name shown in tool-tips. - Fixed renaming of global variables (#242)
- Fixed warning message on non-en localizations (#249).
- Fixed missing unreachable code warning in
switch
statement. - Fixed missing
Exception
class in the completion right afterthrow new
. - Fixed auto-import when there is a syntax error (#671).
- Formatter does not remove space after
yield format
(#248). use
with leading/
stopped the formatter.- Colon block ending with
;
separated with whitespaces from colon block closing token stopped the formatter.
Stable
1.28.12200
New Code Actions
More useful refactorings are coming to the PHP extension and VS Code. Following are refactorings introducing common PHP 8 syntax to your code.
Condition ?:
can be replaced with ?->
Simplifying conditional expressions like the one below:
Assignments can be simplified
Simplifying assignments:
Converting switch
to match
In certain cases, switch
statement can be converted to the new match
expression.
PHPStan Conditional Return Types
This update adds support for the new PHPStan's Conditional return types. Return types specified in this way are properly recognized now, colored accordingly right in the source code, and the IntelliSense uses the specified types correspondingly.
Improved Type Checks and IntelliSense
BREAKING: By default, we're now reporting diagnostics inside opened documents only. This can be changed using setting "php.problems.scope"
. The exception is the syntax errors - those are reported from across the whole workspace.
In addition, various falsy warnings have been fixed, mostly in combination with generic types. The type analysis have been improved in general.
Also, most of polyfills are not messing up with codecompletion and symbol navigation; Since built-in manual is annotated with generic type arguments, it is preferred over the polyfills from 3rd party packages (#241).
Improved Completion Ordering
The code completion itself has been improved, so local symbols should be listed first. We're still working on this feature, and improving as much as possible.
Fixes
- We have fixed a memory leak, and the language server crash.
- Fixed PHPDoc snippet after typing
/**
, when text got corrupted. - Added missing Psalm scalar type annotations.
- Correct order of resolving
@mixin
members (#777). html
files can be associated withphp
language support.//region
///endregion
folding (#788)
Formatting
- Removing unwanted extra space after
?
token in nullable return type #752 - Fixes in Wordpress code style
- Types and function declarations have do not place a open brace
{
on a new line Unset
calls weren't formatted with spaces within parentheses.exit()
ordie()
do not have a space within parentheses.
- Types and function declarations have do not place a open brace
php.format.rules.alignConsecutiveAssignments
stopped the formatter in certain cases.- Using not equal operator
<>
instead of!=
stopped the formatter. - Optional comma in constructor header in property promotion stopped the formatter.
- Certain situations when combining HTML and PHP stopped the formatter.
- When
case
insideswitch
was followed by;
instead of:
stopped the formatter.
Stable
1.27.12010
Doc Comment Syntaxes
We've been working on recognizing the whole range of commonly used type syntaxes in Doc Blocks; now supporting the most of PHPStan, and other popular linting frameworks.
This release introduces more compatibility, and more features towards Doc Blocks, and related type analysis and code diagnostics.
Colorization and Semantic Tokens
PHP Doc Comments are getting very complex, and frameworks like PHPStan add even more syntaxes and complexity. We're supporting most of the extended syntax, including generic types, templates, type aliases, unions, intersections, callable
syntax, and array shapes; and in this release, those types in documentary comments are colorized accordingly.
The whole type expression is now parsed, colorized, and recognized. The tooltip shows the signature help displaying the Closure
s arguments and return types.
Note: a nicer tooltip is in progress!
PHPStan Array Shape, callable
, list
, and more
Since this release, the editor supports all the syntaxes for array shapes and callables. In addition, the type analysis handles specified PHPStan types accordingly.
PHPStan and Psalm array shapes specified in PHP Doc Comments are allowed, parsed, colorized, and used in code completion and type analysis.
Additionally, list
and non-empty-list
types are handled as well. Including their generic counterparts with <
and >
types specified.
All the callable syntaxes in PHP Doc Comments are supported now as well.
More Generic Annotations
This update brings the standard types annotated with generic template types; this is especially helpful in Laravel and Symfony frameworks, where it provides type inferring for all the collections, iterables, Generator
, DOMNodeList
, etc.
This improves value inferred within foreach
for all kinds of iterables.
Doc Comment Snippet for Variables
When creating a Doc Block above variable assignment, or above a global variable, you can now configure the snippet that will be created. Additionally, the snippet setting has a new property "singleline": true|false
(for variables it's true
by default) allowing you to specify whether to create the Doc Block single-lined (i.e. /** @var Type */
).
Sample setting:
{
"php.docblock.variableSnippet": {
"singleline": false
}
}
Fixes
integer
,boolean
,list
types are handled properly in Doc Block.- Unused
use
analysis fixed, so it handles type names specified in Doc Blocks. - Diagnostic and parameter completion for
session_set_cookie_params()
works for both possible definitions. - Missing
Imagick
constants added. - Improves type inferring for generic types and various edge cases.
Stable
1.26.11866
IntelliSense & Enums
The PHP 8.1 enum
objects implicitly implements UnitEnum
and BackedEnum
interfaces. The BackedEnum<TValue>
interface is annotated with a template type argument so it can be used in Doc Comments with the backed type for better type analysis. E.g.:
/** @param \BackedEnum<string> $e */
function foo($e) {
return $e->value // -> string
}
enum MyEnum : string {
case A;
}
foo( MyEnum::A );
Generic Types & Doc Comments Type Annotations
The type annotations in PHP Doc Comments have been reimplemented, so even complex constructs are handled, can be completed, refactored, highlighted, and previewed. Highlighting occurences works even in nested generic types, as well as rename refactoring and code completion.
/**
* @template TElement of \BackedEnum<string>
* @return (Collection<int, TElement>|array<int, TElement>)[] Complex generic type annotations */
Multi-Lined Structured Array Types
This release adds support for multi-lined structured array type annotations. This allows users to specify array type with its keys and corresponding entries types. See the exmaple below:
/**
* @return array
* {
* name: string,
* age: int,
* }
*/
Code Diagnostics Improvements
We're constantly working on improving the code analysis and related diagnostics. This release avoids a lot of falsy warnings.
Formatting
We're happy to introduce new Laravel code style. You just need set php.format.codestyle
to laravel
.
Now you can also let formatter to auto-align consecutive assignments with php.format.rules.alignConsecutiveAssignments
option #692.
$a = 1;
$bbb = 2;
$ccccc = 3;
And other formatting rules we've added are:
Setting | Description |
---|---|
php.format.rules.spaceBeforeColonInControflowStatements |
Insert a space before colon in control flow blocks. |
php.format.rules.spaceBeforeColonInReturnType |
Insert a space before colon in a return type. |
php.format.rules.spaceWithinCallParens |
Insert a space within method, function and constructor call parentheses. |
php.format.rules.spaceWithinDeclParens |
Insert a space within method, function and constructor declaration parentheses. |
php.format.rules.spaceWithinArrayInitilizersParens |
Insert a space within array initializer parentheses. |
php.format.rules.spaceWithinIfParens |
Insert a space within if statement header parentheses. |
php.format.rules.spaceWithinWhileParens |
Insert a space within while statement header parentheses. |
php.format.rules.spaceWithinForParens |
PInsert a space within for statement header parentheses. |
php.format.rules.spaceWithinForeachParens |
Insert a space within foreach statement header parentheses. |
php.format.rules.spaceWithinSwitchParens |
Insert a space within switch statement header parentheses. |
php.format.rules.spaceWithinCatchParens |
Insert a space within catch statement header parentheses. |
php.format.rules.spaceWithinBrackets |
Insert a space within brackets. |
php.format.rules.spaceWithinBracketsAroundExpression |
Insert a space within brackets around expression. |
php.format.rules.spaceWithinExpressionParens |
Insert a space within parentheses around expression. |
We've also fixed some formatting issues:
readonly
in namespace caused formatter to stop formattingreadonly
andenum
in function declaration doesn't add space before paren- PHP 8.2 Disjunctive Normal Form Types are supported now
- Constant uses were double indented in multi-line expressions #748
- We've address some cases when combing html and php code didn't result in neat looking code. Most notably in Wordpress templates.
Fixes
Hot fix for built-in PHP functions type analysis.
Stable
1.26.11753
Type Analysis Improvements
- Expression in the
assert()
language construct is used to determine variables type now. (#744) - Certain type annotations are now more precise.
- Implicit closure variables inside arrow functions are now properly initialized. This fixes falsy warnings about uninitialized variables use inside nested arrow functions.
- More Core types have been annotated with template type arguments, allowing for better inferring of types where
@template
and similar are used (#746). - Support for generics has been improved to properly handle doctrine/collections and other templated types using extended
@template
syntax (#746).
Editor Improvements
readonly
andenum
keywords are not incorrectly reported as a syntax error, when used as a part of namespace or a function declaration.- The language server is allocating significantly less memory during code completion; this improves the overall performance.
Formatting
- In Wordpress code style we are no longer inserting space between parentheses and brackets when empty e.g
foo()
, butfoo( 1, 2 )
. - Not aligning array initializers key value pairs when they are not on separate line (when
php.format.rules.arrayInitializersAlignKeyValuePairs
enabled). - Fixes incorrect outdenting of constants in multiline expressions.
Apple Silicon
Introducing the support for Apple M1 and M2 chips (Apple Silicon). These CPU's with arm64-x64
architecture were not fully supported in previous release and we're happy to provide the language server for those architectures now.
Stable
1.25.11652
PHP 8.2
Built-in IntelliSense has been updated to provide the latest PHP 8.2 classes, functions, constants, and documentation in all the available languages (#215).
As a part of PHP 8.2, we have added integrated multi-language documentation for the new Random
extension.
Formatting
One of the feedbacks we got more often was that sometimes formatting was slow. We've addressed these cases, and it should be much better now. But please let us know if you run into a case when it's not fast.
We're also happy to introduce Wordpress code style. You just need set php.format.codestyle
to wordpress
. Though there are still a couple of rules for us to implement, it's mostly ready.
In this release, we've also focused on code formatting of mixed html/css/js/php. This one is tricky since the indentation of html code is influencing the php code and vice versa #171. We think we got it right now, so hopefully wordpress templates will look good when formatted.
Fixes
- On the first format request, directly after VSCode was first started, only php code was formatted.
- HTML matching tag should get highlighted regardless if it has a php tag inside. #172
- Wrapping of function arguments list with trailing comma, stoped the formatter.
- Incorrect indentation of function calls prefixed with namespace backslash.
- Unwanted spaces inserted into php code in javascript. #222
- When formatting, indentation of php code determined by a position of open tags might have been incorrect. The formatter needed a second pass to get it right.
- Code diagnostics fixes:
parent::
not reported as static call in some cases.- Local variables in nested arrow functions not reported as uninitialized.
- Inheriting
@param
type from base classes, if there is no Doc Comment. - Removed support for old
@param
syntax #740. - Fixes control flow analysis of nested binary expressions.
- Added support for alternative Doc Comment array syntax, i.e.
(int|string)[]
. - Fixed type analysis for more complex generic types inheritance.
- Added support for generic
IteratorAggregate<TValue>
. - Generic types are properly propagated and substituted in tool-tips.
Stable
1.25.11537
Hover Tool-Tip Improvements
Newly, the mouse hover tool-tip shows descriptions of parameters. This behavior can be changed using the setting "php.hover.parameters"
.
The documentation link the muse hover tool-tip can be enabled or disabled using the new setting "php.hover.documentation"
.
Generics
The template type inferring and substitution has been improved to handle more complex type hierarchies. (#723, #733, #731)
Fixes
-
Generated Doc Comment respects
yield
and correctly annotates function withGenerator
type hint. Additionally, the code diagnostics respect function returningGenerator
and correctly analyzes the return value type. -
'enum'
keyword is a little hack in the PHP itself. We have fixed how it is parsed so it respects the PHP 5, 7, 8, and 8.1 onwards conrrectly (#205). -
Autocompletion of parenthesis
()
is inserted ust once when generating automatic function override (#730) -
Go to Definition has been fixed.
Formatting
New customization settings
As promised, we are adding more formatting options based on your feedback.
Setting | Description |
---|---|
php.format.rules.spaceBeforeParenthesesInArrowFunctions |
Space before parentheses in arrow functions |
php.format.rules.spaceAroundConcatenation |
Space around concatenation . |
php.format.rules.spaceAfterUnaryNot |
Space after unary not ! |
php.format.rules.groupUseWrap |
Defines wrapping behavior of group use |
php.format.rules.groupUseNewLineBeforeFirstDeclaration |
Place a new line before first group use declaration |
foreach
We are compacting foreach
statement headers into a one line by default now (as defined in PSR-12
).
<?php
foreach ($iterable as $key => $value) {
}
PSR-12
We've slightly improved PSR-12
code style. Now we are automatically wrapping multiline group use declarations as specified in the standard.
<?php
use Vendor\Package\SomeNamespace\{
SubnamespaceOne\ClassA,
SubnamespaceOne\ClassB,
SubnamespaceTwo\ClassY,
ClassZ,
};
Fixes
- When anonymous class implements list was defined on multiple lines, we didn't indent them correctly
- Implements list wrapping settings work for anonymous classes too
Stable
1.24.11420
Array Shapes
The editor treats inline array shapes specified in Doc Comments now. The following syntax is correct, and understood by the PHP editor:
<?php
/**
* @param array{ name: string, id: int, data: \App\Model\User } $a The entity.
*/
function foo($a) { .. }
Array shapes improve your code completion, as it provides code completion for array keys; and inferred types, as it resolves the array items type according to the specified index.
IntelliSense Improvements
Prentheses Completion
Newly, IntelliSense completes parentheses when completing a function. The keyboard cursor is placed in between them. Optionally, the feature can be either disabled, or the complete function signature can be completed as a snippet. This allows jumping between parameters with [tab]
key and fill-in the arguments.
The feature is configurable through the setting "php.completion.parameters"
. By default, it is set to "parentheses"
so it completes just the parentheses ()
.
Xdebug stubs
We have added stubs for Xdebug extension. Go to settings, and add "xdebug"
to the "php.stubs"
setting:
{ "php.stubs": ["*", "xdebug"] }
This adds Xdebug functions to IntelliSense, code diagnostics, and improves the type inferring analysis.
Deprecation Messages
Whenever a deprecated symbol is used, it is striked out and the corresponding warning is shown. Additionally, in this release, we're adding the deprecation message to the code completion tool-tip.
Note, to mark your function as deprecated, add the @deprecated
Doc Comment tag as it is below:
/** @deprecated Do not use this, since version 1.2.3 it is not maintaned anymore! */
function getEntity(array $row) : object { ... }
Customizable Formatter
Many companies have coding guidelines when creating source code which might differ from our predefined code styles. We're happy to introduce highly customizable formatter and we begin with around 30
different code formatting options. This is just a begining and we're accepting suggestions which options to prioritize next.
These more granular code formatting options are only available for PREMIUM
users, but Community version users can still influence formatting with php.format.codestyle
option.
For example you can let formatter to auto-align key value pairs in array initializers with php.format.rules.arrayInitializersAlignKeyValuePairs
option #692.
$x = [
1 => 'foo',
1234 => 'bar'
];
Or if you and your company prefer Whitesmiths
style you can set that up by setting php.format.codestyle
to allman
and php.format.rules.indentBraces
to true
#689.
function foo()
{
echo "Hello";
}
In general use php.format.rules.*
settings to configure the formatter to behave as you wish. For a detailed list of formatting options, either open the Settings Editor (Ctrl+,
) and type php format
in the Search bar or see our documentation page.
Format on Type
We've reimplemented how format on type behaves. Now it correctly picks up what part of the code you are editing and formats it when you type ;
or }
. This way your code always stays correctly formatted without a need to explicitly call the formatting command.
We recommend to turn this feature on. By default in VS Code it's disabled.
If you'd like to turn it on just for PHP you can do it in settings.json
like this:
"[php]": {
"editor.formatOnType": true
}
Formatting Fixes
- Functions with multiple parameters that also contained
func_get_args
orfunct_num_args
in the body stopped the formatter. - Multiline use traits statement were double indented.
- Indentation fix of lambda functions nested in certain statement headers.
- Fixes indenation of chained method calls when part of the chain is a field. #715
- Correctly indents arguments of static method calls spread across multiple lines.
- Fixes indentation of multiline field uses, including static fields or constants.
- Null-safe operator is supported.
- Attributes are supported.
IntelliSense Fixes
Control Flow
We have fixed the control flow analysis, when there are functions that never return (i.e. they throw an exception instead of returning a value). Correspondingly, false warnings about unreachable code were fixed, and corresponding variables type inferring as well.
Trailing Comma in Lambda use ()
The issue with unsupported trailing comma in lambda declaration has been fixed (#207).
Blade
We have fixed use of @can
, @endcan
, @forelse
, and @empty
inside .blade.php
files.
"php.stubs"
The configuration setting "php.stubs"
has been fixed. It was not working after reloading a workspace.
Stable
1.23.11234
launch.json
with "envfile"
Option
Newly, you can specify your .env
file to be used by the built-in PHP server. This is important especially when developing a Laravel application! An example launch configuration would look like the following:
{
"name": "Start Built-in Server with .env",
"type": "php",
"request": "launch",
"runtimeArgs": ["-S", "localhost:8888", "-t", "public"],
"envfile": ".env"
}
Doc Comment Generator
The generated PHP Doc has been improved. It specifies @var
above properties and class constants if possible. Additionally, if the function is recognized as it never returns, it annotates the return type as @return never
(#193).
Quick Fixes
The quick fix for getters and setters follows PSR-12
now. Additionally, it specifies a type hint in the correct form.
Quick fix for generating __construct()
(#198) generates Doc Comment in the correct form now. Then generated function complies with PSR-12 now as well.
Also the quick fix for implementing an interface has been updated to follow PSR-12 and to generate type names correctly.
PHP 8.2
The remaining PHP 8.2 features are being supported by PHP Editor.
- Newly, the special attribute
#[SensitiveParameter]
is included in code completion. - Also,
enum
case values can be used in constant expressions, as specified in RFC.
Formatting
PSR-12
There are couple more rules we are introducing for PSR-12
code style in this version. Particularly they instruct the formatter on how to behave when formatting control statement headers which are spread across multiple lines.
e.g.
for ($i = 0; $i < 10; $i++
) {
// for body
}
gets formatted to:
for (
$i = 0;
$i < 10;
$i++
) {
// for body
}
In a same way when list of implements
is split across multiple lines, we put first item on the next line and each interface on a separete line.
Now, when wrapping function or method calls we also consider what kind of arguments are used. When a single argument is split into multiple lines, such as array or lambda function, we do not consider this as a reason to split the argument list. (This behaviour is according to PSR12 specification)
<?php
somefunction($foo, $bar, [
// ...
], $baz);
$app->get('/hello/{name}', function ($name) use ($app) {
return 'Hello ' . $app->escape($name);
});
Format Selection
We've improved how format selection is working, which will also affect when editor.formatOnType
and editor.formatOnPaste
is enabled.
Fixes
We've also fixed an issue when Javascript formatter was adding spaces into php code #203
and HTML formatter editing contents of php code. This mainly manifestated when editor.formatOnPaste
option was enabled.
The next, we've addressed some formatting issues as well:
- Constructor closing
)
was sometimes indented incorrectly when statement was multiline. - In certain cases comments were indented incorrectly.
- Method calls on single line shouldn't wrap. #693
- Functions with
func_get_args
orfunct_num_args
in the body stopped the formatter. #691 - Only multi-line comments begining with
*
are indented + 1. - Sometimes unnecesary new line was added after array initializer.
- lambdas weren't pushed to the new line when containing element was wrapped
- fix of double indentation when constructor was present in multiline array
- Array with multiple lambdas indentation bug. #702
- Parenthesis expressions weren't indented. #700
- Multi-line use traits statement is properly indented now.
- In certain cases new lines after the optional return type were collapsed. #704
Stable
1.22.11089
PSR-12 Formatting
We are happy to announce an introduction PSR-12 code style. With the previous releases we've mostly covered all the important rules necessary for PSR-12 compilent formatter. There are some minor things we are still going to improve, but we are mostly there. We are also switching the default formatting code style from old PSR-2 and from now on, it's going to be PSR-12.
To be complient we've also added these rules:
- Adding space between exception types in
catch (OtherThrowableType | AnotherThrowableType $e)
- Compacting whitespaces in function declaration header so the return type is on the same line as
)
parenthesis
Being complient with PSR-12
is important, but how the code looks after the formatting is too. And we are continuing to work on beauty part as well. One case we've done for this release is how array initializers are threated. When there is an new line anywhere in the array then we put all the array items on a new line and indent. #683.
In similar way, we are applying the analogous behaviour for call parameters and function/method declarations, but only in PSR-12
code style.
We've also fixed some minor formatting issues.
Composer Improvements
create-project
command has been updated. Now it opens the Open Folder dialog if it's not clear where you'd like to create the new project. At the end, it opens the newly created project in VS Code.
New Code Diagnostics
Newly, invalid declaration of properties inside interfaces is reported. (#174)
Also, the code analysis handles the default Laravel class aliases. This affects IntelliSense and avoids false code warnings.
See the Fixes below for more updates.
Fixes
Code Diagnostics are less strict about type juggling (int
-> float
type juggle in for
loops), and also it handles better array element type inferring (#185).
Then we have fixed code diagnostic of functions, that use variable amount of arguments through func_get_args()
. (#677)
Also there were issues when problems and IntelliSense did not get updated after composer packages being removed or updated - we've make changes that avoids that, and everything gets updated seamlessly as it should. (#182)
Stable
1.21.10985
@var
above function parameters
Editor handles Documentary blocks right above function parameter definition. If there is a @var
with type specification, it is used for the parameter type across IntelliSense, tool-tips, and code diagnostics.
class MyClass {
function __construct(
/** @var T[] */
public readonly $list, // $list is of type T[]
) { }
}
Formatting
How it looks is important. So we continue our effort to make it beautiful:
- Indent level is incresed in multi-line expressions when accessing a property or calling a method #530
- We are indenting code in PHP tags in all the code styles. #173
- In certain cases when HTML was combined with PHP unexpected new lines were added #173
-
PHP Close tags
?>
are indented according to the previous<?php
open tagImprovements
PHPUnit Test View
This update improves resolving of PHPUnit tests in Test View panel. Processing test files is faster, avoiding redundant read and parse from disk. Also, the test view now supports tests from inherited classes (#678).
Stable
1.20.10937
Editor Improvements
Highlighting Control Structures
Highlighting occurrences of control structures and corresponding keywords has been added. Newly the editor highlights control structures such as for
, foreach
, while
, or do
, with the corresponding continue
, or break
, when you navigate the caret on them. Also, all return
s are highlighted in the function, and case
s with default
label.
It also highlights matching pairs of switch
/endswitch
, if
/elseif
/endif
, try
/catch
/finally
, and others.
Fuzzy Search Symbol in Workspace
Searching through the workspace supports fuzzy queries; i.e. the symbol names are matched against letters in the query. Additionally, searching using upper-case letter is case-sensitive, so you can quickly search for camel-cased notation.
Formatting
We are improving formatting support with more cases.
- The cast operators are separated with a space now. (#175).
- Constructor property promotion is formatted correctly. #176
- Unwanted space was added after
::class
in certain cases. #530 else
orelseif
is placed on a new line when goes after a statement. #530- When type reference is separated from the
?
with one space if it's part of the ternary operator. #530
Diagnostic Improvements
New setting "php.problems.scope": "opened"
Newly you can only diagnose PHP files that are opened in the editor. Note, parse errors will be still reported across the entire workspace.
Set the setting "php.problems.scope": "opened"
to see how it works.
Check for too many args
Now we check for use of func_get_args
, func_get_arg
, or func_num_args
so functions with variable number of arguments are detected, and _too_manyargs warning is not reported.
Stable
1.19.10893
New Formatter
We have redesigned and updated the built-in PHP code formatter. It provides several new formatting styles through the setting "php.format.codeStyle"
.
Allman
The Allman
style is named after Eric Allman. This style puts the braces on the next line. This applies to all control statements and declarations.
while ($x == $y)
{
foo();
}
K&R
The K&R
style (Kernighan & Ritchie Style) keeps open braces on the same line for control structures, types, functions and methods.
while ($x == $y) {
foo();
}
You can still keep using previously supported code styles:
"PSR-2"
style,- Visual Studio-like style called
"PHP Tools"
, - and
"Off"
,
The formatter works with HTML/JS/CSS, formats ranges, formats whole documents, and formats on typing - after closing a block of code or a statement.
Formatting Fixes
The following is the list of formatting issues we have fixed and implemented:
- Arrow function formatting fixes.
- Formatting supports nested function calls.
- Fixes of formatting enumerations.
- Fixes of formatting related to
match
expressions. - Heredoc and Nowdoc expressions are left untouched during formatting.
- Formatting correctly indents grouped
use
statements. - Indent multi-line control statements headers.
- Multi-line expressions inside lambdas are indented.
- Empty blocks with comments are indented.
- Group
use
statements andmatch
expressions respect optional trailing comma. - Space between type and ampersand
type &$x
when formatting function parameters. - Indenting empty blocks with comments.
- Multi-line expressions inside anonymous types are indented.
- Multi-line function and method calls are correctly indented.
- Parenthesis of function or method headers on a new line are not indented.
- Fix of an incorrect new line after a lambda expression.
- Formatting leaves single-line php blocks.
- Close tag is always separated from the previous token.
- Function named arguments are formatted.
- Anonymous classes have space before
{
if kept on the same line as a class header. - Fixed formatting of PHP code in HTML attributes (e.g.
<div style="<?php echo "something" ?>">
). The formatter won't add additional white-spaces anymore.
Highlighting To-Do Comments
Newly the editor highlights to-do annotations in your code. This helps to keep track of unfinished work and pending issues.
You can customize the style using the following setting:
"php.highlight-todo.style" : {
"backgroundColor": "#ec0"
}
Or you can turn the feature off completely with the setting "php.highlight-todo.enable": false
.
Debugger Code Completion
During debugging, when typing into a Debug Console, names of existing local variables will be suggested. Type $
or the completion shortcut (by default Ctrl
+Space
), and available local variables will be suggested.
New Diagnostics
The editor checks and reports the following diagnostics:
- Calling instance methods statically. (#641)
- Invalid assignments to type properties. (#647)
- Too many arguments provided to a function call. (#645)
- Allows objects to be used for constants, and handles use of Doc Comment with
@var
aboveconst
.
New Settings
We have added a new setting "php.problems.excludeGitIgnore"
(#169) which simply lets you to ignore code diagnostics in files/folders specified in workspace's .gitignore
s.
Fixes
- Code action for generating
__construct()
respects text editor tabs and spaces setting. - Generating Doc Comment (
/**
) respects the indentation. - Generating Doc Comment above function respects customized Doc Comment snippet (
php.docblock.functionSnippet
setting). - Fixes some cases, when IntelliSense was not updated after adding Composer packages.
Stable
1.18.10692
Profiler Support 🔥
PHP code profiling allows you to inspect how much time and how many calls were made to every single function in the code.
Read more (docs.devsense.com) ...
We have added support for Xdebug profiling! Xdebug profile files (cachegrind format) can be opened, viewed, and inspected. The extension also highlights hot paths in your code, according to the profiling results.
Call Times View:
Callers/Callees View
Detailed view of callers and called functions, including times.
Hot Path Decoration
Profiling result file is analyzed, and hot paths are highlighted right in the source code:
Updated code diagnostics
- Variables used inside arrow functions are not reported as uninitialized now (#664).
- Diagnostics
PHP1408
andPHP1409
are reported with a lower severity now.
Open-VSX
The entire extension is now available on open-vsx.org
Other Improvements
- Auto-imported 'use' is sorted (#666).
- HTML code formatting fixes.
- Fix of constructor property promotion formatting.
Stable
1.17.10641
Introducing What's New
We are getting many useful feature requests and feedbacks, and we're trying hard to add as many improvements as we can. One of them was to inform briefly about the news. With this release, we've started showing What's New window with the major updates.
The window can be opened manually with command "PHP Tools: Release Notes"
. Automatic opening after each major update can be disabled with the checkbox at the bottom of the window.
Debug
Debugging has a few neat features! More settings for enabling profiling, var_dump()
produces nicer and more detailed messages, and Xdebug for PHP is determined when debugging starts.
Debug develop
Mode
Since this release, we have enabled develop
Xdebug mode. This gives nicer looking and more informative var_dump()
outputs.
In case you prefer the normal-looking var_dump()
messages, change the "noDevelop"
setting in the launch.json
profile.
Debug profile
Mode
You can enable profile
mode now. Set the "profile": true
setting in your launch.json
profile:
{
"name": "Launch & Profile built-in Server",
"type": "php",
"request": "launch",
"runtimeArgs": ["-S", "localhost:8000", "-t", "."],
"noDebug": true, // <-- do not initiate debugging
"profile": true // <-- enable xdebug.mode "profile"
}
Uncaught Exceptions Filter
Newly, the Debug view provides option to either break or ignore Uncaught Exceptions. This options is located in "Debug and Run" view, at "Breakpoints" panel.
Code Diagnostics
- We have fixed incorrect duplicit key check in case of
enum
' case values. (#658) - Fixed return type check when return type hint is
void
. - Reporting anonymous functions with unused
use
variable. - Reporting anonymous function'
use
variable is not initialized. - Reporting of empty namespaces.
- Checking that value from a function returning
void
is being used. - Reports accessing a property on
void
. - Checks expressions in string interpolation are convertible to
string
. - Checks that type of a property is defined.
- The diagnostic for unknown class or unknown function is suppressed if user is opening just a single file, without opening a workspace or folder.
- The diagnostic
0412
severity has been changed to error, code1412
(unassigned variable use).
Composer
All-in-One Composer integration has been added! It implements useful commands for requiring, removing and browsing packages, automatically installing composer.phar
so you don't have to, adding IntelliSense for composer.json
, code lenses for running scripts, neat tool-tips for your installed packages, it checks for abandoned packages, and more!
Other Improvements
There are fixes to the PHP formatter. Formatting wasn't performed when explicit cast was used with less common data type alias, e.g. (integer)
, (boolean)
, or (real)
.
Stable
1.15.10535
Command PHP: Search todo ...
Introducing a quick way of browsing through all the to-do comments in PHP code. The command "PHP: Search todo ..."
opens quick pick with all the to-do. It allows to filter, search through, and navigate to the selected item.
Tool-Tips get nicer
Hover tips for function signatures are split into more lines if they would get too long. Also, the optional parameters are not denoted with [
]
anymore. (#159)
Additionally, safe HTML tags in code comments get rendered nicely in a tool-tip now. Having tags like <br/>
, <b>
, <i>
, <ul>
, <li>
, <code>
in your documentary comments is allowed and when displayed in a tool-tip, it gets rendered nicely and formatted.
Code Diagnostics
We have added more diagnostics, and fixed a few rare cases in code flow analysis.
- There is a diagnostic for invalid use
break;
, whenbreak
orcontinue
are out of the allowed scope. - Diagnostic of code reachability with
try
/finally
was fixed. - Diagnostic of function return has been improved in cases, where there is a type hint
mixed
, but the function does not return anything.
Other Improvements
There are fixes to internal exceptions, and several performance and memory use optimizations.
Stable
1.14.10471
- new
"php"
task definition; this allows defining VS Code task that executes a PHP script, using currently configured "php" executable:// .vscode/tasks.json { "type": "php", "file": "${workspaceFolder}/script1.php", "args": ["argument"] }
- settings
"phpunit.preTask"
and"phpunit.postTask"
allowing to specify a task or list of tasks fromtasks.json
to be executed before or after a test runs (#154).- tasks executed within
phpunit.preTask
andphpunit.postTask
can use variables${command:phpunit.filter}
or${command:phpunit.testsuite}
- tasks executed within
- settings to customize DocComments (PHPDoc) generated by typing
/**
- Diagnostics:
- duplicit field declaration reported
- duplicit class constant declaration reported
- dynamic properties reported if there isn't corresponding
__get
/__set
, or@property
annotation - foreach control variables can be annotated with DocBlock
- IntelliSense: updated PHP 8
Attribute
class declaration with its members - getter/setter code action respects
static
properties
Stable
1.13.10390
- fixes format on paste
Stable
1.13.10378
- fixes for HTML/CSS/JS editor features
- HTML/CSS/JS formatting enabled in PHP files
- fixes Format breaks subsequent code (#156)
Stable
1.13.10301
- PHP 8.2 read-only classes supported.
- Some PHP 8.2 compatibility checks.
- Go To Definition command navigates to
include
/require
target file. - Tooltip for pseudo-constants shows correct value.
- Spacebar (pressing
space
) afternew
,use
,extends
, orimplements
triggers code completion. - Non-Standard Doc Block type names supported (#622).
Stable
1.13.10239
- code diagnostic for unknown properties (
PHP0416
)- quick fix for unknown property (for now fixing small typos and casing)
stdClass
and classes with__get()
magic method ignored (as specified in the PHP 8.2 RFC)
- auto-import (FQN) avoids creating a conflict name
- code completion after
extends
avoids suggesting the containing class itself - fixes case-sensitivity checks for property names
Stable
1.12.10140
Go to Type Definition
command added; navigates to type definition instead of__construct
innew
expression.- PHPUnit View: Fixes tracking a failed test location (#150)
Stable
1.12.10040
- setting
php.workspace.includePath
allowing to specify additional directories to be included in IntelliSense. - improves workspace loading, processes files better in parallel
Stable
1.12.10022
- fixes activation
Stable
1.12.9985
- PHPUnit Tests Integration
- new UI for PHPUnit tests
- showing inline failure messages
- debugging PHPUnit tests using the new UI
- diff of expected and actual values
- smaller extension
- avoids dependency to the old
ms-vscode.test-adapter-converter
(can be uninstalled) - avoids dependency to the old
hbenl.vscode-test-explorer
(can be uninstalled)
- optimized extension load, smaller installation package
- suggesting new parameter name based on its type hint
- union types properly inserted in newly generated Doc Comment (when typing
/**
above function) - generated Doc Comment annotates thrown exceptions (
@throws
PHPDoc Tag) - handles external changes, fixes re-indexing when composer packages are being installed/updated
- showing all classes in PHPDoc completion, will be auto-imported when commited (according to setting
php.format.autoimport
) - fixes Alpine Linux Arm64 platform
- fixes
phpTools.language
setting for various texts (summaries of various built-in functions and constats). - fixes unused
use
warning being listed twice - fixes rename refactoring of variables inside Doc Comments.
- not reporting missuse of
$this
in template files - improved completion after functions noted in .phpstorm.meta file.
- improved completion after methods annotated with generic type within trait
php.format.autoimport-docblock
setting to configure completion of type names within Doc Block,"FQN"
by default.
Stable
1.11.9762
- fixes completion after
enum
's case (no completions listed) - fixes tooltip over variables, resolved type name is correctly shortened
Stable
Stable
1.10.9721
- fixes language server crash when completing the builtin
enum
member.
Stable
1.10.9716
- IntelliSense support for builtin
enum
methods and properties. - Improves type inferring for array-typed properties.
- Laravel's Real-Time Facades recognized, and supported by code completion.
- Eloquent's Local Scopes listed in code completion.
- Fixes highlighting of unused
use
when it's used in an unused Doc Comment. - Fixes Test Explorer for tests annotated with
@test
Doc Comment.
Stable
1.9.9585
- infers
@template
types in combination withclass-string<T>
type annotation - automatically recognizes some non-standard file extensions to be parsed as PHP files as well (improves code completion on Drupal)
- fixes completion after reserved type names (
self
,parent
,static
) - fixes
->
syntax after constants and class constants (PHP 8.1) - fixes completion after
->
withnew
in the expression chain - fixes changing PHP version
Stable
1.9.9479
- improves Laravel Facades inferring on multi-core CPUs
- improves documentary comments processing, respects more conventions from phpstan and psalm
- improves code completion on generic types and generic
@mixin
types - fixes possible crash on huge projects (StackOverflow fix)
- fixes possible completion issue, when 3rd party extension passes invalid LSP protocol data
- fixes issue handling breakpoints when there are many concurrent requests
- debugger stability improvements
Stable
1.9.9277
- IntelliSense
- support for generics
- IntelliSense handles specialized type names
- templated types are resolved against bound generic arguments
- generic types are infered from constructor arguments passed to
new()
- tooltips shows the generic arguments
- IntelliSense understands
@template
arguments, and extended PHPDoc syntax (generics, psalm, phpstan) - IntelliSense completes special PHPDoc tags used for generics
- code completion uses the template
of
type if the value is unbound - code analysis respects generics
- updated PHP syntax parser, fixes
instanceof
syntax - fixes missing items in IntelliSense after installing/updating composer packages
- fixes for HTML/CSS/JS IntelliSense
- fixes items in IntelliSense after external file changes
- stubs include
zip
andzlib
by default - providing API for 3rd party extensions
Stable
1.8.8970
- adds missing
MYSQLI_
constants - fixes PHPUnit runner; resolves correct
phpunit
PHP script - fixes processing HEREDOC and NEWDOC syntax with empty lines and indentation
- fixes parser to allow PHP 8
readonly
modifier in constructor property - fixes
phpTools.language
setting, PHP manual is localized properly - unused
use
check respects@Method
PHPDoc tag - fixes freezing during resolving PHP binaries and related PHP information
php.linkedEditing.variables
: setting to enable linked editing for local variables (false
by default,editor.linkedEditing
needs to be enabled)editor.linkedEditing
: avoids bad edits when the whole variable name is deletededitor.linkedEditing
: keeps the linked variable names even after they get deleted- debugger listens on both IPv4 and IPv6, supports optional launch configuration
"hostname"
- debugger fixes for arrays
php.version
setting is respected by the editor even there is no matchingphp
executablecomposer.json
is checked for the minimum PHP version, ifphp.version
setting is not set- web extension shows and allows to change PHP language level
- extension does not download external dependencies; makes the initial run faster and reliable
- extension does not expect
dotnet
runtime installed on the system - language server supports incremental text edits to lower protocol overhead
- new platforms supported:
alpine-x64
,win32-arm64
,darwin-arm64
Stable
1.7.8766
- updates IntelliSense with
ctype
books - updates IntelliSense with STD constants
- functions marked with
@ignore
are not listed in completion and signature help - completion after
new
lists variables as well - optimizations
Stable
1.7.8717
- language server stability fix of a possible issue (when using ORM notation)
"php.debug.port"
can be set in workspace scope settings.- debugging tests fix; uses correct port from
"php.debug.port"
or9003
by default. - Laravel static Facades recognized in IntelliSense
- Laravel class aliases recognized in IntelliSense
- improves code parser with PHPDoc
Stable
1.7.8637
- web extension load fix
Stable
1.7.8627
- debugger reports correctly when one or all of the ports are not available
- fixes missing
E_
constants in IntelliSense - PHPUnit debugger respects Xdebug port setting "
php.debug.port
" instead of using hardcoded port9000
Stable
1.6.8588
- debugger "exclude" launch setting allows to negate the path with
!
prefix, i.e.:"exclude": ["!**/app/**", "!**/vendor/mypackage/**"]
- debug won't launch if no Xdebug ports are available
- if Xdebug port can't be used, the detailed message is reported to the debug output panel
- installation: downloading dependencies with alternative locations
- IntelliSense prefers PHPDoc type annotation over the type hint (more specific completions)
- Doctrine ORM attributed annotation used for properties type annotation
- Language Server avoids using File System Watcher improving performance on Unix based system (#521)
- smaller installation package
- setting
"php.stubs"
allowing to explicitly set names of extensions to be included in the IntelliSense, localized manual, and code analysis. - added support for linked editing (
"editor.linkedEditing": true
) for local variables
- new platform supported:
web
Stable
1.6.8479
- fixed preview of string values
- optimized file parsing
Stable
1.6.8448
- code analysis shows the incorrect declaration of PHP 8.1
readonly
property - fixes code-lens in virtual PHP manual files (when navigated to a builtin PHP with Go To Def (
F12
)) - virtual PHP manual displayed as a VS Code virtual document (does not create tmp file on disk)
- PHPUnit runner and debugger setting
phpunit.phpunit
to specify phpunit binary
Stable
1.6.8324
- debugging adornments
- extended compatibility
- code lens for enum cases
php.debug.port
and launch port setting allow to listen on multiple ports.[9003, 9000]
by default.
Stable
1.5.8292
- fixes debug tooltips and debug watch
Stable
1.5.8280
- debugging launch improvements, provides every option on how to start debug according to current file or workspace
- provides advanced commands for running and debugging PHP files and projects
- added setting
php.debug.port
specifying the default Xdebug port - the editor complies with PHP 8.1 by default, if not specified otherwise
- code lens minor updates
- fixes false warning about missing "php"
- fixes extension dependencies
- fixes extension activation time
Preview
1.5.8204
- Code Lens
- references, method overrides, trait uses, type implementation, method prototype implementation
- peeks the references in the references window
- setting to enable/disable:
php.codeLens.enabled
. By defaulttrue
.
- if no
php
is set for the workspace, the editor picks the highest defined inphp.executables
setting - improves completion and tooltips after nullable type-hints
- improves code analysis for
trait
with private abstract functions - improves code analysis for use of
[]
- improves code analysis about
isset
in global code - improves analysis of the missing implementation of abstract methods
- validation for PHP 8.1 intersection types (check for use of scalars, check for valid types used)
- added missing modifier keywords to completion within function header
- fixes Testing to allow to run all tests (
Run all tests
in Testing panel)
Preview
1.4.8059
- detected PHP binaries may have invalid configuration, PHP Tools will report the warning and use the binaries anyways if a user wants so.
- diagnostic reports improper use of
static
in parameter type hints - shortens type names inside PHP 8.1 intersection types in tooltips according to the current namespace
- updated color tooltips with PHP 8.1 syntax
Preview
1.4.8033
- fixed overflow to double problem underline position
- debugger respects user arguments over its forced arguments
- avoids suggesting adding
use
if it's already there in some cases (#127) - updated PHP manual
- updated code completion within PHP 8 attributes
- avoids reporting ByRef issues as an error, reports as a warning instead
- folding HEREDOC blocks
- possible fix of resolution of existing
php
on Windows - PHP 8.1 intersection types (parsed, resolved)
note: type inferring and tooltips do not handle intersection types completely yet
Preview
1.4.7597
- updated inferred type analysis of built-in functions
- highlights
case
withinswitch
- fixed possible stack overflow exception
Preview
1.4.7534
- fixes crashing when code contains huge nested expressions
- fixes language server protocol
- improves code analysis for
array_pad()
,array_fill()
- fixes false positive warning for chained use of
[]
in LValue - memory optimizations
Preview
1.4.7520
- memory optimizations
- fixes crashing when code contains huge nested expressions
Preview
1.4.7494
- function return value summary displayed in tooltips
- fixes refactoring actions
- fixes code actions
- fixes PHPDoc generator
- optimizes protocol
Preview
1.4.7449
- improves analysis of
$this
- improves error reporting of unused variables
- fixes whole document formatting
- fixes formatting of variable-less
catch
- fixes an occasional issue when no debug port is specified
- internal performance improvements for JSON protocol
- fixes debugging documents without a workspace (just an opened file without workspace or folder)
- updated PHP manual
- fixes PHP parser -
readonly
is treated as it should according to PHP version
Preview
1.4.7295
- PHP 8.1 syntax, code sense, and checks
- read-only properties
- final class const
- new in initializers
- new callable syntax
- updated PHP manual
- fixes incorrectly reported deprecations
- fixes incorrect parameteres with 'null' type hint
Preview
1.4.7254
- Debug
- allows compound launch
- allows more debug sessions at once
- Xdebug port doesn't have to be specified (the
"port"
launch configuration)
Preview
1.4.6982
- when auto-import enabled, completions shows all possible types within possible namespaces
- automatically completes fully-qualified-name when auto-importing and there is a conflict with existing alias
- shows (auto import) in completion, if auto-importing will happen
- completion better lists variables
- optimizations
- when there are multiple types to auto-import, they are all shown in the completion list to choose from
Preview
1.4.6842
- automatic import of alias when completion
- setting
php.format.autoimport
- auto-import option: auto imports alias when completing types/function/constants out of namespace scope
- fqn: inserts fully qualified name upon completion
- none: inserts name as it is
- hide: does not show inaccessible symbols in code completion
- fix position of light bulb for code action for fully qualifying name
- strikes out deprecated symbols in code completion
Preview
Preview
1.4.6762
- PHP version picker (see Selecting PHP in docs)
.editorconfig
problems conventions (see Problems in docs)"php.problems.scope"
setting (ignoring "vendor" folder by default) (see Problems in docs)- debugging improvements
- exception handling - always break on fatal error, option to choose whether to break on handled errors/exceptions
Preview
1.3.6645
- debugging fixes and improvements
- debugging UX improvements
Preview
1.3.6632
- Test Explorer lists tests without running them
- Test Explorer supports tests with data sets properly
- tests get retired (grayed) if the source is modified
- optimized debug protocol
Preview
1.3.6616
- new Test Explorer (requires
hbenl.vscode-test-explorer
) - debugging has been updated with support for multiple request handling, stability enhancements, corectness
- debugging supports detach
- optimizes Xdebug protocol
- PHP 8.1 syntax support,
never
return type,enum
, octal number notation - completion of static methods after
$this->
#[NoReturn]
attribute supported
Preview
1.2.6549
- fixes debug implementation (unexpected debug sessions closing)
- fixes debug breakpoints
- optimizes Xdebug protocol
- fixes HEREDOC parser
- fixes named parameters analysis for special names
- fixes PHP 8 parsing and invalid syntax errors
- optimizations
Preview
1.2.6469
- code action for sort uses (PSR-12)
- reports curly braces as deprecated since PHP 8.0
- support for remote file systems
- type analysis improvements
Preview
1.2.6305
- shows PHP version in status bar without suffix
- hotfix for macOS, downloading runtime package
Preview
1.2.6273
- code action for generating constructors
- code action for getter/setter respect field staticness
- fixes code actions
- faster code completion popup
- faster tooltip display for variables
Preview
1.2.6177
- memory optimizations
- fixes for Node.JS on IA-32 architectures
- fixes
PHP0423
for ambigous function declarations - does not list names of anonymous classes in completion
Preview
1.2.6021
- PHPDoc generated for local variables and globals when user types
/**
above them - updated PHP manual with more PHP 8 declarations
- pretty-print after
::class
andfn
fixes - avoided a few falsely reported problems
- fixes type analysis for reserved keywords within PHPDoc
@return
tag - more details in tool-tips for built-in type keywords
- DBGp Proxy support fixes for the server downloaded from the Xdebug home page
Preview
1.2.5988
- fixes language server crash (stack overflow exception)
- more tollerant problems validation
- code analysis improvements
Preview
1.2.5973
- code analysis overall improvements, finally blocks fixes, constrained constants not reported
- refactoring and highlight occurence fixes for global constants in a namespace
- improved performance
- (linux, macOs) fixes server not being closed after VSCode shutdown or folder closed
Preview
1.2.5931
- rename refactoring allows to rename dynamic names
- language server crash fix when
__construct
contains trailing comma - updated pcre check
- type analysis improvements, less falsely warnings
- improved analysis of standard functions
- improved analysis of try/catch blocks
- tolerant to mismatching PHPDoc type annotation of properties
- type check looks into subtypes of traits and interfaces, not being so strict
- fixed code actions and quick fixes
Preview
1.2.5887
- rename refactoring with preview
- pretty print of
use
groups - built on .NET 5.0 (having
.NET 5.0 Runtime
avoids additional downloads) - treats subtypes when resolving methods
- handles trait users improving analysis of trait and go to definition for methods in subtypes
- improves code analysis and type analysis
- avoids a lot of falsely warnings
- go to definition of parent of anonymous class fix
Preview
1.2.5843
- files in source controlled folders are ignored when changed (.git, .history, .svn)
- fixes PHP version in status bar - only shown when editing a PHP file
- optimizations
- updated PCRE check
- fixed code completion at the very end of document
Preview
1.2.5783
- respects
@template
annotation in PHPDoc - handles inline
@var
annotation - signature help for ambiguous constructors (
new \ReflectionMethod
) - PHPDoc array type with union elements annotation (
array<A\B\C>
) - PHPDoc allows for nullable type annotation (e.g.
?int
) - optimizations
- improves code analysis, avoids some false positives
- improves code flow analysis, isset(), is_resource(), and type inference
- improves analysis for lambda function use variables
- CLI specific constants and variables are allowed and code completed
- updates
.phpstorm.meta.php
parser for type inference - does not respect PHP4-style ctor when using PHP 7.1+
- fixes "Go to Implementation" in case of an anonymous class
- fixes return check of generator functions
- fixes check for
__clone()
magic method, can be private - fixes check for array access on
\SplObjectStorage
- fixes case and array key duplicity check for non-printable characters
Preview
1.1.5686
- support for
@mixin
annotations - support for
@method
annotation with$this
return type - handles nullable type annotation in PHPDoc
- fixes resolution of type names in PHPDoc blocks
- fixes some incorrectly reported warnings (mostly an unknown method warning)
- updated pcre check
- can be installed on linux-arm64
- improves type names in tool tips
- code formatting for
match
expressions - fixes code validation of class declaration
- updated integrated PHP manual
Preview
1.1.5620
- syntax checks respect current PHP version including 8.0.
- more quick fixes for invalid union types
- updated pcre check
- tool-tip type names rendered shorter
Preview
1.1.5595
- named arguments code completion (PHP 8)
- named arguments hover information
- functions annotated with
#[Deprecated]
attribute reported in diagnostics - diagnostics for matching or unknown named arguments (PHP 8)
- diagnostics for
iterable
type hint - diagnostics for nullable types
- diagnostics for union types (PHP 8)
null
type name within unions (PHP 8)- improved
.phpstorm.metadata.php
annotations - support for Xdebug 3.0 and PHP 8.0 debugging
Preview
1.1.5532
- updated PSR-2 code formatting
- warning
PHP0415
for use of an undefined constant - warning
PHP0418
for use of an undefined method - code fix for
PHP0415
if it might be a local variable - doctrine annotations in code completion
- fixes class name completion within PHPDoc
- updated global constants in code completion and analysis
- updated PHP manual translations
Preview
1.0.5403
- analysis of class properties
- fixes type hint for magic methods
- stability fixes
Preview
1.0.5342
- PHP 8 new attribute syntax
#[]
- more code suggestions
- improves unused
use
diagnostic when used in PHPDoc - improves underlining of problems in opened document when typing
@suppress
and@SuppressWarnings
PHPDoc tags allowing to ignore specified warnings within class/function- supports more PHPDoc array syntax conventions
- improves analysis of
isset()
andnew static()
Preview
1.0.5264
- fix for double-dollar
$$
character in code completion of a variable
Preview
1.0.5229
- diagnostic and quick fix for names that can be simplified
- diagnostic for unused parameters in constructors and private functions
- updates of externally modified files (
*.php
)
Preview
1.0.5153
@dataProvider
PHPDoc attribute; code sense, navigation, completion- implement missing abstracts quickfix respects original
public
keyword - PHP 8.0 null-safe operator supported
- PHP 8.0
match
construct supported (must have PHP >=8.0phpExecutable
) - fix of
quick fix
for overlapping problems - stability fixes
Preview
1.0.5087
- deduplicated quick fixes
- improved type analysis of expressions enclosed in parenthesis
- unknown type name in PHPDoc gets quick fix
- mouse hover shows whether function returns
null
as well (void
is shown asnull
eventually) - go to implementations for methods
- provides quick fix for invalid base classes
- code completion after
namespace
keyword
Preview
1.0.5044
- quick fix for unknown class names in PHPDoc
- quick fix to remove unnecessary
use
iterable
phpdoc type hint- load status indicator in status bar at left
- current PHP version indicator in status bar (bottom right)
- workspace re-analysed lazily when code is changed (disable with
"php.problems.workspaceAnalysis": false
)
Preview
1.0.5029
- "go to implementations" support
SonarSource.sonarlint-vscode
not reported as incompatible- fixes "go to" of interface names after
extends
keyword - deprecations are rendered with a strike through
Preview
1.0.5015
- "find all references" of
__construct
includes class instantiations - "find all references" perf.
- problems analysis improvements
- improved analysis of inline PHPDoc type hints
- some problems related to other problems are not reported
- parser fixes
Preview
1.0.4975
- performance improvements
- problems analysis improvements
- improves workspace loading
- logging of workspace load failures
Preview
1.0.4934
- standalone
@deprecated
not ignored - few performance improvements
- fixes duplicities in reported problems
- some problems caused by other problems not reported
- workspace loading and code editing improvements
Preview
1.0.4908
- less falsely positive warnings
- improved type analysis of
static
and properties - PHP 8.0 (Alpha 1) syntax supported
- New PHP 8.0 compatibility warnings
- fixed implements abstracts for trait members
- improved formatting when using tabs
Preview
1.0.4698
- better placement of
use
quick action
Preview
1.0.4666
- fixes for systems without .NET Runtime (3.x or 5.x) installed
Preview
1.0.4654
- improved run of all tests (runs within single process now)
- PHPDoc type hints in
@method
respect current namespace - locals in arrow function used from parent scope and annotated properly
Preview
1.0.4608
- configuration snippet for
Launch current script in console
fixed - HTML tooltips in PHP script
<
triggers HTML completion- PCRE patterns check (within
preg_*
functions) - PHPDoc
@method
with vararg supported - unused
use
highlighting respects custom PHPDoc tags - Test Explorer fixes:
- debugging session closed after test finishes
- test cases can be debugged without additional configuration
- fixes exception upon test run
Preview
1.0.4394
- fixed completion of variables (
$
prefix is not duplicated)
Preview
1.0.4277
- code flow analysis improvements for
finally
blocks - makes use of
dotnet
3.1 if installed on the system - minor fixes, and updates to stabilty issues
Preview
1.0.4229
Implement abstracts
code action & quick fix (interfaces and abstract members)Add getter/setter
code action for fields and multiple fields- updates to stability issues
Preview
1.0.4187
- code editor fixes (occuring when format on save, format on paste)
- completion inside PHPDoc
Preview
1.0.4168
- improved listing symbols in document/workspace
- listing properties when searching prefixed with
$
- navigation to trait uses
Preview
1.0.4145
- problems check for not implemented functions
- problems check for traits
- improved tooltips and performance
- updated builtin PHP manual
- debugger reports common issues human friendly
Preview
1.0.4009
{@link}
in tooltips shown as hyperlink{@inheritdoc}
gets substituted according to PHPDoc specs.- updated blade templating editor (
@section
,@yield
) and formatting fixes - embedded HTML fixes
- stability fixes, improved internal error logging
- reporting problems improvements
Preview
1.0.3951
- generated PHPDoc respects type hints
- generated PHPDoc treats nullable types correctly
- language server crash fix
- avoids spawning
rg.exe
when runningcomposer install|update
(fixes system freezing)
Preview
1.0.3936
- PHAR files in workspace get parsed
- code completion includes declarations from PHAR files
- go to definition supports content in PHAR files
- navigation through entries in PHAR files
- signature help and tooltips for declarations in PHAR files
- minor fixes and improvements
Preview
1.0.3774
- formatting of typed properties
- completion after
use
is filtered by class name - obtaining long data from Xdebug
Preview
1.0.3748
- classes/interfaces/traits not available in current namespace or uses are not listed in code completion
- dynamic class aliasing supported in code completion and type analysis (
class_alias()
and Joomla registered aliases) - PHP in blade blocks (
.blade.php
) (except syntax highlighting) - improved type analysis of arguments passed by reference
- fixed pasting when
Format on Paste
is enabled (HTML was corrupted)
Preview
1.0.3703
- performance optimizations
php.problems.workspaceAnalysis
setting to enable/disable workspace-wide problems analysis- array unpack type check
PHP 7.4 support
- PHP 7.4 support (arrow functions, typed properties, spread array,
??=
operator, underscores in numbers) - PHP 7.4 features reported when using PHP < 7.4
- PHP 7.4 features analysis, type analysis, problems analysis
- spread array type check
Preview
1.0.3645
- improved project load and background analysis
.phpstorm.meta.php
(version 2016.2+) processed- Code completion and analysis of IoC
- fixed formatting for nullable types
- formatting pretty-prints opening bracket
{
- formatting code style defaults to
PSR-2
Preview
1.0.3603
- fixed issue when some warnings disappear and after few secs appear
- improved CPU use when opening/closing documents
- fixed formatting around
?:
and::
- improved code analysis evaluation
- less strict analysis of use of uninitialized variables
- completion after
use
gets fully qualified names
Preview
1.0.3593
- diagnostics of magic methods
- diagnostics of duplicit function parameters
- improved type analysis of numbers
- launching debugger enhancements
- PSR-2 formatter fixes
Preview
1.0.3574
- improved type analysis of
explode()
,microtime()
, Oxid framework catch
variable diagnostics and analysis
Preview
1.0.3547
- formatter improvements
- DBGP proxy support
- improved unused variable diagnostic
Preview
1.0.3525
- anonymous functions type analysis
- anonymous functions annotated with PHPDoc
- anonymous functions details in tool tips
- signature help with function return type
- dimmed unused variables
- loading project performance, responsiveness
Preview
1.0.3507
- fixed increasing number of untitled documents upon code format
- type analysis improvements
- inital support for dbgp proxy
Preview
1.0.3483
- updated PHP manual
- validation of value passed to
define()
- validation of use of
define()
on PHP >= 7.3
Preview
1.0.3471
- support for logpoints
php.format.codeStyle
can be set in the workspace scope- code formatting fixes, indentation after opening tag, blocks on a new line
html
+php
formatting fix for overlapping ranges error
Preview
1.0.3435
- fix for disabling breakpoints
- optimized debug protocol
Preview
1.0.3428
- updated PHP manual for the latest PHP 7.3 and PHP 7.4 constructs
- updated readme
Preview
1.0.3386
- Disabled warning PHP0424 when passing an object in foreach
- Analysis of use params within lambda function
- Minor code navigation fixes
- Minor code formatting fixes
Preview
1.0.3348
- signature helper fixed, showing the correct parameter
- fixes running the extension when there is no
dotnet
- works with
dotnet
3.0
Preview
1.0.3241
- PHPDoc generation with parameter names
Preview
1.0.3230
- PHPDoc blocks inserted with placeholders (snippet)
- PHPDoc tags snippets
- PHP compatibility warnings
- fixed not disappearing warnings after file delete
- fixed pretty-print of
die()
construct - fixed formatting for function headers and properties
Preview
1.0.3202
- updated PHP manual
- format on type (
;
and}
) - format profile
Off
- formatting not applied when code is syntax invalid
Preview
1.0.3185
- code completion in PHPDoc for PHPDoc keywords (after
@
) - code actions for typos in PHPDoc and unknown type names in PHPDoc
Preview
1.0.3174
- code action for adding
use ;
when applicable - code action to fully qualify type name when necessary
- generating
PHPDoc
when user types/**
(formatOnType
must be enabled) - selection format
- localized messages - en, de, ja, tz, es
Preview
1.0.3058
- improved code formatting
- few texts localized to german
Preview
1.0.3031
- folding collapses the inner range
- formatting code style setting
php.format.codeStyle
- PHPDoc for local variables with multiple
@var
/@global
tags - code suggestion to add
$this->
if applicable
Preview
1.0.3003
- code suggestion for an unknown class error
- unnecessary
use
directives are rendered as fade out F10
andF11
start debugging and stop on entryexclude
launch configuration - patterns that will be skipped from debugging when stepping- debugger allows setting a variable or property value
- debugger supports long strings
- debugger supports paging for large arrays
- test explorer optimization
- generated files are not included in user's workspace
- test explorer shows only user's tests, only if there is no
phpunit.xml
in root then all tests in recursive dirs are listed
Preview
1.0.2930
- display language setting
phpTools.language
can be changed without reloading the workspace - changing setting
php.problems.exclude
updates the problems window - a file changed outside the editor gets updated
- stability fixes
Preview
1.0.2915
- debugger allows inspecting stack frames and locals value
- experimental: setting
files.exclude
is handled - experimental: setting
php.problems.exclude
allows ignoring specified folders and all or specified problem codes - not completing items right after <?
- highlighting references under caret optimization
Preview
1.0.2895
- project problems are updated after the workspace is loaded
- some false warnings are not reported
pathMappings
launch configuration- fix: closing language server process on Unix systems
- fix: working with large mixed HTML/JS/CSS/PHP code
- signature help for new objects
- memory and perf. optimization
- stability fixes
- project startup optimizations
- code folding for all parenthesis
Preview
1.0.2802
- option to activate license/request trial offline
- option to mute warning about missing PHP
- tests are not loaded and run automatically (either enable
autorun
or clickreload
/start
) - debug watch tooltip provides expandable object properties
- more detailed output log about PHP and Xdebug that will be used for debugging/tests
F5
starts debugging of current script even without havinglaunch.json
configuration- does not provide basic completion after
:
(but::
) - code completion handles ambiguous trait declarations
Preview
1.0.2765
- Symbols in workspace feature.
- Processing all files mapped to
php
language. - Code completion improvements.
Preview
1.0.2738
- Test Explorer detects phpunit.xml.dist to get enabled
- code completion handles ambiguous types better
- short open tags
<?
allowed if there is no normal open tag<?php
- updated readme and documentation
- re-enabled completion after $ (fixes recent update in VSCode)
Preview
1.0.2681
- option to request trial license
- downloading dependencies from CDN
- updated the extension's publisher ID
Preview
1.0.2590
- triggering completion after ->, $, \, ::
- code folding for blocks, comments, PHPDoc and regions
- language server providing
- code completion
- hover
- formatting
- code structure
- signature help
- find all references
- navigation
- go to definition
- refactoring
- highlighting
- code analysis and validation
- debug support
- watch
- debug mouse watch
- breakpoints
- UNC paths
- path mapping
- remote debug, console, built-in server
- workspaces
- UNC paths
- built-in PHP server
- PHPUnit Test Explorer
- Live testing
- Tests debugger
- Tests browser
- Initial version of PHP Tools for VS Code