diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml
index dafc1eb..7ed083c 100644
--- a/.github/workflows/Test.yml
+++ b/.github/workflows/Test.yml
@@ -19,15 +19,16 @@ jobs:
strategy:
matrix:
php:
- - '8.0'
- '8.1'
- '8.2'
- continue-on-error: ${{ matrix.php == '8.2' }}
+ - '8.3'
+ - '8.4'
+ continue-on-error: ${{ matrix.php == '8.4' }}
name: PHP ${{ matrix.php }} Test
steps:
- name: Git checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -55,7 +56,7 @@ jobs:
run: phpcs -- -v
- name: Execute tests
- run: composer test -- -v --coverage-clover=coverage.xml
+ run: composer test -- --coverage-clover=coverage.xml
- name: Run codecov
- uses: codecov/codecov-action@v3
+ uses: codecov/codecov-action@v4
diff --git a/.github/workflows/UpdateContributors.yml b/.github/workflows/UpdateContributors.yml
index 3a2abfb..2d38106 100644
--- a/.github/workflows/UpdateContributors.yml
+++ b/.github/workflows/UpdateContributors.yml
@@ -8,7 +8,7 @@ jobs:
steps:
- name: Git checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Update Contributors
uses: BobAnkh/add-contributors@master
diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml
index 5ef041c..1752599 100644
--- a/.github/workflows/codestyle.yml
+++ b/.github/workflows/codestyle.yml
@@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
index 77c3ad2..f53c77a 100644
--- a/.php-cs-fixer.dist.php
+++ b/.php-cs-fixer.dist.php
@@ -1,7 +1,6 @@
exclude('*/vendor/*')
- ->exclude('node_modules')
->in(__DIR__);
return (new PhpCsFixer\Config())
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 068a4b0..e9a128d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+### 0.9.0
+🔻 Breaking changes ahead:
+
+- Dropped support for PHP < 8.1
+
+### 0.8.3
+- Change `getData()` so that it can be mixed instead of array
+
### 0.8.2
- AccessHelper & RecursiveFilter now return a plain `object`, rather than an `ArrayAccess` object
diff --git a/README.md b/README.md
index 25d65f1..d71e889 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# JSONPath for PHP 8.0+
+# JSONPath for PHP 8.1+
[](https://github.com/SoftCreatR/JSONPath/actions/workflows/Test.yml) [](https://packagist.org/packages/softcreatr/jsonpath)
[](./LICENSE) [](https://ecologi.com/softcreatr?r=61212ab3fc69b8eb8a2014f4)
@@ -19,7 +19,7 @@ This project aims to be a clean and simple implementation with the following goa
## Installation
```bash
-composer require softcreatr/jsonpath:"^0.5 || ^0.7 || ^0.8"
+composer require softcreatr/jsonpath:"^0.9"
```
## JSONPath Examples
diff --git a/composer.json b/composer.json
index 4662452..0ac0f93 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"name": "softcreatr/jsonpath",
"description": "JSONPath implementation for parsing, searching and flattening arrays",
"license": "MIT",
- "version": "0.8.3",
+ "version": "0.9.0",
"authors": [
{
"name": "Stephen Frank",
@@ -24,11 +24,11 @@
"source": "https://github.com/SoftCreatR/JSONPath"
},
"require": {
- "php": ">=8.0",
+ "php": "8.1 - 8.4",
"ext-json": "*"
},
"require-dev": {
- "phpunit/phpunit": "^9.6",
+ "phpunit/phpunit": "10 - 12",
"roave/security-advisories": "dev-latest"
},
"replace": {
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 89a74c9..18987b7 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -4,14 +4,15 @@
bootstrap="vendor/autoload.php"
colors="true"
>
-
-
- ./src/
-
-
-
-
- ./tests
-
-
+
+
+ ./tests
+
+
+
+
+
+ ./src/
+
+
diff --git a/src/JSONPathException.php b/src/JSONPathException.php
index 834a906..71fb09c 100644
--- a/src/JSONPathException.php
+++ b/src/JSONPathException.php
@@ -12,4 +12,5 @@
class JSONPathException extends Exception
{
+ // does nothing
}
diff --git a/tests/JSONPathDashedIndexTest.php b/tests/JSONPathDashedIndexTest.php
index 5e160a7..c98cc31 100644
--- a/tests/JSONPathDashedIndexTest.php
+++ b/tests/JSONPathDashedIndexTest.php
@@ -12,6 +12,7 @@
use Flow\JSONPath\JSONPath;
use Flow\JSONPath\JSONPathException;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class JSONPathDashedIndexTest extends TestCase
@@ -19,7 +20,7 @@ class JSONPathDashedIndexTest extends TestCase
/**
* @return array[]
*/
- public function indexDataProvider(): array
+ public static function indexDataProvider(): array
{
return [
[
@@ -36,10 +37,9 @@ public function indexDataProvider(): array
}
/**
- * @dataProvider indexDataProvider
- *
* @throws JSONPathException
*/
+ #[DataProvider('indexDataProvider')]
public function testSlice(string $path, array $data, array $expected): void
{
$results = (new JSONPath($data))
diff --git a/tests/JSONPathSliceAccessTest.php b/tests/JSONPathSliceAccessTest.php
index 257a852..9977ca8 100644
--- a/tests/JSONPathSliceAccessTest.php
+++ b/tests/JSONPathSliceAccessTest.php
@@ -12,11 +12,12 @@
use Flow\JSONPath\JSONPath;
use Flow\JSONPath\JSONPathException;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
class JSONPathSliceAccessTest extends TestCase
{
- public function sliceDataProvider(): array
+ public static function sliceDataProvider(): array
{
return [
[
@@ -78,10 +79,9 @@ public function sliceDataProvider(): array
}
/**
- * @dataProvider sliceDataProvider
- *
* @throws JSONPathException
*/
+ #[DataProvider('sliceDataProvider')]
public function testSlice(string $path, array $data, array $expected): void
{
$result = (new JSONPath($data))
diff --git a/tests/QueryTest.php b/tests/QueryTest.php
index a2073c9..9c70b83 100644
--- a/tests/QueryTest.php
+++ b/tests/QueryTest.php
@@ -12,6 +12,7 @@
use Flow\JSONPath\JSONPath;
use Flow\JSONPath\JSONPathException;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framework\TestCase;
use RuntimeException;
@@ -28,10 +29,10 @@ class QueryTest extends TestCase
* a message will be printed to STDERR, so we know, what's going on.
*
* @see https://cburgmer.github.io/json-path-comparison
- * @dataProvider queryDataProvider
*
* @noinspection JsonEncodingApiUsageInspection
*/
+ #[DataProvider('queryDataProvider')]
public function testQueries(
string $id,
string $selector,
@@ -109,7 +110,7 @@ public function testQueries(
*
* @return string[]
*/
- public function queryDataProvider(): array
+ public static function queryDataProvider(): array
{
return [
[ // data set #0