Skip to content

Commit 2c7df21

Browse files
committed
ConstExprParser is required in TypeParser
1 parent e141cce commit 2c7df21

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

Diff for: src/Parser/TypeParser.php

+2-13
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class TypeParser
1616
{
1717

18-
/** @var ConstExprParser|null */
18+
/** @var ConstExprParser */
1919
private $constExprParser;
2020

2121
/** @var bool */
@@ -28,7 +28,7 @@ class TypeParser
2828
* @param array{lines?: bool, indexes?: bool} $usedAttributes
2929
*/
3030
public function __construct(
31-
?ConstExprParser $constExprParser = null,
31+
ConstExprParser $constExprParser,
3232
array $usedAttributes = []
3333
)
3434
{
@@ -202,17 +202,6 @@ private function parseAtomic(TokenIterator $tokens): Ast\Type\TypeNode
202202
$currentTokenOffset = $tokens->currentTokenOffset();
203203
$currentTokenLine = $tokens->currentTokenLine();
204204

205-
if ($this->constExprParser === null) {
206-
throw new ParserException(
207-
$currentTokenValue,
208-
$currentTokenType,
209-
$currentTokenOffset,
210-
Lexer::TOKEN_IDENTIFIER,
211-
null,
212-
$currentTokenLine
213-
);
214-
}
215-
216205
try {
217206
$constExpr = $this->constExprParser->parse($tokens);
218207
if ($constExpr instanceof Ast\ConstExpr\ConstExprArrayNode) {

0 commit comments

Comments
 (0)