Skip to content

Commit

Permalink
Merge pull request #557 from ciungulete/phpcsfixer
Browse files Browse the repository at this point in the history
Update php-cs-fixer
  • Loading branch information
sandervanhooft authored Jun 3, 2021
2 parents c1a500d + 64c4c66 commit 32543e4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 35 deletions.
32 changes: 13 additions & 19 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,21 @@ name: Check & fix styling
on: [push]

jobs:
style:
php-cs-fixer:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Fix style
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php_cs --allow-risky=yes
- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.dist.php --allow-risky=yes

- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

- name: Commit changes
uses: stefanzweifel/[email protected]
with:
commit_message: Fix styling
branch: ${{ steps.extract_branch.outputs.branch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
composer.phar
php-scoper.phar
php-scoper.phar.pubkey
.php_cs.cache
.php-cs-fixer.cache
.phpunit.result.cache
23 changes: 9 additions & 14 deletions .php_cs → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
->notPath('bootstrap/*')
->notPath('storage/*')
->notPath('vendor')
->in([
__DIR__ . '/src',
__DIR__ . '/examples',
__DIR__ . '/tests',
])
->name('*.php')
->notPath('bootstrap/*')
->notPath('storage/*')
->notPath('vendor')
->ignoreDotFiles(true)
->ignoreVCS(true);

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'trailing_comma_in_multiline_array' => true,
'trailing_comma_in_multiline' => true,
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
Expand All @@ -29,14 +28,10 @@
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'class_attributes_separation' => [
'elements' => [
'method', 'property',
],
],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
]
],
'single_trait_insert_per_statement' => true,
])
->setFinder($finder);
->setFinder($finder);
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"require-dev": {
"eloquent/liberator": "^2.0",
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.1 || ^8.5",
"friendsofphp/php-cs-fixer": "^v2.17"
"friendsofphp/php-cs-fixer": "^3.0"
},
"suggest": {
"mollie/oauth2-mollie-php": "Use OAuth to authenticate with the Mollie API. This is needed for some endpoints. Visit https://docs.mollie.com/ for more information."
Expand Down

0 comments on commit 32543e4

Please sign in to comment.