This code produced an 'Unused use statement' error:

"<?php"
  2 => ""
  3 => "namespace Drupal\test_module\Plugin\CatFeeder;"
  4 => ""
  5 => "use Drupal\Component\Plugin\PluginBase;"
  6 => "use Drupal\test_module\Plugin\CatFeeder\CatFeederInterface;"
  7 => ""
  8 => "/**"
  9 => " * Base class for Cat Feeder plugins."
  10 => " */"
  11 => "abstract class CatFeederBase extends PluginBase implements CatFeederInterface {"
  12 => ""
  13 => "}"
  14 => ""
]

The problem is actually that the imported CatFeederInterface is in the same namespace as the class.

This code in the sniff checks for that:

        // Check if the referenced class is in the same namespace as the current
        // file. If it is then the use statement is not necessary.
        $namespacePtr = $phpcsFile->findPrevious([T_NAMESPACE], $stackPtr);

The error message would be clearer if it specifically said that for this case.

Comments

joachim created an issue.