diff --git a/src/Parser.php b/src/Parser.php index f09a210d6..5028fbf6a 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -595,12 +595,12 @@ public function parse() * Creates a new error log. * * @param string $msg the error message - * @param Token $token the token that produced the error + * @param Token|null $token the token that produced the error * @param int $code the code of the error * * @throws ParserException throws the exception, if strict mode is enabled */ - public function error($msg, Token $token = null, $code = 0) + public function error($msg, ?Token $token = null, $code = 0) { $error = new ParserException( Translator::gettext($msg), diff --git a/src/Statement.php b/src/Statement.php index 4b47ea5f8..b8a014f88 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -84,10 +84,10 @@ abstract class Statement /** * Constructor. * - * @param Parser $parser the instance that requests parsing - * @param TokensList $list the list of tokens to be parsed + * @param Parser|null $parser the instance that requests parsing + * @param TokensList|null $list the list of tokens to be parsed */ - public function __construct(Parser $parser = null, TokensList $list = null) + public function __construct(?Parser $parser = null, ?TokensList $list = null) { if (($parser !== null) && ($list !== null)) { $this->parse($parser, $list);