Skip to content

Commit 3a6108a

Browse files
committed
0.8.2
Small updates - Updated workflows - Updated composer.json
1 parent 4840f17 commit 3a6108a

9 files changed

+213
-28
lines changed

.github/diff.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "diff",
5+
"pattern": [
6+
{
7+
"regexp": "--- a/(.*)",
8+
"file": 1,
9+
"message": 1
10+
}
11+
]
12+
}
13+
]
14+
}

.github/php-syntax.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "php -l",
5+
"pattern": [
6+
{
7+
"regexp": "^\\s*(PHP\\s+)?([a-zA-Z\\s]+):\\s+(.*)\\s+in\\s+(\\S+)\\s+on\\s+line\\s+(\\d+)$",
8+
"file": 4,
9+
"line": 5,
10+
"message": 3
11+
}
12+
]
13+
}
14+
]
15+
}

.github/workflows/Test.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
name: Test
32

43
on:
@@ -12,16 +11,17 @@ on:
1211
paths:
1312
- '**.php'
1413
- 'composer.json'
15-
branches:
16-
- 'main'
1714
workflow_dispatch:
1815

1916
jobs:
2017
run:
2118
runs-on: ubuntu-latest
2219
strategy:
2320
matrix:
24-
php: [ '8.0', '8.1', '8.2' ]
21+
php:
22+
- '8.0'
23+
- '8.1'
24+
- '8.2'
2525
continue-on-error: ${{ matrix.php == '8.2' }}
2626
name: PHP ${{ matrix.php }} Test
2727

@@ -34,18 +34,25 @@ jobs:
3434
with:
3535
php-version: ${{ matrix.php }}
3636
extensions: json
37+
tools: phpcs
3738
coverage: pcov
3839
env:
3940
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4041

42+
- name: Setup problem matchers for PHP syntax check
43+
run: echo "::add-matcher::.github/php-syntax.json"
44+
45+
- run: |
46+
! find . -type f -name '*.php' -exec php -l '{}' \; 2>&1 |grep -v '^No syntax errors detected'
47+
4148
- name: Setup problem matchers for PHPUnit
4249
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
4350

4451
- name: Install dependencies
4552
run: composer update --prefer-dist --no-interaction
4653

4754
- name: Run phpcs
48-
run: composer cs-check -- -v
55+
run: phpcs -- -v
4956

5057
- name: Execute tests
5158
run: composer test -- -v --coverage-clover=coverage.xml

.github/workflows/UpdateContributors.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
name: Update Contributors
32

43
on: [ push, workflow_dispatch]
@@ -9,10 +8,10 @@ jobs:
98

109
steps:
1110
- name: Git checkout
12-
uses: actions/checkout@v2.4.2
11+
uses: actions/checkout@v3
1312

1413
- name: Update Contributors
15-
uses: BobAnkh/add-contributors@v0.2.2
14+
uses: BobAnkh/add-contributors@master
1615
with:
1716
REPO_NAME: 'SoftCreatR/JSONPath'
1817
CONTRIBUTOR: '## Contributors ✨'

.github/workflows/codestyle.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Code Style
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
pull_request:
8+
paths:
9+
- '**.php'
10+
11+
jobs:
12+
php:
13+
name: PHP
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Setup PHP with tools
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: '8.1'
23+
extensions: json
24+
tools: cs2pr, phpcs, php-cs-fixer
25+
26+
- name: phpcs
27+
run: phpcs -n -q --report=checkstyle | cs2pr
28+
29+
- name: php-cs-fixer
30+
run: php-cs-fixer fix --dry-run --diff

.php-cs-fixer.dist.php

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<?php
2+
$finder = PhpCsFixer\Finder::create()
3+
->exclude('*/vendor/*')
4+
->exclude('node_modules')
5+
->in(__DIR__);
6+
7+
return (new PhpCsFixer\Config())
8+
->setRiskyAllowed(true)
9+
->setRules([
10+
'@PSR1' => true,
11+
'@PSR2' => true,
12+
'@PSR12' => true,
13+
'@PER' => true,
14+
15+
'array_push' => true,
16+
'backtick_to_shell_exec' => true,
17+
'no_alias_language_construct_call' => true,
18+
'no_mixed_echo_print' => true,
19+
'pow_to_exponentiation' => true,
20+
'random_api_migration' => true,
21+
22+
'array_syntax' => ['syntax' => 'short'],
23+
'no_multiline_whitespace_around_double_arrow' => true,
24+
'no_trailing_comma_in_singleline_array' => true,
25+
'no_whitespace_before_comma_in_array' => true,
26+
'normalize_index_brace' => true,
27+
'whitespace_after_comma_in_array' => true,
28+
29+
'non_printable_character' => ['use_escape_sequences_in_strings' => true],
30+
31+
'magic_constant_casing' => true,
32+
'magic_method_casing' => true,
33+
'native_function_casing' => true,
34+
'native_function_type_declaration_casing' => true,
35+
36+
'cast_spaces' => ['space' => 'none'],
37+
'no_unset_cast' => true,
38+
39+
'class_attributes_separation' => true,
40+
'no_null_property_initialization' => true,
41+
'self_accessor' => true,
42+
'single_class_element_per_statement' => true,
43+
44+
'no_empty_comment' => true,
45+
'single_line_comment_style' => ['comment_types' => ['hash']],
46+
47+
'native_constant_invocation' => ['strict' => false],
48+
49+
'no_alternative_syntax' => true,
50+
'no_trailing_comma_in_list_call' => true,
51+
'no_unneeded_control_parentheses' => ['statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield', 'yield_from']],
52+
'no_unneeded_curly_braces' => ['namespaces' => true],
53+
'switch_continue_to_break' => true,
54+
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
55+
56+
'function_typehint_space' => true,
57+
'lambda_not_used_import' => true,
58+
'native_function_invocation' => ['include' => ['@internal']],
59+
'no_unreachable_default_argument_value' => true,
60+
'nullable_type_declaration_for_default_null_value' => true,
61+
'static_lambda' => true,
62+
63+
'fully_qualified_strict_types' => true,
64+
'no_unused_imports' => true,
65+
66+
'dir_constant' => true,
67+
'explicit_indirect_variable' => true,
68+
'function_to_constant' => true,
69+
'is_null' => true,
70+
'no_unset_on_property' => true,
71+
72+
'list_syntax' => ['syntax' => 'short'],
73+
74+
'clean_namespace' => true,
75+
'no_leading_namespace_whitespace' => true,
76+
77+
'no_homoglyph_names' => true,
78+
79+
'binary_operator_spaces' => true,
80+
'concat_space' => ['spacing' => 'one'],
81+
'increment_style' => ['style' => 'post'],
82+
'logical_operators' => true,
83+
'object_operator_without_whitespace' => true,
84+
'operator_linebreak' => true,
85+
'standardize_increment' => true,
86+
'standardize_not_equals' => true,
87+
'ternary_to_elvis_operator' => true,
88+
'ternary_to_null_coalescing' => true,
89+
'unary_operator_spaces' => true,
90+
91+
'no_useless_return' => true,
92+
'return_assignment' => true,
93+
94+
'multiline_whitespace_before_semicolons' => true,
95+
'no_empty_statement' => true,
96+
'no_singleline_whitespace_before_semicolons' => true,
97+
'space_after_semicolon' => ['remove_in_empty_for_expressions' => true],
98+
99+
'escape_implicit_backslashes' => true,
100+
'explicit_string_variable' => true,
101+
'heredoc_to_nowdoc' => true,
102+
'no_binary_string' => true,
103+
'simple_to_complex_string_variable' => true,
104+
105+
'array_indentation' => true,
106+
'blank_line_before_statement' => ['statements' => ['return', 'exit']],
107+
'method_chaining_indentation' => true,
108+
'no_extra_blank_lines' => ['tokens' => ['case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'switch', 'throw', 'use']],
109+
'no_spaces_around_offset' => true,
110+
111+
// SoftCreatR style
112+
'global_namespace_import' => [
113+
'import_classes' => true,
114+
'import_constants' => true,
115+
'import_functions' => false,
116+
],
117+
'ordered_imports' => [
118+
'imports_order' => ['class', 'function', 'const'],
119+
],
120+
])
121+
->setFinder($finder);

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
### 0.8.2
4+
- AccessHelper & RecursiveFilter now return a plain `object`, rather than an `ArrayAccess` object
5+
36
### 0.8.1
47
- Removed strict_types
58
- Applied some PSR-12 related changes

composer.json

+16-19
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "softcreatr/jsonpath",
33
"description": "JSONPath implementation for parsing, searching and flattening arrays",
4-
"version": "0.8.1",
54
"license": "MIT",
5+
"version": "0.8.2",
66
"authors": [
77
{
88
"name": "Stephen Frank",
@@ -17,22 +17,24 @@
1717
"role": "Developer"
1818
}
1919
],
20+
"support": {
21+
"email": "[email protected]",
22+
"issues": "https://github.com/SoftCreatR/JSONPath/issues",
23+
"forum": "https://github.com/SoftCreatR/JSONPath/discussions",
24+
"source": "https://github.com/SoftCreatR/JSONPath"
25+
},
2026
"require": {
2127
"php": ">=8.0",
2228
"ext-json": "*"
2329
},
24-
"replace": {
25-
"flow/jsonpath": "*"
26-
},
2730
"require-dev": {
28-
"phpunit/phpunit": "^9.5",
29-
"roave/security-advisories": "dev-latest",
30-
"squizlabs/php_codesniffer": "^3.7"
31+
"phpunit/phpunit": "^9.6",
32+
"roave/security-advisories": "dev-latest"
3133
},
32-
"config": {
33-
"optimize-autoloader": true,
34-
"preferred-install": "dist"
34+
"replace": {
35+
"flow/jsonpath": "*"
3536
},
37+
"minimum-stability": "stable",
3638
"autoload": {
3739
"psr-4": {
3840
"Flow\\JSONPath\\": "src/"
@@ -43,16 +45,11 @@
4345
"Flow\\JSONPath\\Test\\": "tests/"
4446
}
4547
},
46-
"minimum-stability": "stable",
48+
"config": {
49+
"optimize-autoloader": true,
50+
"preferred-install": "dist"
51+
},
4752
"scripts": {
48-
"cs-check": "phpcs",
49-
"cs-fix": "phpcbf",
5053
"test": "phpunit"
51-
},
52-
"support": {
53-
"email": "[email protected]",
54-
"forum": "https://github.com/SoftCreatR/JSONPath/discussions",
55-
"issues": "https://github.com/SoftCreatR/JSONPath/issues",
56-
"source": "https://github.com/SoftCreatR/JSONPath"
5754
}
5855
}

src/Filters/RecursiveFilter.php

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace Flow\JSONPath\Filters;
1010

11-
use ArrayAccess;
1211
use Flow\JSONPath\AccessHelper;
1312
use Flow\JSONPath\JSONPathException;
1413

0 commit comments

Comments
 (0)