Skip to content

Commit

Permalink
UnusedUsesSniff: More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Jul 9, 2021
1 parent 4607562 commit 4fd3471
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/Sniffs/Namespaces/UnusedUsesSniffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function testUsedUseInAnnotationWithDisabledSearchAnnotations(): void
'searchAnnotations' => false,
]);

self::assertSame(66, $report->getErrorCount());
self::assertSame(67, $report->getErrorCount());

self::assertSniffError($report, 5, UnusedUsesSniff::CODE_UNUSED_USE, 'Type Assert is not used in this file.');
self::assertSniffError(
Expand Down Expand Up @@ -186,6 +186,7 @@ public function testUsedUseInAnnotationWithDisabledSearchAnnotations(): void
self::assertSniffError($report, 68, UnusedUsesSniff::CODE_UNUSED_USE, 'Type TypeAlias2 is not used in this file.');
self::assertSniffError($report, 69, UnusedUsesSniff::CODE_UNUSED_USE, 'Type SomeImportFrom1 is not used in this file.');
self::assertSniffError($report, 70, UnusedUsesSniff::CODE_UNUSED_USE, 'Type SomeImportFrom2 is not used in this file.');
self::assertSniffError($report, 71, UnusedUsesSniff::CODE_UNUSED_USE, 'Type ArrayValue is not used in this file.');
}

public function testUsedUseInAnnotationWithEnabledSearchAnnotations(): void
Expand Down
4 changes: 4 additions & 0 deletions tests/Sniffs/Namespaces/data/unusedUsesInAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
use TypeAlias2;
use SomeImportFrom1;
use SomeImportFrom2;
use ArrayValue;

/**
* @ORM\Entity()
Expand Down Expand Up @@ -234,6 +235,9 @@ public function returnsCallable()
/** @var array{int: ArrayShape2} $arrayShape2 */
$arrayShape2 = [];

/** @var array<int, ArrayValue> $array */
$array = [];

/**
* @method method1(string $parameter = ConstantExpression1::class)
* @method method2(array $parameter = [ConstantExpression2::class => ConstantExpression3::class])
Expand Down

0 comments on commit 4fd3471

Please sign in to comment.