diff --git a/CHANGELOG.md b/CHANGELOG.md index a85455b..b45831f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ CHANGELOG ========= +8.0 +--- + + * Remove support for passing `null` as the allowed variable names to `ExpressionLanguage::lint()` and `Parser::lint()`, + pass the `IGNORE_UNKNOWN_VARIABLES` flag instead to ignore unknown variables during linting + + ```diff + -$expressionLanguage->lint($expression, null); + +$expressionLanguage->lint($expression, [], ExpressionLanguage::IGNORE_UNKNOWN_VARIABLES); + ``` + 7.2 --- diff --git a/ExpressionLanguage.php b/ExpressionLanguage.php index 379d386..b9179a7 100644 --- a/ExpressionLanguage.php +++ b/ExpressionLanguage.php @@ -93,20 +93,13 @@ public function parse(Expression|string $expression, array $names, int $flags = /** * Validates the syntax of an expression. * - * @param array|null $names The list of acceptable variable names in the expression + * @param array $names The list of acceptable variable names in the expression * @param int-mask-of $flags * * @throws SyntaxError When the passed expression is invalid */ - public function lint(Expression|string $expression, ?array $names, int $flags = 0): void + public function lint(Expression|string $expression, array $names, int $flags = 0): void { - if (null === $names) { - trigger_deprecation('symfony/expression-language', '7.1', 'Passing "null" as the second argument of "%s()" is deprecated, pass "%s\Parser::IGNORE_UNKNOWN_VARIABLES" instead as a third argument.', __METHOD__, __NAMESPACE__); - - $flags |= Parser::IGNORE_UNKNOWN_VARIABLES; - $names = []; - } - if ($expression instanceof ParsedExpression) { return; } @@ -145,10 +138,7 @@ public function registerProvider(ExpressionFunctionProviderInterface $provider): } } - /** - * @return void - */ - protected function registerFunctions() + protected function registerFunctions(): void { $basicPhpFunctions = ['constant', 'min', 'max']; foreach ($basicPhpFunctions as $function) { diff --git a/Parser.php b/Parser.php index 32254cd..91b6019 100644 --- a/Parser.php +++ b/Parser.php @@ -113,15 +113,8 @@ public function parse(TokenStream $stream, array $names = [], int $flags = 0): N * * @throws SyntaxError When the passed expression is invalid */ - public function lint(TokenStream $stream, ?array $names = [], int $flags = 0): void + public function lint(TokenStream $stream, array $names = [], int $flags = 0): void { - if (null === $names) { - trigger_deprecation('symfony/expression-language', '7.1', 'Passing "null" as the second argument of "%s()" is deprecated, pass "%s::IGNORE_UNKNOWN_VARIABLES" instead as a third argument.', __METHOD__, __CLASS__); - - $flags |= self::IGNORE_UNKNOWN_VARIABLES; - $names = []; - } - $this->doParse($stream, $names, $flags); } diff --git a/Tests/ParserTest.php b/Tests/ParserTest.php index 0f1c893..8677c03 100644 --- a/Tests/ParserTest.php +++ b/Tests/ParserTest.php @@ -326,7 +326,7 @@ public function testLint($expression, $names, int $checks = 0, ?string $exceptio $parser = new Parser([]); $parser->lint($lexer->tokenize($expression), $names, $checks); - // Parser does't return anything when the correct expression is passed + // Parser doesn't return anything when the correct expression is passed $this->expectNotToPerformAssertions(); } diff --git a/composer.json b/composer.json index e24a315..c468cfc 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,8 @@ } ], "require": { - "php": ">=8.2", - "symfony/cache": "^6.4|^7.0", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.4", + "symfony/cache": "^7.4|^8.0", "symfony/service-contracts": "^2.5|^3" }, "autoload": { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy