Skip to content

Commit ecb6084

Browse files
committed
DisallowArrayTypeHintSyntaxSniff: More tests
1 parent 24b8b34 commit ecb6084

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

tests/Sniffs/TypeHints/DisallowArrayTypeHintSyntaxSniffTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testErrors(): void
2121
],
2222
]);
2323

24-
self::assertSame(16, $report->getErrorCount());
24+
self::assertSame(17, $report->getErrorCount());
2525

2626
self::assertSniffError($report, 6, DisallowArrayTypeHintSyntaxSniff::CODE_DISALLOWED_ARRAY_TYPE_HINT_SYNTAX, 'Usage of array type hint syntax in "\DateTimeImmutable[]" is disallowed, use generic type hint syntax instead.');
2727
self::assertSniffError($report, 7, DisallowArrayTypeHintSyntaxSniff::CODE_DISALLOWED_ARRAY_TYPE_HINT_SYNTAX, 'Usage of array type hint syntax in "bool[]" is disallowed, use generic type hint syntax instead.');
@@ -39,6 +39,7 @@ public function testErrors(): void
3939
self::assertSniffError($report, 33, DisallowArrayTypeHintSyntaxSniff::CODE_DISALLOWED_ARRAY_TYPE_HINT_SYNTAX, 'Usage of array type hint syntax in "bool[]" is disallowed, use generic type hint syntax instead.');
4040
self::assertSniffError($report, 36, DisallowArrayTypeHintSyntaxSniff::CODE_DISALLOWED_ARRAY_TYPE_HINT_SYNTAX, 'Usage of array type hint syntax in "int[]" is disallowed, use generic type hint syntax instead.');
4141
self::assertSniffError($report, 39, DisallowArrayTypeHintSyntaxSniff::CODE_DISALLOWED_ARRAY_TYPE_HINT_SYNTAX, 'Usage of array type hint syntax in "string[]" is disallowed, use generic type hint syntax instead.');
42+
self::assertSniffError($report, 42, DisallowArrayTypeHintSyntaxSniff::CODE_DISALLOWED_ARRAY_TYPE_HINT_SYNTAX, 'Usage of array type hint syntax in "int[]" is disallowed, use generic type hint syntax instead.');
4243

4344
self::assertAllFixedInFile($report);
4445
}

tests/Sniffs/TypeHints/data/disallowArrayTypeHintSyntaxErrors.fixed.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,7 @@ class Whatever
3939
/** @var \Anything|array<string> */
4040
public $j;
4141

42+
/** @var array<int>|string */
43+
public $k;
44+
4245
}

tests/Sniffs/TypeHints/data/disallowArrayTypeHintSyntaxErrors.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,7 @@ class Whatever
3939
/** @var \Anything|string[] */
4040
public $j;
4141

42+
/** @var int[]|string */
43+
public $k;
44+
4245
}

0 commit comments

Comments
 (0)