mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/13402] Handle arrays and multiples types
PHPBB3-13402
This commit is contained in:
parent
13d4394844
commit
7f7f60698c
1 changed files with 10 additions and 2 deletions
|
@ -160,17 +160,25 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements PHP_CodeSniffer_Sniff
|
||||||
// Check @param
|
// Check @param
|
||||||
foreach ($comment_parser->getParams() as $param) {
|
foreach ($comment_parser->getParams() as $param) {
|
||||||
$type = $param->getType();
|
$type = $param->getType();
|
||||||
|
$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;
|
$ok = $this->check($type, $class_name_full, $class_name_short, $param->getLine() + $comment_start) ? true : $ok;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check @return
|
// Check @return
|
||||||
$return = $comment_parser->getReturn();
|
$return = $comment_parser->getReturn();
|
||||||
if ($return !== null)
|
if ($return !== null)
|
||||||
{
|
{
|
||||||
$type = $return->getValue();
|
$type = $return->getValue();
|
||||||
|
$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;
|
$ok = $this->check($type, $class_name_full, $class_name_short, $return->getLine() + $comment_start) ? true : $ok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (PHP_CodeSniffer_CommentParser_ParserException $e)
|
catch (PHP_CodeSniffer_CommentParser_ParserException $e)
|
||||||
{
|
{
|
||||||
$line = ($e->getLineWithinComment() + $comment_start);
|
$line = ($e->getLineWithinComment() + $comment_start);
|
||||||
|
|
Loading…
Add table
Reference in a new issue