From d59441c10a5a73cd9d4d778b8253595a16f6716d Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 Jan 2024 14:51:25 +0100 Subject: [PATCH] Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value --- ExpressionFunction.php | 2 +- ExpressionLanguage.php | 2 +- Node/ArrayNode.php | 2 +- SyntaxError.php | 2 +- Tests/ParserTest.php | 2 +- Token.php | 2 +- TokenStream.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ExpressionFunction.php b/ExpressionFunction.php index 2bc17b4..de841fd 100644 --- a/ExpressionFunction.php +++ b/ExpressionFunction.php @@ -81,7 +81,7 @@ public function getEvaluator() * @throws \InvalidArgumentException if given PHP function name is in namespace * and expression function name is not defined */ - public static function fromPhp(string $phpFunctionName, string $expressionFunctionName = null) + public static function fromPhp(string $phpFunctionName, ?string $expressionFunctionName = null) { $phpFunctionName = ltrim($phpFunctionName, '\\'); if (!\function_exists($phpFunctionName)) { diff --git a/ExpressionLanguage.php b/ExpressionLanguage.php index 001f49d..69ea781 100644 --- a/ExpressionLanguage.php +++ b/ExpressionLanguage.php @@ -34,7 +34,7 @@ class ExpressionLanguage /** * @param ExpressionFunctionProviderInterface[] $providers */ - public function __construct(CacheItemPoolInterface $cache = null, array $providers = []) + public function __construct(?CacheItemPoolInterface $cache = null, array $providers = []) { $this->cache = $cache ?? new ArrayAdapter(); $this->registerFunctions(); diff --git a/Node/ArrayNode.php b/Node/ArrayNode.php index a8d68f9..b347d20 100644 --- a/Node/ArrayNode.php +++ b/Node/ArrayNode.php @@ -27,7 +27,7 @@ public function __construct() $this->index = -1; } - public function addElement(Node $value, Node $key = null) + public function addElement(Node $value, ?Node $key = null) { if (null === $key) { $key = new ConstantNode(++$this->index); diff --git a/SyntaxError.php b/SyntaxError.php index 0bfd7e9..e165dc2 100644 --- a/SyntaxError.php +++ b/SyntaxError.php @@ -13,7 +13,7 @@ class SyntaxError extends \LogicException { - public function __construct(string $message, int $cursor = 0, string $expression = '', string $subject = null, array $proposals = null) + public function __construct(string $message, int $cursor = 0, string $expression = '', ?string $subject = null, ?array $proposals = null) { $message = sprintf('%s around position %d', rtrim($message, '.'), $cursor); if ($expression) { diff --git a/Tests/ParserTest.php b/Tests/ParserTest.php index d98091a..7c02289 100644 --- a/Tests/ParserTest.php +++ b/Tests/ParserTest.php @@ -243,7 +243,7 @@ public function testNameProposal() /** * @dataProvider getLintData */ - public function testLint($expression, $names, string $exception = null) + public function testLint($expression, $names, ?string $exception = null) { if ($exception) { $this->expectException(SyntaxError::class); diff --git a/Token.php b/Token.php index 3df869f..e2e1a5c 100644 --- a/Token.php +++ b/Token.php @@ -56,7 +56,7 @@ public function __toString() * * @return bool */ - public function test(string $type, string $value = null) + public function test(string $type, ?string $value = null) { return $this->type === $type && (null === $value || $this->value == $value); } diff --git a/TokenStream.php b/TokenStream.php index 130513b..8814e6c 100644 --- a/TokenStream.php +++ b/TokenStream.php @@ -58,7 +58,7 @@ public function next() /** * @param string|null $message The syntax error message */ - public function expect(string $type, string $value = null, string $message = null) + public function expect(string $type, ?string $value = null, ?string $message = null) { $token = $this->current; if (!$token->test($type, $value)) {