From 81adf6af0a1029541a2453bc0fbc4a2ad53c5ced Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Fri, 18 Aug 2023 13:13:48 +0300 Subject: [PATCH] Making PHPStan happy --- json.inc.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/json.inc.php b/json.inc.php index eaa7dde..f17e4be 100644 --- a/json.inc.php +++ b/json.inc.php @@ -105,7 +105,7 @@ class JsonParser /** * @param string $input JSON string - * @return null|ParsingException null if no error is found, a ParsingException containing all details otherwise + * @return null|JsonParsingException null if no error is found, a ParsingException containing all details otherwise */ public function lint($input) { @@ -114,12 +114,13 @@ class JsonParser } catch (JsonParsingException $e) { return $e; } + return null; } /** * @param string $input JSON string * @return mixed - * @throws ParsingException + * @throws JsonParsingException */ public function parse($input, $flags = 0) { @@ -289,7 +290,7 @@ class JsonParser 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'], 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'], ); - $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack); + $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack); if (!$r instanceof JsonUndefined) { return $r; @@ -311,8 +312,6 @@ class JsonParser return true; } } - - return true; } protected function parseError($str, $hash) @@ -664,7 +663,6 @@ class JsonLexer break; case 1: return 6; - break; case 2: $this->yytext = substr($this->yytext, 1, $this->yyleng-2);