aboutsummaryrefslogtreecommitdiff
path: root/src/NXP/Classes/Tokenizer.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/NXP/Classes/Tokenizer.php')
-rw-r--r--src/NXP/Classes/Tokenizer.php13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/NXP/Classes/Tokenizer.php b/src/NXP/Classes/Tokenizer.php
index a74bff6..656961a 100644
--- a/src/NXP/Classes/Tokenizer.php
+++ b/src/NXP/Classes/Tokenizer.php
@@ -23,17 +23,12 @@ class Tokenizer
/** @var array<Token> */
public array $tokens = [];
- private string $input = '';
-
private string $numberBuffer = '';
private string $stringBuffer = '';
private bool $allowNegative = true;
- /** @var array<Operator> */
- private array $operators = [];
-
private bool $inSingleQuotedString = false;
private bool $inDoubleQuotedString = false;
@@ -42,10 +37,8 @@ class Tokenizer
* Tokenizer constructor.
* @param Operator[] $operators
*/
- public function __construct(string $input, array $operators)
+ public function __construct(private string $input, private array $operators)
{
- $this->input = $input;
- $this->operators = $operators;
}
public function tokenize() : self
@@ -142,7 +135,7 @@ class Tokenizer
break;
/** @noinspection PhpMissingBreakStatementInspection */
case 'e' === \strtolower($ch):
- if (\strlen($this->numberBuffer) && false !== \strpos($this->numberBuffer, '.')) {
+ if (\strlen($this->numberBuffer) && \str_contains($this->numberBuffer, '.')) {
$this->numberBuffer .= 'e';
$this->allowNegative = false;
@@ -330,7 +323,7 @@ class Tokenizer
break;
}
$tokens[] = $ctoken;
- } catch (RuntimeException $e) {
+ } catch (RuntimeException) {
throw new IncorrectBracketsException();
}
}