Skip to content

Commit 72ff782

Browse files
authored
Merge pull request #10 from Riimu/add-php82-support
Add support for php 8.2
2 parents 09634d2 + f8e646f commit 72ff782

File tree

16 files changed

+194
-137
lines changed

16 files changed

+194
-137
lines changed

.gitattributes

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
* text eol=lf
33

44
# Remove developer files from exports
5+
.github export-ignore
56
tests export-ignore
7+
68
.gitattributes export-ignore
7-
.github export-ignore
89
.gitignore export-ignore
9-
.php_cs export-ignore
10+
.php-cs-fixer.php export-ignore
11+
.phpcs.xml export-ignore
1012
.travis.yml export-ignore
1113
phpunit.xml export-ignore
1214
sami_config.php export-ignore
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "Setup Composer"
2+
description: "Sets up the composer dependencies"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Get Composer Cache Directory
7+
id: composer-cache
8+
shell: bash
9+
run: |
10+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
11+
- uses: actions/cache@v3
12+
with:
13+
path: ${{ steps.composer-cache.outputs.dir }}
14+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
15+
restore-keys: |
16+
${{ runner.os }}-composer-
17+
- name: Install dependencies
18+
run: composer install --no-progress --prefer-dist --classmap-authoritative --no-interaction
19+
shell: bash

.github/workflows/main.yml

Lines changed: 57 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -8,74 +8,88 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11-
tests:
11+
PHPUnit:
1212
strategy:
1313
matrix:
14-
operating-system: [ubuntu-latest]
15-
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
14+
operating-system: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ]
15+
php-versions: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' , '8.2']
1616
runs-on: ${{ matrix.operating-system }}
1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v3
2020
- name: Setup PHP
2121
uses: shivammathur/setup-php@v2
2222
with:
2323
php-version: ${{ matrix.php-versions }}
2424
coverage: none
25-
- name: Get composer cache directory
26-
id: composer-cache
27-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
28-
- name: Cache composer dependencies
29-
uses: actions/cache@v2
25+
ini-values: error_reporting=E_ALL
26+
- name: Setup Composer
27+
uses: ./.github/actions/setup-composer
28+
- name: Install PHPUnit
29+
run: composer require --dev phpunit/phpunit
30+
- name: Run PHPUnit
31+
run: composer test
32+
PHP_CodeSniffer:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v3
37+
- name: Setup PHP
38+
uses: shivammathur/setup-php@v2
3039
with:
31-
path: ${{ steps.composer-cache.outputs.dir }}
32-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
33-
restore-keys: ${{ runner.os }}-composer-
34-
- name: Install dependencies
35-
run: composer install --no-progress --prefer-dist --classmap-authoritative --no-interaction
36-
- name: Setup problem matchers for PHPUnit
37-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
38-
- name: Test with phpunit
39-
run: vendor/bin/phpunit
40-
lint:
40+
php-version: latest
41+
coverage: none
42+
tools: phpcs
43+
- name: Setup Composer
44+
uses: ./.github/actions/setup-composer
45+
- name: Run PHP_CodeSniffer
46+
run: composer phpcs -- --no-cache
47+
PHP-CS-Fixer:
4148
runs-on: ubuntu-latest
49+
env:
50+
PHP_CS_FIXER_IGNORE_ENV: 1
4251
steps:
4352
- name: Checkout
44-
uses: actions/checkout@v2
53+
uses: actions/checkout@v3
4554
- name: Setup PHP
4655
uses: shivammathur/setup-php@v2
4756
with:
48-
php-version: '7.4'
57+
php-version: latest
4958
coverage: none
50-
tools: cs2pr, php-cs-fixer, phpcs
59+
tools: php-cs-fixer
60+
- name: Setup Composer
61+
uses: ./.github/actions/setup-composer
5162
- name: Run PHP Coding Standards Fixer
52-
run: php-cs-fixer fix --dry-run --using-cache=no --format=checkstyle | cs2pr
53-
- name: Run PHP_CodeSniffer
54-
run: phpcs --standard=PSR12 --exclude=PSR12.Properties.ConstantVisibility -q --report=checkstyle src tests | cs2pr
63+
run: composer php-cs-fixer -- --dry-run --diff --using-cache=no
64+
composer-normalize:
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v3
69+
- name: Setup PHP
70+
uses: shivammathur/setup-php@v2
71+
with:
72+
php-version: latest
73+
coverage: none
74+
tools: composer-normalize
75+
- name: Setup Composer
76+
uses: ./.github/actions/setup-composer
77+
- name: Run composer-normalize
78+
run: composer-normalize --dry-run
5579
coverage:
5680
runs-on: ubuntu-latest
5781
steps:
5882
- name: Checkout
59-
uses: actions/checkout@v2
83+
uses: actions/checkout@v3
6084
- name: Setup PHP
6185
uses: shivammathur/setup-php@v2
6286
with:
63-
php-version: '8.0'
87+
php-version: latest
6488
coverage: xdebug
65-
- name: Get composer cache directory
66-
id: composer-cache
67-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
68-
- name: Cache composer dependencies
69-
uses: actions/cache@v2
70-
with:
71-
path: ${{ steps.composer-cache.outputs.dir }}
72-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
73-
restore-keys: ${{ runner.os }}-composer-
74-
- name: Install dependencies
75-
run: composer install --no-progress --prefer-dist --classmap-authoritative --no-interaction
76-
- name: Setup problem matchers for PHPUnit
77-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
78-
- name: Test with phpunit
79-
run: vendor/bin/phpunit --coverage-clover coverage.xml
89+
tools: phpunit
90+
- name: Setup Composer
91+
uses: ./.github/actions/setup-composer
92+
- name: Run PHPUnit with coverage
93+
run: composer test -- --do-not-cache-result --coverage-clover coverage.xml
8094
- name: Upload coverage
81-
uses: codecov/codecov-action@v1
95+
uses: codecov/codecov-action@v3

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
build/
22
vendor/
3-
.phpunit.result.cache
3+
.phpunit.cache
4+
.php-cs-fixer.cache
45
examples/dbconf.php
56
composer.lock

.php_cs renamed to .php-cs-fixer.php

Lines changed: 19 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,43 @@
44
->in(__DIR__ . '/src')
55
->in(__DIR__ . '/tests');
66

7-
return \PhpCsFixer\Config::create()
7+
return (new PhpCsFixer\Config())
88
->setRiskyAllowed(true)
99
->setRules([
10-
'@PSR2' => true,
10+
'@PSR12' => true,
1111

12-
'align_multiline_comment' => true,
13-
'array_indentation' => true,
14-
'array_syntax' => ['syntax' => 'short'],
15-
'backtick_to_shell_exec' => true,
12+
'array_syntax' => [
13+
'syntax' => 'short'
14+
],
1615
'binary_operator_spaces' => true,
1716
'blank_line_after_opening_tag' => true,
1817
'cast_spaces' => true,
19-
'class_attributes_separation' => ['elements' => ['method']],
20-
'combine_consecutive_issets' => true,
18+
'class_attributes_separation' => ['elements' => ['method' => 'one']],
2119
'combine_consecutive_unsets' => true,
22-
'concat_space' => ['spacing' => 'one'],
20+
'concat_space' => [
21+
'spacing' => 'one'
22+
],
2323
'declare_equal_normalize' => true,
2424
'dir_constant' => true,
2525
'ereg_to_preg' => true,
26-
'fully_qualified_strict_types' => true,
2726
'function_to_constant' => true,
2827
'function_typehint_space' => true,
2928
'heredoc_to_nowdoc' => true,
3029
'include' => true,
3130
'is_null' => true,
32-
'list_syntax' => ['syntax' => 'short'],
33-
'logical_operators' => true,
3431
'lowercase_cast' => true,
35-
'lowercase_static_reference' => true,
3632
'magic_constant_casing' => true,
37-
'modernize_types_casting' => true,
38-
'multiline_comment_opening_closing' => true,
3933
'multiline_whitespace_before_semicolons' => true,
40-
'native_constant_invocation' => true,
34+
'modernize_types_casting' => true,
4135
'native_function_casing' => true,
42-
'native_function_invocation' => ['include' => ['@compiler_optimized']],
4336
'new_with_braces' => true,
4437
'no_alias_functions' => true,
45-
'no_binary_string' => true,
4638
'no_blank_lines_after_class_opening' => true,
4739
'no_blank_lines_after_phpdoc' => true,
4840
'no_empty_comment' => true,
4941
'no_empty_phpdoc' => true,
5042
'no_empty_statement' => true,
5143
'no_extra_blank_lines' => true,
52-
'no_homoglyph_names' => true,
5344
'no_leading_import_slash' => true,
5445
'no_leading_namespace_whitespace' => true,
5546
'no_mixed_echo_print' => true,
@@ -58,68 +49,51 @@
5849
'no_short_bool_cast' => true,
5950
'no_singleline_whitespace_before_semicolons' => true,
6051
'no_spaces_around_offset' => true,
61-
'no_trailing_comma_in_list_call' => true,
62-
'no_trailing_comma_in_singleline_array' => true,
52+
'no_trailing_comma_in_singleline' => true,
6353
'no_unneeded_control_parentheses' => true,
64-
'no_unneeded_curly_braces' => true,
65-
'no_unneeded_final_method' => true,
66-
'no_unreachable_default_argument_value' => true,
6754
'no_unused_imports' => true,
6855
'no_useless_return' => true,
6956
'no_whitespace_before_comma_in_array' => true,
7057
'no_whitespace_in_blank_line' => true,
7158
'non_printable_character' => true,
7259
'normalize_index_brace' => true,
7360
'object_operator_without_whitespace' => true,
74-
'ordered_class_elements' => ['order' => ['use_trait', 'constant', 'property', 'construct', 'method']],
61+
'ordered_class_elements' => [
62+
'order' => ['use_trait', 'constant', 'property', 'construct', 'method'],
63+
],
7564
'ordered_imports' => true,
7665
'php_unit_construct' => true,
77-
'php_unit_dedicate_assert' => ['target' => 'newest'],
78-
'php_unit_expectation' => true,
79-
'php_unit_mock' => true,
80-
'php_unit_namespaced' => true,
81-
'php_unit_no_expectation_annotation' => true,
82-
'php_unit_set_up_tear_down_visibility' => true,
66+
'php_unit_dedicate_assert' => true,
8367
'php_unit_strict' => true,
84-
'php_unit_test_case_static_method_calls' => ['call_type' => 'this'],
8568
'phpdoc_add_missing_param_annotation' => true,
86-
'phpdoc_align' => ['align' => 'left'],
8769
'phpdoc_annotation_without_dot' => true,
8870
'phpdoc_indent' => true,
89-
'phpdoc_inline_tag' => true,
71+
'phpdoc_inline_tag_normalizer' => true,
9072
'phpdoc_no_access' => true,
9173
'phpdoc_no_alias_tag' => true,
9274
'phpdoc_no_package' => true,
93-
'phpdoc_no_useless_inheritdoc' => true,
94-
'phpdoc_return_self_reference' => true,
9575
'phpdoc_scalar' => true,
9676
'phpdoc_single_line_var_spacing' => true,
9777
'phpdoc_summary' => true,
98-
'phpdoc_to_comment' => true,
9978
'phpdoc_trim' => true,
100-
'phpdoc_trim_consecutive_blank_line_separation' => true,
10179
'phpdoc_types' => true,
10280
'phpdoc_var_without_name' => true,
10381
'pow_to_exponentiation' => true,
104-
'psr4' => true,
82+
'psr_autoloading' => true,
10583
'return_type_declaration' => true,
10684
'self_accessor' => true,
107-
'semicolon_after_instruction' => true,
108-
'set_type_to_cast' => true,
10985
'short_scalar_cast' => true,
110-
'simplified_null_return' => true,
11186
'single_blank_line_before_namespace' => true,
11287
'single_line_comment_style' => true,
11388
'single_quote' => true,
11489
'space_after_semicolon' => true,
115-
'standardize_increment' => true,
11690
'standardize_not_equals' => true,
11791
'strict_comparison' => true,
11892
'strict_param' => true,
11993
'ternary_operator_spaces' => true,
120-
'ternary_to_null_coalescing' => true,
121-
'trailing_comma_in_multiline_array' => true,
94+
'trailing_comma_in_multiline' => true,
12295
'trim_array_spaces' => true,
96+
'visibility_required' => ['elements' => ['property', 'method']],
12397
'whitespace_after_comma_in_array' => true,
12498
])
12599
->setFinder($finder);

.phpcs.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Project Coding Standard">
3+
<description>The coding standard configuration used for this project</description>
4+
5+
<file>./src/</file>
6+
<file>./tests/</file>
7+
8+
<exclude-pattern>*/vendor/*</exclude-pattern>
9+
<arg name="extensions" value="php" />
10+
11+
<rule ref="PSR12">
12+
<exclude name="PSR12.Properties.ConstantVisibility" />
13+
</rule>
14+
</ruleset>

CHANGES.md

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

3+
## v2.4.2 (2022-12-10) ##
4+
5+
* Added tests to ensure PHP 8.2 compatibility
6+
* Changed `export` type object conversion have more consistent index order
7+
38
## v2.4.1 (2020-11-29) ##
49

510
* Migrated to Github actions for CI

LICENSE

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
Copyright (c) 2013-2020 Riikka Kalliomäki
1+
MIT License
22

3-
Permission is hereby granted, free of charge, to any person obtaining a copy of
4-
this software and associated documentation files (the "Software"), to deal in
5-
the Software without restriction, including without limitation the rights to
6-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7-
the Software, and to permit persons to whom the Software is furnished to do so,
8-
subject to the following conditions:
3+
Copyright (c) 2013-2022 Riikka Kalliomäki
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
911

1012
The above copyright notice and this permission notice shall be included in all
1113
copies or substantial portions of the Software.
1214

1315
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,6 @@ apply to following calls.
288288

289289
## Credits ##
290290

291-
This library is Copyright (c) 2013-2020 Riikka Kalliomäki.
291+
This library is Copyright (c) 2013-2022 Riikka Kalliomäki.
292292

293293
See LICENSE for license and copying information.

0 commit comments

Comments
 (0)