Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coder
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
coder
Commits
18b371d9
Unverified
Commit
18b371d9
authored
4 years ago
by
Jonathan Smith
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(DocComment): Correct doc tag group spacing (
#3181485
by jonathan1055)
parent
67c1bcf2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php
+11
-7
11 additions, 7 deletions
coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php
with
11 additions
and
7 deletions
coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php
+
11
−
7
View file @
18b371d9
...
...
@@ -369,10 +369,15 @@ class DocCommentSniff implements Sniff
'@param'
,
'@return'
,
'@throws'
,
'@ingroup'
,
];
foreach
(
$tokens
[
$commentStart
][
'comment_tags'
]
as
$pos
=>
$tag
)
{
if
(
$pos
>
0
)
{
// If this tag is not in the same column as the initial tag then
// it must be an inline comment tag and should be ignored here.
if
(
$tokens
[
$tag
][
'column'
]
!==
$tokens
[
$firstTag
][
'column'
])
{
continue
;
}
$prev
=
$phpcsFile
->
findPrevious
(
T_DOC_COMMENT_STRING
,
(
$tag
-
1
),
...
...
@@ -387,7 +392,7 @@ class DocCommentSniff implements Sniff
if
(
$isNewGroup
===
true
)
{
$groupid
++
;
}
}
}
//end if
$currentTag
=
$tokens
[
$tag
][
'content'
];
if
(
$currentTag
===
'@param'
)
{
...
...
@@ -404,11 +409,10 @@ class DocCommentSniff implements Sniff
$paramGroupid
=
$groupid
;
}
//
The @param, @return and @throws t
ag sections should be
//
separated by a blank
line both before and after the
se
sections.
//
All of the $checkT
ag
s
sections should be
separated by a blank
// line both before and after the sections.
}
else
if
(
$isNewGroup
===
false
&&
in_array
(
$currentTag
,
$checkTags
)
===
true
&&
in_array
(
$previousTag
,
$checkTags
)
===
true
&&
(
in_array
(
$currentTag
,
$checkTags
)
===
true
||
in_array
(
$previousTag
,
$checkTags
)
===
true
)
&&
$previousTag
!==
$currentTag
)
{
$error
=
'Separate the %s and %s sections by a blank line.'
;
...
...
@@ -443,7 +447,7 @@ class DocCommentSniff implements Sniff
// but account for a multi-line tag comments.
$lastTag
=
$group
[
$pos
];
$next
=
$phpcsFile
->
findNext
(
T_DOC_COMMENT_TAG
,
(
$lastTag
+
3
),
$commentEnd
);
if
(
$next
!==
false
)
{
if
(
$next
!==
false
&&
$tokens
[
$next
][
'column'
]
===
$tokens
[
$firstTag
][
'column'
]
)
{
$prev
=
$phpcsFile
->
findPrevious
([
T_DOC_COMMENT_TAG
,
T_DOC_COMMENT_STRING
],
(
$next
-
1
),
$commentStart
);
if
(
$tokens
[
$next
][
'line'
]
!==
(
$tokens
[
$prev
][
'line'
]
+
2
))
{
$error
=
'There must be a single blank line after a tag group'
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment