Skip to content

Commit 6e08ea5

Browse files
authored
Add support "&"
1 parent d6b5291 commit 6e08ea5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/TypeResolver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function resolve(string $type, ?Context $context = null) : Type
133133

134134
// split the type string into tokens `|`, `?`, `<`, `>`, `,`, `(`, `)[]`, '<', '>' and type names
135135
$tokens = preg_split(
136-
'/(\\||\\?|<|>|, ?|\\(|\\)(?:\\[\\])+)/',
136+
'/(\\||\\?|<|>|&|, ?|\\(|\\)(?:\\[\\])+)/',
137137
$type,
138138
-1,
139139
PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
@@ -162,7 +162,7 @@ private function parseTypes(ArrayIterator $tokens, Context $context, int $parser
162162
while ($tokens->valid()) {
163163
$token = $tokens->current();
164164

165-
if ($token === '|') {
165+
if ($token === '|' || $token === '&') {
166166
if (count($types) === 0) {
167167
throw new RuntimeException(
168168
'A type is missing before a type separator'
@@ -250,7 +250,7 @@ private function parseTypes(ArrayIterator $tokens, Context $context, int $parser
250250
}
251251
}
252252

253-
if ($token === '|') {
253+
if ($token === '|' || $token === '&') {
254254
throw new RuntimeException(
255255
'A type is missing after a type separator'
256256
);

0 commit comments

Comments
 (0)