Skip to content

Commit

Permalink
fix: update php-cs-fixer version and use it in CI (#14)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Strobotti authored Apr 30, 2024
1 parent 4ae5aa6 commit 57b5136
Show file tree
Hide file tree
Showing 13 changed files with 3,662 additions and 37 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ jobs:
timeout-minutes: 5

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'

- name: Checkout
uses: actions/checkout@v4

Expand Down Expand Up @@ -38,6 +43,11 @@ jobs:
- dependency-validation

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'

- name: Checkout
uses: actions/checkout@v4

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

- name: Run PHPUnit
run: php -d xdebug.mode=coverage ./vendor/bin/phpunit
run: make test-unit

- name: Run php-cs-fixer
run: make php-cs-fixer
5 changes: 5 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ jobs:
name: Semantic Release
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'

- name: Checkout
uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.idea
.DS_Store
.phpunit.result.cache
composer.lock
composer.phar
vendor
coverage.xml
.php_cs.cache
.phpunit.cache
.php-cs-fixer.cache
22 changes: 6 additions & 16 deletions .php_cs.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
<?php

return \PhpCsFixer\Config::create()
use PhpCsFixer\Config;

return (new Config())
->setRiskyAllowed(true)
->setFinder(
\PhpCsFixer\Finder::create()
PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
)
->setRiskyAllowed(true)
->setRules([
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'@DoctrineAnnotation' => true,
'@PHPUnit60Migration:risky' => true,
'native_function_invocation' => true,
'header_comment' => ['header' => ''],
'method_chaining_indentation' => false,
'php_unit_test_class_requires_covers' => false,
])
;
;
9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ You can open [a new issue](https://github.com/Strobotti/php-jwk/issues) once you

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

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

Basic steps:

Expand Down Expand Up @@ -40,9 +40,10 @@ Some guidelines:

### Git Commit Messages

* Use the present tense ("Add feature" not "Added feature")
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
* Limit the first line to 72 characters or less
* 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
* Use the present tense ("add feature" not "added feature")
* Use the imperative mood ("move cursor to..." not "moves cursor to...")
* Limit the first line to 72 characters, or less

## License

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
test-unit:
./vendor/bin/phpunit
php -d xdebug.mode=coverage ./vendor/bin/phpunit

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

php-cs-fixer-fix:
./vendor/bin/php-cs-fixer fix --show-progress dots --config .php_cs.php
./vendor/bin/php-cs-fixer fix --verbose --show-progress none --config .php_cs.php
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"require-dev": {
"ext-xml": "*",
"phpunit/phpunit": "^10.0",
"friendsofphp/php-cs-fixer": "^2.16"
"friendsofphp/php-cs-fixer": "3.54.0"
},
"scripts": {
"test": "./vendor/bin/phpunit"
Expand Down
Loading

0 comments on commit 57b5136

Please sign in to comment.