Skip to content

Commit

Permalink
Update php cs fixer (#29)
Browse files Browse the repository at this point in the history
* Update php-cs-fixer

* Fix styling

Co-authored-by: ciungulete <[email protected]>
  • Loading branch information
ciungulete and ciungulete authored Jun 8, 2021
1 parent f41a45a commit 70d5156
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 34 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
1 change: 1 addition & 0 deletions .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"php":"8.0.5","version":"3.0.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":{"elements":["method","property"]},"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"ordered_imports":{"sort_algorithm":"alpha"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"single_trait_insert_per_statement":true},"hashes":{"src\/Invoice.php":2278568339,"src\/MoneyFormatter.php":1206229440,"src\/IsInvoicable\/IsInvoicableTrait.php":1957151012,"src\/InvoicableServiceProvider.php":672820863,"src\/InvoiceLine.php":3758312924,"src\/InvoiceReferenceGenerator.php":7251896,"config\/invoicable.php":47350322,"tests\/Feature\/InvoiceTest.php":1299334751,"tests\/AbstractTestCase.php":2619638986,"tests\/TestModel.php":482200789,"tests\/CreateTestModelsTable.php":2612826604,"tests\/Unit\/InvoiceReferenceTest.php":240943663,"tests\/Unit\/MoneyFormatterTest.php":1490742050,"database\/migrations\/2017_06_17_163005_create_invoices_tables.php":1842077571}}
20 changes: 5 additions & 15 deletions .php_cs → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
->notPath('vendor')
->in([
__DIR__ . '/src',
__DIR__ . '/config',
Expand All @@ -13,16 +11,14 @@
->ignoreDotFiles(true)
->ignoreVCS(true);

$config = new PhpCsFixer\Config();
$config
->setRiskyAllowed(true)
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 @@ -31,16 +27,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);

return $config;

0 comments on commit 70d5156

Please sign in to comment.