Skip to content

Commit d658c37

Browse files
PHP 8.4 support (#84)
* Mark parameters explicit nullable * Test on PHP 8.4 * Update composer.json * Update CHANGELOG.md --------- Co-authored-by: Graham Campbell <[email protected]>
1 parent b243cac commit d658c37

File tree

7 files changed

+16
-12
lines changed

7 files changed

+16
-12
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
strategy:
1313
matrix:
14-
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
14+
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
1515

1616
steps:
1717
- name: Checkout Code
@@ -43,7 +43,7 @@ jobs:
4343

4444
strategy:
4545
matrix:
46-
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
46+
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
4747

4848
steps:
4949
- name: Configure Git

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# CHANGELOG
22

3+
## 2.8.0 - UPCOMING
4+
5+
* Add support for PHP 8.4.
6+
37
## 2.7.0 - 2023-08-15
48

5-
* Fixed flattening in arrays starting with null
9+
* Fixed flattening in arrays starting with null.
610
* Drop support for HHVM and PHP earlier than 7.2.5.
711
* Add support for PHP 8.1, 8.2, and 8.3.
812

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"bin": ["bin/jp.php"],
3333
"extra": {
3434
"branch-alias": {
35-
"dev-master": "2.7-dev"
35+
"dev-master": "2.8-dev"
3636
}
3737
}
3838
}

src/AstRuntime.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class AstRuntime
1212
private $cachedCount = 0;
1313

1414
public function __construct(
15-
Parser $parser = null,
16-
callable $fnDispatcher = null
15+
?Parser $parser = null,
16+
?callable $fnDispatcher = null
1717
) {
1818
$fnDispatcher = $fnDispatcher ?: FnDispatcher::getInstance();
1919
$this->interpreter = new TreeInterpreter($fnDispatcher);

src/CompilerRuntime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class CompilerRuntime
2323
* @param Parser|null $parser JMESPath parser to utilize
2424
* @throws \RuntimeException if the cache directory cannot be created
2525
*/
26-
public function __construct($dir = null, Parser $parser = null)
26+
public function __construct($dir = null, ?Parser $parser = null)
2727
{
2828
$this->parser = $parser ?: new Parser();
2929
$this->compiler = new TreeCompiler();

src/Parser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class Parser
5757
/**
5858
* @param Lexer|null $lexer Lexer used to tokenize expressions
5959
*/
60-
public function __construct(Lexer $lexer = null)
60+
public function __construct(?Lexer $lexer = null)
6161
{
6262
$this->lexer = $lexer ?: new Lexer();
6363
}
@@ -366,7 +366,7 @@ private function parseKeyValuePair()
366366
];
367367
}
368368

369-
private function parseWildcardObject(array $left = null)
369+
private function parseWildcardObject(?array $left = null)
370370
{
371371
$this->next();
372372

@@ -380,7 +380,7 @@ private function parseWildcardObject(array $left = null)
380380
];
381381
}
382382

383-
private function parseWildcardArray(array $left = null)
383+
private function parseWildcardArray(?array $left = null)
384384
{
385385
static $getRbracket = [T::T_RBRACKET => true];
386386
$this->next($getRbracket);
@@ -473,7 +473,7 @@ private function lookahead()
473473
: $this->tokens[$this->tpos + 1]['type'];
474474
}
475475

476-
private function next(array $match = null)
476+
private function next(?array $match = null)
477477
{
478478
if (!isset($this->tokens[$this->tpos + 1])) {
479479
$this->token = self::$nullToken;

src/TreeInterpreter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TreeInterpreter
1414
* a function name argument and an array of
1515
* function arguments and returns the result.
1616
*/
17-
public function __construct(callable $fnDispatcher = null)
17+
public function __construct(?callable $fnDispatcher = null)
1818
{
1919
$this->fnDispatcher = $fnDispatcher ?: FnDispatcher::getInstance();
2020
}

0 commit comments

Comments
 (0)