Skip to content

Commit b013709

Browse files
committed
Fixed array shapes support
1 parent 49f50cf commit b013709

File tree

6 files changed

+5
-9
lines changed

6 files changed

+5
-9
lines changed

SlevomatCodingStandard/Helpers/AnnotationTypeHelper.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ public static function getIdentifierTypeNodes(TypeNode $typeNode): array
4040
if ($typeNode instanceof ArrayShapeNode) {
4141
$identifierTypeNodes = [];
4242
foreach ($typeNode->items as $arrayShapeItemNode) {
43-
if ($arrayShapeItemNode->keyName instanceof IdentifierTypeNode) {
44-
$identifierTypeNodes[] = $arrayShapeItemNode->keyName;
45-
}
46-
4743
$identifierTypeNodes = array_merge($identifierTypeNodes, self::getIdentifierTypeNodes($arrayShapeItemNode->valueType));
4844
}
4945
return $identifierTypeNodes;

tests/Sniffs/Namespaces/data/fullyQualifiedClassNameInAnnotationErrors.fixed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function returnsCallable()
149149
/** @var array{int, \Iterator} $arrayShape1 */
150150
$arrayShape1 = [];
151151

152-
/** @var array{\Iterator: int} $arrayShape2 */
152+
/** @var array{int: \Iterator} $arrayShape2 */
153153
$arrayShape2 = [];
154154

155155
/**

tests/Sniffs/Namespaces/data/fullyQualifiedClassNameInAnnotationErrors.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function returnsCallable()
149149
/** @var array{int, Iterator} $arrayShape1 */
150150
$arrayShape1 = [];
151151

152-
/** @var array{Iterator: int} $arrayShape2 */
152+
/** @var array{int: Iterator} $arrayShape2 */
153153
$arrayShape2 = [];
154154

155155
/**

tests/Sniffs/Namespaces/data/shouldBeInUseStatementSearchingInAnnotations.fixed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function returnsCallable()
117117
/** @var array{int, DateTime} $arrayShape1 */
118118
$arrayShape1 = [];
119119

120-
/** @var array{DateTime: int} $arrayShape2 */
120+
/** @var array{int: DateTime} $arrayShape2 */
121121
$arrayShape2 = [];
122122

123123
/**

tests/Sniffs/Namespaces/data/shouldBeInUseStatementSearchingInAnnotations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function returnsCallable()
113113
/** @var array{int, \Foo\DateTime} $arrayShape1 */
114114
$arrayShape1 = [];
115115

116-
/** @var array{\Foo\DateTime: int} $arrayShape2 */
116+
/** @var array{int: \Foo\DateTime} $arrayShape2 */
117117
$arrayShape2 = [];
118118

119119
/**

tests/Sniffs/Namespaces/data/unusedUsesInAnnotation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public function returnsCallable()
227227
/** @var array{int, ArrayShape1} $arrayShape1 */
228228
$arrayShape1 = [];
229229

230-
/** @var array{ArrayShape2: int} $arrayShape2 */
230+
/** @var array{int: ArrayShape2} $arrayShape2 */
231231
$arrayShape2 = [];
232232

233233
/**

0 commit comments

Comments
 (0)