Loading coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php +7 −0 Original line number Diff line number Diff line Loading @@ -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']]; Loading tests/Drupal/good/good.php +10 −0 Original line number Diff line number Diff line Loading @@ -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. */ Loading Loading
coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php +7 −0 Original line number Diff line number Diff line Loading @@ -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']]; Loading
tests/Drupal/good/good.php +10 −0 Original line number Diff line number Diff line Loading @@ -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. */ Loading