From 52fea74cc404baa30d5e4585c40a8c89e1dc950d Mon Sep 17 00:00:00 2001 From: Ivan Shalganov Date: Mon, 6 Jul 2020 11:31:44 +0300 Subject: [PATCH] `notice` appears when expression unexpectedly ends --- src/Fenom/Tokenizer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Fenom/Tokenizer.php b/src/Fenom/Tokenizer.php index 12e773a..6273e43 100644 --- a/src/Fenom/Tokenizer.php +++ b/src/Fenom/Tokenizer.php @@ -503,7 +503,7 @@ class Tokenizer public function skip( /*$token1, $token2, ...*/) { if (func_num_args()) { - if ($this->_valid(func_get_args(), $this->curr[0])) { + if ($this->curr && $this->_valid(func_get_args(), $this->curr[0])) { $this->next(); return $this; } else { @@ -538,7 +538,7 @@ class Tokenizer */ public function need($token1 /*, $token2, ...*/) { - if ($this->_valid(func_get_args(), $this->curr[0])) { + if ($this->curr && $this->_valid(func_get_args(), $this->curr[0])) { return $this; } else { throw new UnexpectedTokenException($this, func_get_args());