PHPCS is reporting
<error line="5" column="1" severity="warning" message="Unused use statement" source="Drupal.Classes.UnusedUseStatement.UnusedUse"/>
for my use statement
use Drupal\Core\Entity\EntityStorageException;
however later in the same file I have
/**
* {@inheritdoc}
* @throws EntityStorageException
*/
protected function setUp(): void {
so it seems to me that PHPCS is not checking the annotations when deciding if a namespace is unused?
BTW I'm using the config_set from https://www.drupal.org/project/coder so perhaps it's a bug there. I tried switching config checking off for that line using // phpcs:disable and // phpcs: ignore but that didn't help.
From the documentation (PHP_Codesniffer: ignoring parts of a file):
You can try wrapping the offending code in special comments. Their example:
(Imperfect answer but at least it can let you get to a clean
phpcsrun.)