Skip to content

Commit

Permalink
feat: add support for strict-array type
Browse files Browse the repository at this point in the history
  • Loading branch information
danog authored Nov 8, 2022
1 parent 752ad9d commit d456ebe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Type/Parser/Lexer/NativeLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function tokenize(string $symbol): Token
case 'integer':
return IntegerToken::get();
case 'array':
case 'strict-array':
return ArrayToken::array();
case 'non-empty-array':
return ArrayToken::nonEmptyArray();
Expand Down
6 changes: 6 additions & 0 deletions tests/Functional/Type/Parser/Lexer/NativeLexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,12 @@ public function parse_valid_types_returns_valid_result_data_provider(): iterable
'type' => ShapedArrayType::class,
];

yield 'Strict shaped array' => [
'raw' => 'strict-array{foo: string}',
'transformed' => 'array{foo: string}',
'type' => ShapedArrayType::class,
];

yield 'Shaped array with single quote key' => [
'raw' => "array{'foo': string}",
'transformed' => "array{'foo': string}",
Expand Down

0 comments on commit d456ebe

Please sign in to comment.