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

fix(UnusedUseStatementSniff): Improve fixer to make @return data types fully namespaced

parent 8fd571fc
Branches
Tags 5.x-1.1
No related merge requests found
......@@ -173,7 +173,7 @@ class Drupal_Sniffs_Classes_UnusedUseStatementSniff implements PHP_CodeSniffer_S
$tag = $phpcsFile->findNext(T_DOC_COMMENT_TAG, ($stackPtr + 1));
while ($tag !== false) {
if ($tokens[$tag]['content'] === '@var'
if (($tokens[$tag]['content'] === '@var' || $tokens[$tag]['content'] === '@return')
&& isset($tokens[($tag + 1)]) === true
&& $tokens[($tag + 1)]['code'] === T_DOC_COMMENT_WHITESPACE
&& isset($tokens[($tag + 2)]) === true
......
......@@ -86,4 +86,17 @@ class Pum {
return $y;
}
/**
* Return declarations should also get fixed to the full namespace.
*
* @param array $x
* Some array.
*
* @return VarName
* The variable.
*/
protected function test7($x) {
return $x['test'];
}
}
......@@ -76,4 +76,17 @@ class Pum {
return $y;
}
/**
* Return declarations should also get fixed to the full namespace.
*
* @param array $x
* Some array.
*
* @return \Some\Data\VarName
* The variable.
*/
protected function test7($x) {
return $x['test'];
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment