Skip to content

Commit 3be7c0a

Browse files
committed
[TASK] Drop unnecessary properties from UnexpectedTokenException
1 parent e725c2e commit 3be7c0a

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

src/Parsing/UnexpectedTokenException.php

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,20 @@
99
*/
1010
class UnexpectedTokenException extends SourceException
1111
{
12-
/**
13-
* @var string
14-
*/
15-
private $expected;
16-
17-
/**
18-
* @var string
19-
*/
20-
private $found;
21-
22-
/**
23-
* @var 'literal'|'identifier'|'count'|'expression'|'search'|'custom'
24-
*/
25-
private $matchType;
26-
2712
/**
2813
* @param 'literal'|'identifier'|'count'|'expression'|'search'|'custom' $matchType
2914
* @param int<0, max> $lineNumber
3015
*/
3116
public function __construct(string $expected, string $found, string $matchType = 'literal', int $lineNumber = 0)
3217
{
33-
$this->expected = $expected;
34-
$this->found = $found;
35-
$this->matchType = $matchType;
3618
$message = "Token “{$expected}” ({$matchType}) not found. Got “{$found}”.";
37-
if ($this->matchType === 'search') {
19+
if ($matchType === 'search') {
3820
$message = "Search for “{$expected}” returned no results. Context: “{$found}”.";
39-
} elseif ($this->matchType === 'count') {
21+
} elseif ($matchType === 'count') {
4022
$message = "Next token was expected to have {$expected} chars. Context: “{$found}”.";
41-
} elseif ($this->matchType === 'identifier') {
23+
} elseif ($matchType === 'identifier') {
4224
$message = "Identifier expected. Got “{$found}";
43-
} elseif ($this->matchType === 'custom') {
25+
} elseif ($matchType === 'custom') {
4426
$message = \trim("$expected $found");
4527
}
4628

0 commit comments

Comments
 (0)