Skip to content

Commit 3bc7a86

Browse files
committed
Add offset features support
1 parent 23b861f commit 3bc7a86

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"php": "^8.1",
1313
"psr/log": "^1.0|^2.0|^3.0",
1414
"psr/simple-cache": "^1.0|^2.0|^3.0",
15-
"type-lang/parser": "^1.3",
16-
"type-lang/printer": "^1.2"
15+
"type-lang/parser": "^1.4",
16+
"type-lang/printer": "^1.3"
1717
},
1818
"autoload": {
1919
"psr-4": {

src/Platform/GrammarFeature.php

+11-6
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
enum GrammarFeature
88
{
99
/**
10-
* Enables conditional types such as `T ? X : Y`.
10+
* Enables conditional types such as `T ? U : V`.
1111
*/
1212
case Conditional;
1313

1414
/**
15-
* Enables type shapes such as `T{key: X}`.
15+
* Enables type shapes such as `T{key: U}`.
1616
*/
1717
case Shapes;
1818

1919
/**
20-
* Enables callable types such as `name(X, Y): T`.
20+
* Enables callable types such as `name(U, V): T`.
2121
*/
2222
case Callables;
2323

@@ -27,17 +27,17 @@ enum GrammarFeature
2727
case Literals;
2828

2929
/**
30-
* Enables template arguments such as `T<X, Y>`.
30+
* Enables template arguments such as `T<U, V>`.
3131
*/
3232
case Generics;
3333

3434
/**
35-
* Enables logical union types such as `T | X`.
35+
* Enables logical union types such as `T | U`.
3636
*/
3737
case Union;
3838

3939
/**
40-
* Enables logical intersection types such as `T & X`.
40+
* Enables logical intersection types such as `T & U`.
4141
*/
4242
case Intersection;
4343

@@ -46,6 +46,11 @@ enum GrammarFeature
4646
*/
4747
case List;
4848

49+
/**
50+
* Enables offset types such as `T[U]`.
51+
*/
52+
case Offsets;
53+
4954
/**
5055
* Enables or disables support for template argument
5156
* hints such as `T<out U, in V>`.

src/Runtime/Parser/TypeParser.php

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public static function createFromPlatform(PlatformInterface $platform): self
3333
union: $platform->isFeatureSupported(GrammarFeature::Union),
3434
intersection: $platform->isFeatureSupported(GrammarFeature::Intersection),
3535
list: $platform->isFeatureSupported(GrammarFeature::List),
36+
offsets: $platform->isFeatureSupported(GrammarFeature::Offsets),
3637
hints: $platform->isFeatureSupported(GrammarFeature::Hints),
3738
attributes: $platform->isFeatureSupported(GrammarFeature::Attributes),
3839
));

0 commit comments

Comments
 (0)