Skip to content

Commit 58e9bd8

Browse files
authored
Merge pull request #27 from thomasvargiu/feat-php8
v5.0 refactoring for PHP 8
2 parents 52f6a9f + 7cb2c4a commit 58e9bd8

80 files changed

Lines changed: 4805 additions & 5159 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
tests/ export-ignore
2-
.scrutinizer.yml export-ignore
3-
.travis.yml export-ignore
4-
.composer.lock export-ignore
5-
.phpunit.xml.dist export-ignore
1+
tests/ export-ignore
2+
.github/ export-ignore
3+
.php_cs* export-ignore
4+
.scrutinizer.yml export-ignore
5+
composer.lock export-ignore
6+
psalm.xml export-ignore
7+
psalm.xml.dist export-ignore
8+
phpunit.xml.dist export-ignore
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: "Continuous Integration"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "*.x"
7+
- "master"
8+
push:
9+
branches:
10+
- "*.x"
11+
- "master"
12+
schedule:
13+
- cron: "42 9 * * 1"
14+
15+
jobs:
16+
psalm:
17+
name: "Static Analysis"
18+
runs-on: "ubuntu-20.04"
19+
20+
strategy:
21+
matrix:
22+
php-version:
23+
- "7.3"
24+
- "7.4"
25+
- "8.0"
26+
- "8.1"
27+
- "8.2"
28+
29+
steps:
30+
- name: "Checkout"
31+
uses: "actions/checkout@v2"
32+
with:
33+
fetch-depth: 2
34+
35+
- name: "Install PHP"
36+
uses: "shivammathur/setup-php@v2"
37+
with:
38+
php-version: "${{ matrix.php-version }}"
39+
40+
- name: "Cache dependencies installed with composer"
41+
uses: "actions/cache@v2"
42+
with:
43+
path: "~/.composer/cache"
44+
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('composer.lock') }}"
45+
restore-keys: "php-${{ matrix.php-version }}-composer-"
46+
47+
- name: "Install dependencies with composer"
48+
run: "composer update --no-interaction --no-progress --no-suggest --prefer-dist"
49+
50+
- name: "Run psalm"
51+
run: "vendor/bin/psalm --long-progress --output-format=github --report=psalm.sarif --php-version=${{ matrix.php-version }}"
52+
53+
- name: "Upload SARIF file"
54+
uses: github/codeql-action/upload-sarif@v1
55+
continue-on-error: true
56+
with:
57+
sarif_file: psalm.sarif
58+
59+
codestyle:
60+
name: "Code Style"
61+
runs-on: "ubuntu-20.04"
62+
63+
strategy:
64+
matrix:
65+
php-version:
66+
- "8.2"
67+
deps:
68+
- "latest"
69+
coverage:
70+
- "false"
71+
72+
steps:
73+
- name: "Checkout"
74+
uses: "actions/checkout@v2"
75+
with:
76+
fetch-depth: 2
77+
78+
- name: "Install PHP"
79+
uses: "shivammathur/setup-php@v2"
80+
with:
81+
php-version: "${{ matrix.php-version }}"
82+
coverage: "pcov"
83+
ini-values: "zend.assertions=1"
84+
extensions: "bcmath gmp"
85+
86+
- name: "Cache dependencies installed with composer"
87+
uses: "actions/cache@v2"
88+
with:
89+
path: "~/.composer/cache"
90+
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('composer.lock') }}"
91+
restore-keys: "php-${{ matrix.php-version }}-composer-"
92+
93+
- name: "Install dependencies with composer"
94+
run: "composer update --no-interaction --no-progress --no-suggest --prefer-dist"
95+
96+
- name: "Run PHPCS check"
97+
run: "composer cs-check"
98+
99+
phpunit:
100+
name: "PHPUnit"
101+
runs-on: "ubuntu-20.04"
102+
103+
strategy:
104+
matrix:
105+
php-version:
106+
- "7.3"
107+
- "7.4"
108+
- "8.0"
109+
- "8.1"
110+
- "8.2"
111+
deps:
112+
- "lowest"
113+
- "latest"
114+
coverage:
115+
- "false"
116+
include:
117+
- php-version: "8.1"
118+
deps: "latest"
119+
coverage: "true"
120+
121+
steps:
122+
- name: "Checkout"
123+
uses: "actions/checkout@v2"
124+
with:
125+
fetch-depth: 2
126+
127+
- name: "Install PHP"
128+
uses: "shivammathur/setup-php@v2"
129+
with:
130+
php-version: "${{ matrix.php-version }}"
131+
coverage: "pcov"
132+
ini-values: "zend.assertions=1"
133+
extensions: "bcmath gmp"
134+
135+
- name: "Cache dependencies installed with composer"
136+
uses: "actions/cache@v2"
137+
with:
138+
path: "~/.composer/cache"
139+
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('composer.lock') }}"
140+
restore-keys: "php-${{ matrix.php-version }}-composer-"
141+
142+
- name: "Install dependencies with composer"
143+
run: "composer update --no-interaction --no-progress --no-suggest --prefer-dist"
144+
if: "${{ matrix.deps != 'lowest' }}"
145+
146+
- name: "Install lowest possible dependencies with composer"
147+
run: "composer update --no-interaction --no-progress --no-suggest --prefer-dist --prefer-lowest"
148+
if: "${{ matrix.deps == 'lowest' }}"
149+
150+
- name: "Run PHPUnit"
151+
run: "vendor/bin/phpunit -c phpunit.xml.dist"
152+
if: "${{ matrix.coverage != 'true' }}"
153+
154+
- name: "Run PHPUnit with coverage"
155+
run: "vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=coverage-report.xml"
156+
if: "${{ matrix.coverage == 'true' }}"
157+
158+
- name: Upload code coverage
159+
uses: codecov/codecov-action@v1
160+
with:
161+
file: coverage-report.xml
162+
if: "${{ matrix.coverage == 'true' }}"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ composer.phar
33
vendor/
44
build/
55
*.test.php
6-
.php_cs.cache
6+
.php-cs-fixer.cache
77
.phpunit.result.cache

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

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
])
88
;
99

10-
return PhpCsFixer\Config::create()
10+
return (new PhpCsFixer\Config())
1111
->setRules([
1212
'@PSR2' => true,
1313
'align_multiline_comment' => true,
@@ -16,8 +16,10 @@
1616
'syntax' => 'short',
1717
],
1818
'binary_operator_spaces' => [
19-
'align_double_arrow' => false,
20-
'align_equals' => false,
19+
'operators' => [
20+
'=>' => null,
21+
'=' => null,
22+
],
2123
],
2224
'blank_line_after_namespace' => true,
2325
'blank_line_after_opening_tag' => true,
@@ -37,17 +39,19 @@
3739
'declare_equal_normalize' => true,
3840
'function_typehint_space' => true,
3941
'include' => true,
42+
'increment_style' => [
43+
'style' => 'pre',
44+
],
4045
'lowercase_cast' => true,
4146
'method_chaining_indentation' => true,
42-
'method_separation' => true,
4347
'multiline_comment_opening_closing' => true,
4448
'native_function_casing' => true,
4549
'new_with_braces' => true,
4650
'no_blank_lines_after_phpdoc' => true,
4751
'no_empty_comment' => true,
4852
'no_empty_phpdoc' => true,
4953
'no_empty_statement' => true,
50-
'no_extra_consecutive_blank_lines' => [
54+
'no_extra_blank_lines' => [
5155
'tokens' => [
5256
'curly_brace_block',
5357
'extra',
@@ -66,12 +70,9 @@
6670
'no_short_bool_cast' => true,
6771
'no_singleline_whitespace_before_semicolons' => true,
6872
'no_spaces_around_offset' => true,
69-
'no_superfluous_phpdoc_tags' => true,
7073
'no_trailing_comma_in_list_call' => true,
7174
'no_trailing_comma_in_singleline_array' => true,
7275
'no_unneeded_control_parentheses' => true,
73-
'no_unneeded_curly_braces' => true,
74-
'no_unneeded_final_method' => true,
7576
'no_unused_imports' => true,
7677
'no_whitespace_before_comma_in_array' => true,
7778
'no_whitespace_in_blank_line' => true,
@@ -82,9 +83,6 @@
8283
'phpdoc_align' => false,
8384
'phpdoc_annotation_without_dot' => true,
8485
'phpdoc_indent' => true,
85-
'phpdoc_line_span' => [
86-
'property' => 'single',
87-
],
8886
'phpdoc_no_package' => true,
8987
'phpdoc_no_useless_inheritdoc' => true,
9088
'phpdoc_order' => true,
@@ -95,7 +93,6 @@
9593
'phpdoc_trim' => true,
9694
'phpdoc_types' => true,
9795
'phpdoc_var_without_name' => true,
98-
'pre_increment' => true,
9996
'return_type_declaration' => true,
10097
'short_scalar_cast' => true,
10198
'single_blank_line_before_namespace' => true,
@@ -105,35 +102,12 @@
105102
'standardize_not_equals' => true,
106103
'ternary_operator_spaces' => true,
107104
'ternary_to_null_coalescing' => true,
108-
'trailing_comma_in_multiline_array' => true,
105+
'trailing_comma_in_multiline' => [
106+
'elements' => ['arrays'],
107+
],
109108
'trim_array_spaces' => true,
110109
'unary_operator_spaces' => true,
111110
'whitespace_after_comma_in_array' => true,
112-
// risky
113-
'dir_constant' => true,
114-
'function_to_constant' => true,
115-
'global_namespace_import' => [
116-
'import_classes' => true,
117-
'import_constants' => true,
118-
'import_functions' => true,
119-
],
120-
'is_null' => true,
121-
'logical_operators' => true,
122-
'modernize_types_casting' => true,
123-
'no_alias_functions' => true,
124-
'no_php4_constructor' => true,
125-
'non_printable_character' => true,
126-
'php_unit_construct' => true,
127-
'php_unit_dedicate_assert' => true,
128-
'php_unit_mock' => true,
129-
'php_unit_namespaced' => true,
130-
'php_unit_set_up_tear_down_visibility' => true,
131-
'pow_to_exponentiation' => true,
132-
'psr0' => true,
133-
'psr4' => true,
134-
'random_api_migration' => true,
135-
'self_accessor' => true,
136-
'void_return' => true,
137111
])
138112
->setFinder($finder)
139113
;

.travis.yml

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

0 commit comments

Comments
 (0)