Skip to content

Commit 6184c17

Browse files
authored
PHP version upgrade (#27)
1 parent 5d63fa7 commit 6184c17

File tree

13 files changed

+19750
-19847
lines changed

13 files changed

+19750
-19847
lines changed

.github/dependabot.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
version: 2
22
updates:
3-
- package-ecosystem: gitsubmodule
4-
directory: "/"
5-
schedule:
6-
interval: daily
7-
time: "04:00"
8-
open-pull-requests-limit: 10
9-
reviewers:
10-
- chekalsky
11-
assignees:
12-
- chekalskiy
13-
- package-ecosystem: composer
14-
directory: "/"
15-
schedule:
16-
interval: daily
17-
time: "04:00"
18-
open-pull-requests-limit: 10
19-
reviewers:
20-
- chekalskiy
21-
assignees:
22-
- chekalskiy
3+
- package-ecosystem: gitsubmodule
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
reviewers:
9+
- chekalsky
10+
assignees:
11+
- chekalsky
12+
13+
- package-ecosystem: composer
14+
directory: "/"
15+
schedule:
16+
interval: weekly
17+
open-pull-requests-limit: 10
18+
reviewers:
19+
- chekalsky
20+
assignees:
21+
- chekalsky

.github/workflows/ci.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: PHP Tests
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
php-lint:
8+
name: PHP Lint
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
php-version: [ '8.3', '8.4' ]
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup PHP with tools
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: ${{ matrix.php-version }}
20+
tools: php-cs-fixer, cs2pr
21+
22+
- name: PHP CS Fixer
23+
#run: php-cs-fixer fix --using-cache=no --dry-run --format=checkstyle | cs2pr
24+
# tmp fix for PHP 8.4
25+
run: PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --using-cache=no --dry-run --format=checkstyle | cs2pr
26+
27+
php-unit:
28+
name: PHP Unit Tests (php${{ matrix.php-versions }})
29+
runs-on: ubuntu-latest
30+
continue-on-error: ${{ matrix.experimental }}
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
php-versions: [ '8.3', '8.4' ]
35+
experimental: [ false ]
36+
#include:
37+
# - php-versions: '8.1'
38+
# experimental: true
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: Setup PHP with tools
43+
uses: shivammathur/setup-php@v2
44+
with:
45+
php-version: ${{ matrix.php-versions }}
46+
tools: composer
47+
48+
- name: Get Composer Cache Directory
49+
id: composer-cache
50+
run: |
51+
echo "::set-output name=dir::$(composer config cache-files-dir)"
52+
53+
- uses: actions/cache@v4
54+
with:
55+
path: ${{ steps.composer-cache.outputs.dir }}
56+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
57+
restore-keys: |
58+
${{ runner.os }}-composer-
59+
60+
- name: Setup problem matchers for PHPUnit
61+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
62+
63+
- name: Install dependencies
64+
run: composer install --prefer-dist --no-progress
65+
66+
- name: PHPUnit
67+
run: vendor/bin/phpunit
68+
69+
psalm:
70+
name: PHP Static Analysis (php${{ matrix.php-versions }})
71+
runs-on: ubuntu-latest
72+
continue-on-error: ${{ matrix.experimental }}
73+
strategy:
74+
fail-fast: false
75+
matrix:
76+
php-versions: [ '8.3', '8.4' ]
77+
experimental: [ false ]
78+
#include:
79+
# - php-versions: '8.1'
80+
# experimental: true
81+
steps:
82+
- uses: actions/checkout@v4
83+
84+
- name: Setup PHP with tools
85+
uses: shivammathur/setup-php@v2
86+
with:
87+
php-version: ${{ matrix.php-versions }}
88+
tools: composer, psalm
89+
90+
- name: Get Composer Cache Directory
91+
id: composer-cache
92+
run: |
93+
echo "::set-output name=dir::$(composer config cache-files-dir)"
94+
95+
- uses: actions/cache@v4
96+
with:
97+
path: ${{ steps.composer-cache.outputs.dir }}
98+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
99+
restore-keys: |
100+
${{ runner.os }}-composer-
101+
102+
- name: Install dependencies
103+
run: composer install --prefer-dist --no-progress
104+
105+
- name: Psalm
106+
run: psalm --output-format=github
Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
11
<?php
22

3-
return PhpCsFixer\Config::create()
4-
->setUsingCache(true)
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__)
5+
->exclude('vendor')
6+
->exclude('banks-db');
7+
8+
$config = new PhpCsFixer\Config();
9+
10+
return $config->setUsingCache(true)
11+
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
512
->setCacheFile(__DIR__ . '/.php_cs.cache')
613
->setRules([
7-
'@PSR2' => true,
14+
'@PER-CS2.0' => true,
815
'align_multiline_comment' => true,
9-
'array_indentation' => true,
10-
'array_syntax' => ['syntax' => 'short'],
11-
'binary_operator_spaces' => true,
12-
'blank_line_before_statement' => ['statements' => ['return']],
13-
'cast_spaces' => true,
14-
'concat_space' => ['spacing' => 'one'],
15-
'constant_case' => true,
16-
'declare_equal_normalize' => true,
17-
'lowercase_cast' => true,
18-
'method_argument_space' => true,
19-
'method_separation' => true,
16+
'blank_line_before_statement' => ['statements' => ['continue', 'declare', 'return', 'throw', 'try']],
17+
'class_attributes_separation' => ['elements' => ['method' => 'one']],
2018
'no_empty_statement' => true,
21-
'no_leading_import_slash' => true,
2219
'no_leading_namespace_whitespace' => true,
2320
'no_multiline_whitespace_around_double_arrow' => true,
24-
'no_multiline_whitespace_before_semicolons' => true,
21+
'multiline_whitespace_before_semicolons' => false,
2522
'no_unused_imports' => true,
23+
'no_unneeded_import_alias' => true,
2624
'no_whitespace_before_comma_in_array' => true,
2725
'no_whitespace_in_blank_line' => true,
28-
'ordered_imports' => true,
26+
'single_import_per_statement' => true,
27+
'ordered_imports' => [
28+
'sort_algorithm' => 'alpha',
29+
'imports_order' => ['class', 'function', 'const'],
30+
],
2931
'phpdoc_add_missing_param_annotation' => true,
3032
'phpdoc_align' => true,
3133
'phpdoc_annotation_without_dot' => true,
3234
'phpdoc_indent' => true,
3335
'phpdoc_no_empty_return' => true,
3436
'phpdoc_no_useless_inheritdoc' => true,
3537
'phpdoc_order' => true,
36-
'phpdoc_return_self_reference' => true,
38+
'phpdoc_return_self_reference' => ['replacements' => ['this' => 'self']],
3739
'phpdoc_scalar' => true,
38-
'phpdoc_separation' => true,
40+
'phpdoc_separation' => ['skip_unlisted_annotations' => true],
3941
'phpdoc_single_line_var_spacing' => true,
4042
'phpdoc_trim' => true,
4143
'phpdoc_trim_consecutive_blank_line_separation' => true,
@@ -50,9 +52,13 @@
5052
'trim_array_spaces' => true,
5153
'visibility_required' => ['elements' => ['property', 'method', 'const']],
5254
'yoda_style' => false,
55+
'no_trailing_comma_in_singleline' => true,
56+
'single_line_after_imports' => true,
57+
'global_namespace_import' => [
58+
'import_classes' => true,
59+
'import_constants' => true,
60+
'import_functions' => true,
61+
],
62+
'clean_namespace' => true,
5363
])
54-
->setFinder(
55-
PhpCsFixer\Finder::create()
56-
->exclude('db')
57-
->in(__DIR__)
58-
);
64+
->setFinder($finder);

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=7.2"
15+
"php": ">=8.3"
1616
},
1717
"require-dev": {
1818
"ext-json": "*",
19-
"friendsofphp/php-cs-fixer": "^2.16",
20-
"phpunit/phpunit": "^8",
21-
"squizlabs/php_codesniffer": "^3.5"
19+
"phpunit/phpunit": "^12.0",
20+
"rector/rector": "^2.0",
21+
"symfony/var-exporter": "^7.2"
2222
},
2323
"autoload": {
2424
"psr-4": {
@@ -37,4 +37,4 @@
3737
"php parse.php"
3838
]
3939
}
40-
}
40+
}

0 commit comments

Comments
 (0)