Skip to content

Commit

Permalink
UnusedUses ignores uses in annotations with multi lines string arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
mathroc authored and kukulich committed Aug 8, 2023
1 parent 90d0c8a commit fd2b381
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/Sniffs/Namespaces/UnusedUsesSniffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public function testUnusedUse(): void
self::assertNoSniffError($report, 29);

self::assertNoSniffError($report, 30);

self::assertNoSniffError($report, 91);
}

public function testUnusedUseWithMultipleNamespaces(): void
Expand Down Expand Up @@ -96,7 +98,7 @@ public function testUsedUseInAnnotationWithDisabledSearchAnnotations(): void
'searchAnnotations' => false,
]);

self::assertSame(85, $report->getErrorCount());
self::assertSame(86, $report->getErrorCount());

self::assertSniffError($report, 5, UnusedUsesSniff::CODE_UNUSED_USE, 'Type Assert is not used in this file.');
self::assertSniffError(
Expand Down
8 changes: 8 additions & 0 deletions tests/Sniffs/Namespaces/data/unusedUsesInAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use OpenApi\Annotations as OA;

/**
* @ORM\Entity()
Expand Down Expand Up @@ -345,3 +346,10 @@ class DDC1514EntityB
*/
public $id;
}

/**
* @OA\Tag(name="
* ")
*/
class AnnotationWithMultiLinesStringArguments {
}

0 comments on commit fd2b381

Please sign in to comment.