Skip to content

Commit 57b5136

Browse files
authored
fix: update php-cs-fixer version and use it in CI (#14)
* ci(codestyle): update php-cs-fixer * fix: add composer.lock for having more stable CI * ci: use php 8.3 in CI * tests: fix tests with php-cs-fixer * docs: update contributing instructions
1 parent 4ae5aa6 commit 57b5136

File tree

13 files changed

+3662
-37
lines changed

13 files changed

+3662
-37
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ jobs:
1111
timeout-minutes: 5
1212

1313
steps:
14+
- name: Setup PHP
15+
uses: shivammathur/setup-php@v2
16+
with:
17+
php-version: '8.3'
18+
1419
- name: Checkout
1520
uses: actions/checkout@v4
1621

@@ -38,6 +43,11 @@ jobs:
3843
- dependency-validation
3944

4045
steps:
46+
- name: Setup PHP
47+
uses: shivammathur/setup-php@v2
48+
with:
49+
php-version: '8.3'
50+
4151
- name: Checkout
4252
uses: actions/checkout@v4
4353

@@ -51,4 +61,7 @@ jobs:
5161
uses: php-actions/composer@v6
5262

5363
- name: Run PHPUnit
54-
run: php -d xdebug.mode=coverage ./vendor/bin/phpunit
64+
run: make test-unit
65+
66+
- name: Run php-cs-fixer
67+
run: make php-cs-fixer

.github/workflows/release.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ jobs:
1010
name: Semantic Release
1111
runs-on: ubuntu-latest
1212
steps:
13+
- name: Setup PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: '8.3'
17+
1318
- name: Checkout
1419
uses: actions/checkout@v4
1520

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.idea
22
.DS_Store
33
.phpunit.result.cache
4-
composer.lock
54
composer.phar
65
vendor
76
coverage.xml
87
.php_cs.cache
98
.phpunit.cache
9+
.php-cs-fixer.cache

.php_cs.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
<?php
22

3-
return \PhpCsFixer\Config::create()
3+
use PhpCsFixer\Config;
4+
5+
return (new Config())
6+
->setRiskyAllowed(true)
47
->setFinder(
5-
\PhpCsFixer\Finder::create()
8+
PhpCsFixer\Finder::create()
69
->in(__DIR__ . '/src')
710
->in(__DIR__ . '/tests')
811
)
9-
->setRiskyAllowed(true)
10-
->setRules([
11-
'@PhpCsFixer' => true,
12-
'@PhpCsFixer:risky' => true,
13-
'@PHP71Migration' => true,
14-
'@PHP71Migration:risky' => true,
15-
'@DoctrineAnnotation' => true,
16-
'@PHPUnit60Migration:risky' => true,
17-
'native_function_invocation' => true,
18-
'header_comment' => ['header' => ''],
19-
'method_chaining_indentation' => false,
20-
'php_unit_test_class_requires_covers' => false,
21-
])
22-
;
12+
;

CONTRIBUTING.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You can open [a new issue](https://github.com/Strobotti/php-jwk/issues) once you
1212

1313
If you want to fix a bug or add a missing feature you can open a new pull-request.
1414

15-
Please note that you need a PHP 7.2 or later for using this library (including running the tests).
15+
Please note that you need a PHP 7.3 or later for using this library (running the tests requires at least php 8.2).
1616

1717
Basic steps:
1818

@@ -40,9 +40,10 @@ Some guidelines:
4040

4141
### Git Commit Messages
4242

43-
* Use the present tense ("Add feature" not "Added feature")
44-
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
45-
* Limit the first line to 72 characters or less
43+
* use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) to make the commit messages more readable and to allow for automatic semantic versioning and changelog generation
44+
* Use the present tense ("add feature" not "added feature")
45+
* Use the imperative mood ("move cursor to..." not "moves cursor to...")
46+
* Limit the first line to 72 characters, or less
4647

4748
## License
4849

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
test-unit:
2-
./vendor/bin/phpunit
2+
php -d xdebug.mode=coverage ./vendor/bin/phpunit
33

44
php-cs-fixer:
5-
./vendor/bin/php-cs-fixer fix --show-progress dots --dry-run --config .php_cs.php
5+
./vendor/bin/php-cs-fixer fix --verbose --dry-run --show-progress none --config .php_cs.php
66

77
php-cs-fixer-fix:
8-
./vendor/bin/php-cs-fixer fix --show-progress dots --config .php_cs.php
8+
./vendor/bin/php-cs-fixer fix --verbose --show-progress none --config .php_cs.php

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"require-dev": {
3333
"ext-xml": "*",
3434
"phpunit/phpunit": "^10.0",
35-
"friendsofphp/php-cs-fixer": "^2.16"
35+
"friendsofphp/php-cs-fixer": "3.54.0"
3636
},
3737
"scripts": {
3838
"test": "./vendor/bin/phpunit"

0 commit comments

Comments
 (0)