From ee81afe6e9c6ba92fd4848f0c36b7b05d387b657 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 2 Jun 2025 16:08:14 +0200 Subject: [PATCH 1/5] Allow Symfony ^8.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e24a315..e3989cd 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=8.2", - "symfony/cache": "^6.4|^7.0", + "symfony/cache": "^6.4|^7.0|^8.0", "symfony/deprecation-contracts": "^2.5|^3", "symfony/service-contracts": "^2.5|^3" }, From ea9f0de0566da5f78471bb781420770591b47bf1 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 2 Jun 2025 17:50:55 +0200 Subject: [PATCH 2/5] Bump Symfony 8 to PHP >= 8.4 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index e3989cd..e925da6 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,8 @@ } ], "require": { - "php": ">=8.2", - "symfony/cache": "^6.4|^7.0|^8.0", + "php": ">=8.4", + "symfony/cache": "^7.4|^8.0", "symfony/deprecation-contracts": "^2.5|^3", "symfony/service-contracts": "^2.5|^3" }, From 8889cca34364b0aa80100fc0437561cae6cfb233 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 4 Jun 2025 18:31:05 +0200 Subject: [PATCH 3/5] Enforce return types on all components --- ExpressionLanguage.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ExpressionLanguage.php b/ExpressionLanguage.php index 379d386..4899537 100644 --- a/ExpressionLanguage.php +++ b/ExpressionLanguage.php @@ -145,10 +145,7 @@ public function registerProvider(ExpressionFunctionProviderInterface $provider): } } - /** - * @return void - */ - protected function registerFunctions() + protected function registerFunctions(): void { $basicPhpFunctions = ['constant', 'min', 'max']; foreach ($basicPhpFunctions as $function) { From 6659bb5afcc3c4a72df58504ac5bc1dcd3a7d974 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 6 Jul 2025 15:40:49 +0200 Subject: [PATCH 4/5] forbid passing null as allowed variables --- CHANGELOG.md | 11 +++++++++++ ExpressionLanguage.php | 11 ++--------- Parser.php | 9 +-------- composer.json | 1 - 4 files changed, 14 insertions(+), 18 deletions(-) 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 4899537..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; } 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/composer.json b/composer.json index e925da6..c468cfc 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,6 @@ "require": { "php": ">=8.4", "symfony/cache": "^7.4|^8.0", - "symfony/deprecation-contracts": "^2.5|^3", "symfony/service-contracts": "^2.5|^3" }, "autoload": { From 96e8888c159f5f672cb39bff7c2463ab187bd9ee Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 24 Jul 2025 14:45:41 +0200 Subject: [PATCH 5/5] Fix typos --- Tests/ParserTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); } 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