Rule comment_to_phpdoc
¶
Comments with annotation should be docblock when used on structural elements.
Warning¶
Using this rule is risky¶
Risky as new docblocks might mean more, e.g. a Doctrine entity might have a new column in database.
Configuration¶
Examples¶
Example #1¶
Default configuration.
--- Original
+++ New
-<?php /* header */ $x = true; /* @var bool $isFoo */ $isFoo = true;
+<?php /* header */ $x = true; /** @var bool $isFoo */ $isFoo = true;
Example #2¶
With configuration: ['ignored_tags' => ['todo']]
.
--- Original
+++ New
<?php
// @todo do something later
$foo = 1;
-// @var int $a
+/** @var int $a */
$a = foo();
Rule sets¶
The rule is part of the following rule set:
References¶
Fixer class: PhpCsFixer\Fixer\Comment\CommentToPhpdocFixer
Test class: PhpCsFixer\Tests\Fixer\Comment\CommentToPhpdocFixerTest
The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.