Writing PHPDoc
PHPDoc Completion#
PHPDoc block is completed by typing '` function foo($x) { // } ```
Type hints are supported within the vast array of tags, including standard Doc Comment tags (i.e. @return
, @param
), PhpStan tags (i.e. @phpstan-assert
, @phpstan-template
, ..), or Psalm. They do support the generic type annotations, WordPress type annotations, MediaWiki annotations, and more.
Additionally, type hints are highlighted with colors defined your Visual Studio Code Theme. This handles generic type annotations, structured objects, structured array syntax, specific colors for interfaces, enum, traits.
PHPDoc Highlighting in the Editor#
Use the setting "php.docblock.colorMode"
to change how the text inside `` is highlighted. PHP Tools extension parses and colorizes entities in PHPDoc semantically. This can be changed:
null
: default, the colorization of type names, keywords, interfaces, enums, and other entities semantically. This also improves colorization for PhpStan, Psalm, and other extended syntaxes. This is recommended setting."simple"
: use single color for all type names and namespaces."fallback"
: let Visual Studio Code to colorize the text according to its grammer. This is known to colorize some parts of text incorrectly.