From a0ff7a79af8c3bc5e9c5decee24cbefb5d80e93b Mon Sep 17 00:00:00 2001 From: Bruce Wells Date: Mon, 21 Mar 2022 12:52:25 -0400 Subject: Adding varExists method and support for undefined var handler in getVar (#96) * Added varExists method * getVar now respects VarNotFoundHandler setting * Use local version of PHP-CS-Fixer Instead of hard coded version from github actions * Fixing actions * Fixing actions * Dropping testing for 7.3, as it is no longer supported --- src/NXP/Classes/Tokenizer.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/NXP/Classes/Tokenizer.php') diff --git a/src/NXP/Classes/Tokenizer.php b/src/NXP/Classes/Tokenizer.php index 77014b8..087a78d 100644 --- a/src/NXP/Classes/Tokenizer.php +++ b/src/NXP/Classes/Tokenizer.php @@ -66,7 +66,7 @@ class Tokenizer $this->operators = $operators; } - public function tokenize() : self + public function tokenize(): self { foreach (str_split($this->input, 1) as $ch) { switch (true) { @@ -184,17 +184,17 @@ class Tokenizer return $this; } - private function isNumber(string $ch) : bool + private function isNumber(string $ch): bool { return $ch >= '0' && $ch <= '9'; } - private function isAlpha(string $ch) : bool + private function isAlpha(string $ch): bool { return $ch >= 'a' && $ch <= 'z' || $ch >= 'A' && $ch <= 'Z' || $ch == '_'; } - private function emptyNumberBufferAsLiteral() : void + private function emptyNumberBufferAsLiteral(): void { if (strlen($this->numberBuffer)) { $this->tokens[] = new Token(Token::Literal, $this->numberBuffer); @@ -202,22 +202,22 @@ class Tokenizer } } - private function isDot(string $ch) : bool + private function isDot(string $ch): bool { return $ch == '.'; } - private function isLP(string $ch) : bool + private function isLP(string $ch): bool { return $ch == '('; } - private function isRP(string $ch) : bool + private function isRP(string $ch): bool { return $ch == ')'; } - private function emptyStrBufferAsVariable() : void + private function emptyStrBufferAsVariable(): void { if ($this->stringBuffer != '') { $this->tokens[] = new Token(Token::Variable, $this->stringBuffer); @@ -225,7 +225,7 @@ class Tokenizer } } - private function isComma(string $ch) : bool + private function isComma(string $ch): bool { return $ch == ','; } @@ -235,7 +235,7 @@ class Tokenizer * @throws IncorrectBracketsException * @throws UnknownOperatorException */ - public function buildReversePolishNotation() : array + public function buildReversePolishNotation(): array { $tokens = []; /** @var SplStack $stack */ -- cgit v1.2.3