mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/17496] Unused use statements sniffer to check union types
PHPBB-17496
This commit is contained in:
parent
7d1ae5bf19
commit
91aaadbc6d
1 changed files with 3 additions and 1 deletions
|
@ -49,7 +49,9 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff
|
||||||
$phpcsFile->addError($error, $stack_pointer, 'FullName');
|
$phpcsFile->addError($error, $stack_pointer, 'FullName');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($found_name === $short_name)
|
// Check for possible union types like string|MyType|null
|
||||||
|
$types = explode('|', $found_name);
|
||||||
|
if (in_array($short_name, $types, true))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue