aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-11-30 20:55:29 +0100
committerTristan Darricau <github@nicofuma.fr>2014-11-30 20:55:29 +0100
commit7f7f60698c5b73450dd2dc2e3b878fc0668e933f (patch)
tree9b2adca56213e1f4d9c1c5a938aa8b6c4a61a8a2
parent13d43948447ab3a29105e6a2756c34831b1d5c9d (diff)
downloadforums-7f7f60698c5b73450dd2dc2e3b878fc0668e933f.tar
forums-7f7f60698c5b73450dd2dc2e3b878fc0668e933f.tar.gz
forums-7f7f60698c5b73450dd2dc2e3b878fc0668e933f.tar.bz2
forums-7f7f60698c5b73450dd2dc2e3b878fc0668e933f.tar.xz
forums-7f7f60698c5b73450dd2dc2e3b878fc0668e933f.zip
[ticket/13402] Handle arrays and multiples types
PHPBB3-13402
-rw-r--r--build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
index 0dea58dd49..87e676b8ff 100644
--- a/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
+++ b/build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php
@@ -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)