Skip to content

Commit d74205c

Browse files
authored
Merge pull request #34 from staabm/const-arr
Tokenizer: Use const array
2 parents c711d50 + dcc7325 commit d74205c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Tokenizer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Tokenizer {
88
*
99
* @var array
1010
*/
11-
private $map = [
11+
private const MAP = [
1212
'(' => 'T_OPEN_BRACKET',
1313
')' => 'T_CLOSE_BRACKET',
1414
'[' => 'T_OPEN_SQUARE',
@@ -58,7 +58,7 @@ public function parse(string $source): TokenCollection {
5858
if (\is_string($tok)) {
5959
$token = new Token(
6060
$lastToken->getLine(),
61-
$this->map[$tok],
61+
self::MAP[$tok],
6262
$tok
6363
);
6464
$result->addToken($token);
@@ -146,4 +146,4 @@ private function fillBlanks(TokenCollection $tokens, int $maxLine): TokenCollect
146146

147147
return $final;
148148
}
149-
}
149+
}

0 commit comments

Comments
 (0)