Docblocks should only be used on structural elements.
Whether to allow PHPDoc before return statement.
Allowed types: bool
Default value: false
List of ignored tags (matched case insensitively).
Allowed types: list<string>
Default value: []
Default configuration.
--- Original
+++ New
<?php
$first = true;// needed because by default first docblock is never fixed.
-/** This should be a comment */
+/* This should be a comment */
foreach($connections as $key => $sqlite) {
$sqlite->open($path);
}
With configuration: ['ignored_tags' => ['todo']]
.
--- Original
+++ New
<?php
$first = true;// needed because by default first docblock is never fixed.
-/** This should be a comment */
+/* This should be a comment */
foreach($connections as $key => $sqlite) {
$sqlite->open($path);
}
/** @todo This should be a PHPDoc as the tag is on "ignored_tags" list */
foreach($connections as $key => $sqlite) {
$sqlite->open($path);
}
With configuration: ['allow_before_return_statement' => true]
.
--- Original
+++ New
<?php
$first = true;// needed because by default first docblock is never fixed.
-/** This should be a comment */
+/* This should be a comment */
foreach($connections as $key => $sqlite) {
$sqlite->open($path);
}
function returnClassName() {
/** @var class-string */
return \StdClass::class;
}
The rule is part of the following rule sets:
- Fixer class: PhpCsFixer\Fixer\Phpdoc\PhpdocToCommentFixer
- Test class: PhpCsFixer\Tests\Fixer\Phpdoc\PhpdocToCommentFixerTest
The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.