From 7d413c8f2c50ac9275b4a85e780b75494b2beca0 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Mon, 24 Jun 2024 00:39:00 +0200 Subject: [PATCH] [BUGFIX] Fix undefined local variable in `CalcFunction::parse()` (#617) This is the 8.x backport of #593. Fixes #585 --- CHANGELOG.md | 2 ++ config/phpstan-baseline.neon | 5 ----- src/Value/CalcFunction.php | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf362493..8e587109 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Fixed +- Fix undefined local variable in `CalcFunction::parse()` (#593) + ## 8.5.1 ### Fixed diff --git a/config/phpstan-baseline.neon b/config/phpstan-baseline.neon index 243e36c4..82fcb3f4 100644 --- a/config/phpstan-baseline.neon +++ b/config/phpstan-baseline.neon @@ -10,8 +10,3 @@ parameters: count: 2 path: ../src/RuleSet/DeclarationBlock.php - - - message: "#^Variable \\$oVal might not be defined\\.$#" - count: 1 - path: ../src/Value/CalcFunction.php - diff --git a/src/Value/CalcFunction.php b/src/Value/CalcFunction.php index c8791d98..a3db2710 100644 --- a/src/Value/CalcFunction.php +++ b/src/Value/CalcFunction.php @@ -91,7 +91,7 @@ public static function parse(ParserState $oParserState, $bIgnoreCase = false) sprintf( 'Next token was expected to be an operand of type %s. Instead "%s" was found.', implode(', ', $aOperators), - $oVal + $oParserState->peek() ), '', 'custom',