Skip to content

Commit f3734e2

Browse files
Adjust supported PHP version
1 parent 9b87907 commit f3734e2

18 files changed

+122
-221
lines changed

.github/bin/composer.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/bin/hhvm.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 10 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ on:
77
jobs:
88
tests_linux:
99
name: PHP ${{ matrix.php }} Linux
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
1111

1212
strategy:
1313
matrix:
14-
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
14+
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
1515

1616
steps:
1717
- name: Checkout Code
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v3
1919

2020
- name: Setup PHP
2121
uses: shivammathur/setup-php@v2
@@ -27,32 +27,23 @@ jobs:
2727
- name: Setup Problem Matchers
2828
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
2929

30-
- name: Install PHP 5/7 Dependencies
31-
uses: nick-invision/retry@v1
30+
- name: Install PHP Dependencies
31+
uses: nick-invision/retry@v2
3232
with:
3333
timeout_minutes: 5
3434
max_attempts: 5
3535
command: composer update --no-interaction --no-progress
36-
if: "matrix.php < 8"
37-
38-
- name: Install PHP 8 Dependencies
39-
uses: nick-invision/retry@v1
40-
with:
41-
timeout_minutes: 5
42-
max_attempts: 5
43-
command: composer update --no-interaction --no-progress --ignore-platform-req=php
44-
if: "matrix.php >= 8"
4536

4637
- name: Execute PHPUnit
4738
run: vendor/bin/phpunit
4839

4940
tests_windows:
5041
name: PHP ${{ matrix.php }} Windows
51-
runs-on: windows-2019
42+
runs-on: windows-2022
5243

5344
strategy:
5445
matrix:
55-
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
46+
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
5647

5748
steps:
5849
- name: Configure Git
@@ -61,7 +52,7 @@ jobs:
6152
git config --global core.eol lf
6253
6354
- name: Checkout Code
64-
uses: actions/checkout@v2
55+
uses: actions/checkout@v3
6556

6657
- name: Setup PHP
6758
uses: shivammathur/setup-php@v2
@@ -73,51 +64,12 @@ jobs:
7364
- name: Setup Problem Matchers
7465
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
7566

76-
- name: Install PHP 5/7 Dependencies
77-
uses: nick-invision/retry@v1
67+
- name: Install PHP Dependencies
68+
uses: nick-invision/retry@v2
7869
with:
7970
timeout_minutes: 5
8071
max_attempts: 5
8172
command: composer update --no-interaction --no-progress
82-
if: "matrix.php < 8"
83-
84-
- name: Install PHP 8 Dependencies
85-
uses: nick-invision/retry@v1
86-
with:
87-
timeout_minutes: 5
88-
max_attempts: 5
89-
command: composer update --no-interaction --no-progress --ignore-platform-req=php
90-
if: "matrix.php >= 8"
9173

9274
- name: Execute PHPUnit
9375
run: vendor\bin\phpunit.bat
94-
95-
test_hhvm:
96-
name: HHVM ${{ matrix.hhvm }}
97-
runs-on: ubuntu-16.04
98-
99-
strategy:
100-
matrix:
101-
hhvm: ["3.15", "3.18", "3.21", "3.24"]
102-
103-
steps:
104-
- name: Checkout Code
105-
uses: actions/checkout@v2
106-
107-
- name: Install HHVM
108-
shell: bash
109-
run: sudo .github/bin/hhvm.sh ${{ matrix.hhvm }}
110-
111-
- name: Install Composer
112-
shell: bash
113-
run: sudo .github/bin/composer.sh
114-
115-
- name: Install Dependencies
116-
uses: nick-invision/retry@v1
117-
with:
118-
timeout_minutes: 5
119-
max_attempts: 5
120-
command: composer update --no-interaction --no-progress
121-
122-
- name: Execute PHPUnit
123-
run: hhvm vendor/bin/phpunit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.phpunit.result.cache
12
vendor
23
composer.lock
34
phpunit.xml

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## 2.7.0 - UPCOMING
4+
5+
* Drop support for HHVM and PHP earlier than 7.2.5.
6+
* Add support for PHP 8.1, 8.2, and 8.3.
7+
38
## 2.6.0 - 2020-07-31
49

510
* Support for PHP 8.0.

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jmespath.php
44

55
JMESPath (pronounced "jaymz path") allows you to declaratively specify how to
66
extract elements from a JSON document. *jmespath.php* allows you to use
7-
JMESPath in PHP applications with PHP data structures. It requires PHP 5.4 or
7+
JMESPath in PHP applications with PHP data structures. It requires PHP 7.2.5 or
88
greater and can be installed through `Composer <http://getcomposer.org/doc/00-intro.md>`_
99
using the ``mtdowling/jmespath.php`` package.
1010

composer.json

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,38 @@
11
{
2-
"name": "mtdowling/jmespath.php",
3-
"description": "Declaratively specify how to extract elements from a JSON document",
4-
"keywords": ["json", "jsonpath"],
5-
"license": "MIT",
6-
7-
"authors": [
8-
{
9-
"name": "Michael Dowling",
10-
"email": "[email protected]",
11-
"homepage": "https://github.com/mtdowling"
12-
}
13-
],
14-
15-
"require": {
16-
"php": "^5.4 || ^7.0 || ^8.0",
17-
"symfony/polyfill-mbstring": "^1.17"
18-
},
19-
20-
"require-dev": {
21-
"composer/xdebug-handler": "^1.4 || ^2.0",
22-
"phpunit/phpunit": "^4.8.36 || ^7.5.15"
23-
},
24-
25-
"autoload": {
26-
"psr-4": {
27-
"JmesPath\\": "src/"
2+
"name": "mtdowling/jmespath.php",
3+
"description": "Declaratively specify how to extract elements from a JSON document",
4+
"keywords": ["json", "jsonpath"],
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Graham Campbell",
9+
"email": "[email protected]",
10+
"homepage": "https://github.com/GrahamCampbell"
11+
},
12+
{
13+
"name": "Michael Dowling",
14+
"email": "[email protected]",
15+
"homepage": "https://github.com/mtdowling"
16+
}
17+
],
18+
"require": {
19+
"php": "^7.2.5 || ^8.0",
20+
"symfony/polyfill-mbstring": "^1.17"
21+
},
22+
"require-dev": {
23+
"composer/xdebug-handler": "^3.0.3",
24+
"phpunit/phpunit": "^8.5.33"
25+
},
26+
"autoload": {
27+
"psr-4": {
28+
"JmesPath\\": "src/"
29+
},
30+
"files": ["src/JmesPath.php"]
2831
},
29-
"files": ["src/JmesPath.php"]
30-
},
31-
32-
"bin": ["bin/jp.php"],
33-
34-
"extra": {
35-
"branch-alias": {
36-
"dev-master": "2.6-dev"
32+
"bin": ["bin/jp.php"],
33+
"extra": {
34+
"branch-alias": {
35+
"dev-master": "2.7-dev"
36+
}
3737
}
38-
}
3938
}

phpunit.xml.dist

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="./vendor/autoload.php"
3-
colors="true">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
colors="true"
5+
failOnRisky="true"
6+
failOnWarning="true"
7+
convertDeprecationsToExceptions="true"
8+
>
49

510
<testsuites>
611
<testsuite name="Unit Tests">

src/SyntaxErrorException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function __construct(
1616
array $token,
1717
$expression
1818
) {
19-
$message = "Syntax error at character {$token['pos']}\n"
19+
$message = sprintf("Syntax error at character %d\n", max($token['pos'], 0))
2020
. $expression . "\n" . str_repeat(' ', max($token['pos'], 0)) . "^\n";
2121
$message .= !is_array($expectedTypesOrMessage)
2222
? $expectedTypesOrMessage

tests/ComplianceTest.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ class ComplianceTest extends TestCase
1010
{
1111
private static $path;
1212

13-
public static function setUpBeforeClass()
13+
public static function setUpBeforeClass(): void
1414
{
1515
self::$path = __DIR__ . '/../../compiled';
1616
array_map('unlink', glob(self::$path . '/jmespath_*.php'));
1717
}
1818

19-
public static function tearDownAfterClass()
19+
public static function tearDownAfterClass(): void
2020
{
2121
array_map('unlink', glob(self::$path . '/jmespath_*.php'));
2222
}
@@ -34,7 +34,7 @@ public function testPassesCompliance(
3434
$case,
3535
$compiled,
3636
$asAssoc
37-
) {
37+
): void {
3838
$evalResult = null;
3939
$failed = false;
4040
$failureMsg = '';
@@ -61,8 +61,8 @@ public function testPassesCompliance(
6161

6262
$file = __DIR__ . '/compliance/' . $file . '.json';
6363
$failure .= "\n{$compiledStr}php bin/jp.php --file {$file} --suite {$suite} --case {$case}\n\n"
64-
. "Result: " . $this->prettyJson($evalResult) . "\n\n"
65-
. "Expected: " . $this->prettyJson($result) . "\n\n";
64+
. "Result: " . json_encode($evalResult, JSON_PRETTY_PRINT) . "\n\n"
65+
. "Expected: " . json_encode($result, JSON_PRETTY_PRINT) . "\n\n";
6666
$failure .= 'Associative? ' . var_export($asAssoc, true) . "\n\n";
6767

6868
if (!$error && $failed) {
@@ -78,7 +78,7 @@ public function testPassesCompliance(
7878
);
7979
}
8080

81-
public function complianceProvider()
81+
public static function complianceProvider(): array
8282
{
8383
$cases = [];
8484

@@ -126,13 +126,4 @@ private function convertAssoc($data)
126126
return $data;
127127
}
128128
}
129-
130-
private function prettyJson($json)
131-
{
132-
if (defined('JSON_PRETTY_PRINT')) {
133-
return json_encode($json, JSON_PRETTY_PRINT);
134-
}
135-
136-
return json_encode($json);
137-
}
138129
}

0 commit comments

Comments
 (0)