PHP extension for Visual Studio Code is getting more features and updates!
The editor is getting more fine-tuned features, minor adjustments, nice-to-have features, new code diagnostics, and fixes. Please see the following list for some of them:
declare
and declare(strict_types=1);
after <?php
tag.Ctrl
+Click
(or go to with F12
) on @inheritdoc
to navigate to base Doc Comment directly. #897null
specified as Doc Comment @param
type is reported as invalid.true
pseudo-type correctly handled within union types.trait
adaptation blocks have been implemented. (#582)phpstorm.meta.php
Supporting .phpstorm.meta.php
with expectedArgments()
and argumentsSet()
now.
@phpstan-type
and @psalm-type
Since now, we have basic support for local-type aliasing.
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;
}
static
TypeWe have re-implemented the internals and improved type analysis for various cases involving the 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).
We've added an option to show return type inlay hint only for named functions, not for anonymous functions and arrow functions (#326).
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.
The following setting works for sorting and organizing use
statements on save:
{
"editor.codeActionsOnSave": { "source.organizeImports": true },
}
Add Missing PHPDoc
Code ActionThe 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.
@see
and @uses
is recognized during rename refactoring, find all references, and highlight occurrences.use
check works even if problems setting is turned off.Newly it is possible to run tests continuously. The watch icon in Testing panel allows us to keep all the tests, test suites, or just specific test cases always up-to-date. (#1479)
This latest update allows running ParaTest in the same way as PHPUnit tests. To do so:
Composer: require dev package
, and search package brianium/paratest
.{
"phpunit.phpunit": "./vendor/bin/paratest"
}
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:
"composer.workingPath"
SettingThanks to the feedback #909, we've added setting "composer.workingPath"
where users can specify the relative path for the composer.json
and vendor
folders.
:
at the end. (#1600)instanceof
keyword.new()
are handled correctly in mouse hover and code completion.match
, fn
, and interface
are not reported as syntax errors when within a qualified name (PHP 8.0+).true
, false
, and null
type names. (#338)@ignore
tag as unknown.is_a()
analyzed correctly.__callStatic()
magic method.