Skip to content
Snippets Groups Projects
Commit 4337ddf5 authored by Klaus Purer's avatar Klaus Purer
Browse files

fix(DocCommentAlignment): Allow @see references to be indented under @param docs (#3073750)

parent 284b5186
No related branches found
No related tags found
No related merge requests found
...@@ -137,9 +137,10 @@ class DocCommentAlignmentSniff implements Sniff ...@@ -137,9 +137,10 @@ class DocCommentAlignmentSniff implements Sniff
} }
} else if ($tokens[($i + 2)]['code'] === T_DOC_COMMENT_TAG } else if ($tokens[($i + 2)]['code'] === T_DOC_COMMENT_TAG
&& $tokens[($i + 1)]['content'] !== ' ' && $tokens[($i + 1)]['content'] !== ' '
// Special @code/@endcode tags can have more than 1 space. // Special @code/@endcode/@see tags can have more than 1 space.
&& $tokens[($i + 2)]['content'] !== '@code' && $tokens[($i + 2)]['content'] !== '@code'
&& $tokens[($i + 2)]['content'] !== '@endcode' && $tokens[($i + 2)]['content'] !== '@endcode'
&& $tokens[($i + 2)]['content'] !== '@see'
) { ) {
$error = 'Expected 1 space after asterisk; %s found'; $error = 'Expected 1 space after asterisk; %s found';
$data = [strlen($tokens[($i + 1)]['content'])]; $data = [strlen($tokens[($i + 1)]['content'])];
......
...@@ -378,6 +378,7 @@ class DocCommentSniff implements Sniff ...@@ -378,6 +378,7 @@ class DocCommentSniff implements Sniff
$ignoreTags = [ $ignoreTags = [
'@code', '@code',
'@endcode', '@endcode',
'@see',
]; ];
foreach ($tokens[$commentStart]['comment_tags'] as $pos => $tag) { foreach ($tokens[$commentStart]['comment_tags'] as $pos => $tag) {
if ($pos > 0) { if ($pos > 0) {
......
...@@ -16,3 +16,14 @@ class Test { ...@@ -16,3 +16,14 @@ class Test {
var $varStyle; var $varStyle;
} }
/**
* Short description.
*
* @param string $a
* The following reference is allowed to be indented.
* @see my_function()
*/
function test31($a) {
}
...@@ -16,3 +16,14 @@ class Test { ...@@ -16,3 +16,14 @@ class Test {
public $varStyle; public $varStyle;
} }
/**
* Short description.
*
* @param string $a
* The following reference is allowed to be indented.
* @see my_function()
*/
function test31($a) {
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment