From 6c835a9be7839d80381d48d1ad0fd687321daf24 Mon Sep 17 00:00:00 2001 From: Julius Kiekbusch Date: Wed, 4 Sep 2024 20:23:43 +0200 Subject: [PATCH 1/4] Mark parameters explicit nullable --- src/AstRuntime.php | 4 ++-- src/CompilerRuntime.php | 2 +- src/Parser.php | 8 ++++---- src/TreeInterpreter.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/AstRuntime.php b/src/AstRuntime.php index 03f5f1a..f5620be 100644 --- a/src/AstRuntime.php +++ b/src/AstRuntime.php @@ -12,8 +12,8 @@ class AstRuntime private $cachedCount = 0; public function __construct( - Parser $parser = null, - callable $fnDispatcher = null + ?Parser $parser = null, + ?callable $fnDispatcher = null ) { $fnDispatcher = $fnDispatcher ?: FnDispatcher::getInstance(); $this->interpreter = new TreeInterpreter($fnDispatcher); diff --git a/src/CompilerRuntime.php b/src/CompilerRuntime.php index c26b09c..b85f68e 100644 --- a/src/CompilerRuntime.php +++ b/src/CompilerRuntime.php @@ -23,7 +23,7 @@ class CompilerRuntime * @param Parser|null $parser JMESPath parser to utilize * @throws \RuntimeException if the cache directory cannot be created */ - public function __construct($dir = null, Parser $parser = null) + public function __construct($dir = null, ?Parser $parser = null) { $this->parser = $parser ?: new Parser(); $this->compiler = new TreeCompiler(); diff --git a/src/Parser.php b/src/Parser.php index 0733f20..d126de5 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -57,7 +57,7 @@ class Parser /** * @param Lexer|null $lexer Lexer used to tokenize expressions */ - public function __construct(Lexer $lexer = null) + public function __construct(?Lexer $lexer = null) { $this->lexer = $lexer ?: new Lexer(); } @@ -366,7 +366,7 @@ private function parseKeyValuePair() ]; } - private function parseWildcardObject(array $left = null) + private function parseWildcardObject(?array $left = null) { $this->next(); @@ -380,7 +380,7 @@ private function parseWildcardObject(array $left = null) ]; } - private function parseWildcardArray(array $left = null) + private function parseWildcardArray(?array $left = null) { static $getRbracket = [T::T_RBRACKET => true]; $this->next($getRbracket); @@ -473,7 +473,7 @@ private function lookahead() : $this->tokens[$this->tpos + 1]['type']; } - private function next(array $match = null) + private function next(?array $match = null) { if (!isset($this->tokens[$this->tpos + 1])) { $this->token = self::$nullToken; diff --git a/src/TreeInterpreter.php b/src/TreeInterpreter.php index f7eea86..f4a8aec 100644 --- a/src/TreeInterpreter.php +++ b/src/TreeInterpreter.php @@ -14,7 +14,7 @@ class TreeInterpreter * a function name argument and an array of * function arguments and returns the result. */ - public function __construct(callable $fnDispatcher = null) + public function __construct(?callable $fnDispatcher = null) { $this->fnDispatcher = $fnDispatcher ?: FnDispatcher::getInstance(); } From 9c7f268ad6bed90da0f834bfd227e96606cf9e29 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Wed, 4 Sep 2024 19:40:01 +0100 Subject: [PATCH 2/4] Test on PHP 8.4 --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8dce692..2b6b441 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: - php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] + php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout Code @@ -43,7 +43,7 @@ jobs: strategy: matrix: - php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] + php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] steps: - name: Configure Git From a11c0a900e46c3a166be1e7ff61bc7662fb0d09a Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Wed, 4 Sep 2024 19:42:15 +0100 Subject: [PATCH 3/4] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b4c37c1..819db12 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "bin": ["bin/jp.php"], "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "2.8-dev" } } } From c2ec19015da45dd0e350f9b2c406ec5570e5f87e Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Wed, 4 Sep 2024 19:42:50 +0100 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3a4048..8acb57c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,12 @@ # CHANGELOG +## 2.8.0 - UPCOMING + +* Add support for PHP 8.4. + ## 2.7.0 - 2023-08-15 -* Fixed flattening in arrays starting with null +* Fixed flattening in arrays starting with null. * Drop support for HHVM and PHP earlier than 7.2.5. * Add support for PHP 8.1, 8.2, and 8.3.