1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-17 22:28:46 +01:00

[ticket/13402] Handle arrays and multiples types

PHPBB3-13402
This commit is contained in:
Tristan Darricau 2014-11-30 20:55:29 +01:00
parent 13d4394844
commit 7f7f60698c

View File

@ -160,7 +160,11 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
// Check @param
foreach ($comment_parser->getParams() as $param) {
$type = $param->getType();
$ok = $this->check($type, $class_name_full, $class_name_short, $param->getLine() + $comment_start) ? true : $ok;
$types = explode('|', str_replace('[]', '', $type));
foreach ($types as $type)
{
$ok = $this->check($type, $class_name_full, $class_name_short, $param->getLine() + $comment_start) ? true : $ok;
}
}
// Check @return
@ -168,7 +172,11 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
if ($return !== null)
{
$type = $return->getValue();
$ok = $this->check($type, $class_name_full, $class_name_short, $return->getLine() + $comment_start) ? true : $ok;
$types = explode('|', str_replace('[]', '', $type));
foreach ($types as $type)
{
$ok = $this->check($type, $class_name_full, $class_name_short, $return->getLine() + $comment_start) ? true : $ok;
}
}
}
catch (PHP_CodeSniffer_CommentParser_ParserException $e)