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
d3286d57
Unverified
Commit
d3286d57
authored
4 years ago
by
Peter Decuyper
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(FunctionComment): Add support for variadic function argument comment (
#2878783
by zero2one)
parent
6db342aa
No related branches found
No related tags found
1 merge request
!4
Issue #3217297: False positive in closure usage of USE keyword.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php
+7
-0
7 additions, 0 deletions
...sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php
tests/Drupal/good/good.php
+10
-0
10 additions, 0 deletions
tests/Drupal/good/good.php
with
17 additions
and
0 deletions
coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php
+
7
−
0
View file @
d3286d57
...
...
@@ -696,6 +696,13 @@ class FunctionCommentSniff implements Sniff
}
$suggestedType
=
implode
(
'|'
,
$suggestedNames
);
// Support variadic arguments.
if
(
preg_match
(
'/(\s+)\.{3}$/'
,
$param
[
'type'
],
$matches
)
===
1
)
{
$param
[
'type_space'
]
=
strlen
(
$matches
[
1
]);
$param
[
'type'
]
=
preg_replace
(
'/\s+\.{3}$/'
,
''
,
$param
[
'type'
]);
}
if
(
preg_match
(
'/\s/'
,
$param
[
'type'
])
===
1
)
{
$error
=
'Parameter type "%s" must not contain spaces'
;
$data
=
[
$param
[
'type'
]];
...
...
This diff is collapsed.
Click to expand it.
tests/Drupal/good/good.php
+
10
−
0
View file @
d3286d57
...
...
@@ -1576,6 +1576,16 @@ function test23(): TestReturnType {
return
foo
();
}
/**
* Variadic arguments with proper declaration.
*
* @param \Drupal\mymodule\Element ...$element
* The variadic parameter comment.
*/
function
test24
(
Element
...
$element
)
{
}
/**
* Test class.
*/
...
...
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