For documentation comments, IntelliJ IDEA provides completion that is enabled by default. IntelliJ IDEA creates stubs of PHPDoc blocks when you type the If you need
additional PHP-specific tags, IntelliJ IDEA provides code completion that suggests the tag names that are relevant in the current context. If a certain tag has multiple values, code completion provides a list of available values. In PHPDoc comments, IntelliJ IDEA supports formatting options in compliance with the ZEND, PEAR, and other coding standards. PHPDoc comments in your source code are available for Quick Documentation Lookup, which helps you get quick information for any documented symbol. You can open them for review in the Documentation tool window by pressing
Ctrl+Q. This functionality relies on the PHP plugin that
should be installed and enabled in your IDE. The plugin is available only in IntelliJ IDEA Ultimate. Press
Ctrl+Alt+S to open the IDE settings and select . Switch to the Marketplace tab and use the search field to find the PHP plugin. Click Install and restart the IDE if prompted. Enable documentation comments
Generate a PHPDoc block for a code construct
Create tags in a PHPDoc comment blockIntelliJ IDEA analyzes the appointed code construct, extracts the data for parameters, return values, variables, or fields where possible, and on this basis generates a stub of a documentation block. If necessary, you can fill in the missing information.
Configure formatting inside PHPDoc commentsYou can configure the appearance of PHPDoc comments, the presentation of class names, and the default tags sorting order. Note that the tag for properties is no longer configurable, the default @var tag is inserted automatically. See https://github.com/phpDocumentor/fig-standards/pull/55 for details.
Using PHPDoc code inspectionsIntelliJ IDEA provides a set of predefined code inspections targeted at PHPDoc blocks. These inspections check whether classes, methods, functions, variables, and constants are supplied with a PHPDoc comment and whether the tags in the comment match the documented item. Enable or disable a PHPDoc inspection
Check that PHPDoc comments are provided for code constructs of a certain type
Last modified: 14 July 2022 What are PHPDoc comments?phpDoc blocks are descriptive comments that are part of the application code. They are used to describe the PHP element in the exact location in the code where the element appears. The block consists of a short description, long description, and phpDoc tags.
Why must you use PHPDoc syntax to document code?PhpDoc, short for PhpDocumentor, is a powerful tool that allows you to easily document your code via specially formatted comments. The documentation will be available not only in the source code, but also in professional documentation extracted using either the web or command-line interface.
|