Skip to content

Commit

Permalink
0.9.0
Browse files Browse the repository at this point in the history
Signed-off-by: Sascha Greuel <[email protected]>
  • Loading branch information
SoftCreatR committed Mar 13, 2024
1 parent fc12dee commit 43bfb6a
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 31 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/UpdateContributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
$finder = PhpCsFixer\Finder::create()
->exclude('*/vendor/*')
->exclude('node_modules')
->in(__DIR__);

return (new PhpCsFixer\Config())
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# JSONPath for PHP 8.0+
# JSONPath for PHP 8.1+

[![Build](https://img.shields.io/github/actions/workflow/status/SoftCreatR/JSONPath/.github/workflows/Test.yml?branch=main)](https://github.com/SoftCreatR/JSONPath/actions/workflows/Test.yml) [![Latest Release](https://img.shields.io/packagist/v/SoftCreatR/JSONPath?color=blue&label=Latest%20Release)](https://packagist.org/packages/softcreatr/jsonpath)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) [![Plant Tree](https://img.shields.io/badge/dynamic/json?color=brightgreen&label=Plant%20Tree&query=%24.total&url=https%3A%2F%2Fpublic.offset.earth%2Fusers%2Fsoftcreatr%2Ftrees)](https://ecologi.com/softcreatr?r=61212ab3fc69b8eb8a2014f4)
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down
21 changes: 11 additions & 10 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
bootstrap="vendor/autoload.php"
colors="true"
>
<coverage>
<include>
<directory suffix=".php">./src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Unit">
<directory>./tests</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="Unit">
<directory>./tests</directory>
</testsuite>
</testsuites>

<source>
<include>
<directory>./src/</directory>
</include>
</source>
</phpunit>
1 change: 1 addition & 0 deletions src/JSONPathException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@

class JSONPathException extends Exception
{
// does nothing
}
6 changes: 3 additions & 3 deletions tests/JSONPathDashedIndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@

use Flow\JSONPath\JSONPath;
use Flow\JSONPath\JSONPathException;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

class JSONPathDashedIndexTest extends TestCase
{
/**
* @return array[]
*/
public function indexDataProvider(): array
public static function indexDataProvider(): array
{
return [
[
Expand All @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions tests/JSONPathSliceAccessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
[
Expand Down Expand Up @@ -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))
Expand Down
5 changes: 3 additions & 2 deletions tests/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -109,7 +110,7 @@ public function testQueries(
*
* @return string[]
*/
public function queryDataProvider(): array
public static function queryDataProvider(): array
{
return [
[ // data set #0
Expand Down

0 comments on commit 43bfb6a

Please sign in to comment.