Skip to content

Commit 8430e6d

Browse files
committed
iterable is now a token instead of a Name
1 parent 1d76657 commit 8430e6d

File tree

4 files changed

+11
-32
lines changed

4 files changed

+11
-32
lines changed

src/Parser.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ public function __construct() {
141141
$this->parameterTypeDeclarationTokens =
142142
[TokenKind::ArrayKeyword, TokenKind::CallableKeyword, TokenKind::BoolReservedWord,
143143
TokenKind::FloatReservedWord, TokenKind::IntReservedWord, TokenKind::StringReservedWord,
144-
TokenKind::ObjectReservedWord, TokenKind::NullReservedWord, TokenKind::FalseReservedWord]; // TODO update spec
144+
TokenKind::ObjectReservedWord, TokenKind::NullReservedWord, TokenKind::FalseReservedWord,
145+
TokenKind::IterableKeyword]; // TODO update spec
145146
$this->returnTypeDeclarationTokens = \array_merge([TokenKind::VoidReservedWord, TokenKind::NullReservedWord, TokenKind::FalseReservedWord, TokenKind::StaticKeyword], $this->parameterTypeDeclarationTokens);
146147
}
147148

src/TokenKind.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class TokenKind {
8787
const YieldFromKeyword = 167;
8888
const FnKeyword = 168;
8989
const MatchKeyword = 169;
90+
const IterableKeyword = 170;
9091

9192
const OpenBracketToken = 201;
9293
const CloseBracketToken = 202;

src/TokenStringMaps.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ class TokenStringMaps {
103103
"integer" => TokenKind::IntegerReservedWord,
104104
"object" => TokenKind::ObjectReservedWord,
105105
"real" => TokenKind::RealReservedWord,
106-
"void" => TokenKind::VoidReservedWord
106+
"void" => TokenKind::VoidReservedWord,
107+
"iterable" => TokenKind::IterableKeyword,
107108
];
108109

109110
const OPERATORS_AND_PUNCTUATORS = array(

tests/cases/parser74/arrowFunctionUnionTypes.php.tree

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,8 @@
241241
"visibilityToken": null,
242242
"questionToken": null,
243243
"typeDeclaration": {
244-
"QualifiedName": {
245-
"globalSpecifier": null,
246-
"relativeSpecifier": null,
247-
"nameParts": [
248-
{
249-
"kind": "Name",
250-
"textLength": 8
251-
}
252-
]
253-
}
244+
"kind": "IterableKeyword",
245+
"textLength": 8
254246
},
255247
"otherTypeDeclarations": {
256248
"QualifiedNameList": {
@@ -406,16 +398,8 @@
406398
"visibilityToken": null,
407399
"questionToken": null,
408400
"typeDeclaration": {
409-
"QualifiedName": {
410-
"globalSpecifier": null,
411-
"relativeSpecifier": null,
412-
"nameParts": [
413-
{
414-
"kind": "Name",
415-
"textLength": 8
416-
}
417-
]
418-
}
401+
"kind": "IterableKeyword",
402+
"textLength": 8
419403
},
420404
"otherTypeDeclarations": {
421405
"QualifiedNameList": {
@@ -589,16 +573,8 @@
589573
"textLength": 1
590574
},
591575
{
592-
"QualifiedName": {
593-
"globalSpecifier": null,
594-
"relativeSpecifier": null,
595-
"nameParts": [
596-
{
597-
"kind": "Name",
598-
"textLength": 8
599-
}
600-
]
601-
}
576+
"kind": "IterableKeyword",
577+
"textLength": 8
602578
}
603579
]
604580
}

0 commit comments

Comments
 (0)