mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/16671] Allow using objects from the global namespace
PHPBB3-16671
This commit is contained in:
parent
b3e7c01ab6
commit
fd8cb2a0e8
1 changed files with 7 additions and 7 deletions
|
@ -29,18 +29,18 @@ class phpbb_Sniffs_Namespaces_UnusedUseSniff implements Sniff
|
|||
|
||||
protected function check(File $phpcsFile, $found_name, $full_name, $short_name, $stack_pointer)
|
||||
{
|
||||
$found_name = ltrim($found_name, '\\');
|
||||
$found_name_normalized = ltrim($found_name, '\\');
|
||||
$full_name = ltrim($full_name, '\\');
|
||||
|
||||
if ($found_name === $full_name)
|
||||
$is_global = ($full_name === $short_name);
|
||||
$unnecessarily_fully_qualified = ($is_global)
|
||||
? ($found_name_normalized !== $found_name && $found_name_normalized === $short_name)
|
||||
: ($found_name_normalized === $full_name);
|
||||
|
||||
if ($unnecessarily_fully_qualified)
|
||||
{
|
||||
$error = 'Either use statement or full name must be used.';
|
||||
$phpcsFile->addError($error, $stack_pointer, 'FullName');
|
||||
|
||||
if (strpos($phpcsFile->getFilename(), 'cron/manager.php') !== false)
|
||||
{
|
||||
print("$found_name, $full_name, $short_name}\n");
|
||||
}
|
||||
}
|
||||
|
||||
if ($found_name === $short_name)
|
||||
|
|
Loading…
Add table
Reference in a new issue