Skip to content

Commit

Permalink
🔀 Merge pull request #111 from Kristories/improvements
Browse files Browse the repository at this point in the history
Implement #110
  • Loading branch information
mychidarko authored Jan 11, 2022
2 parents ab03fd2 + fbd9ae4 commit 24d68f9
Show file tree
Hide file tree
Showing 17 changed files with 1,018 additions and 943 deletions.
9 changes: 5 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

/.github export-ignore
/tests export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
phpunit.xml export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml export-ignore
/.php_cs.dist.php export-ignore
23 changes: 23 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check & fix styling

on: [push]

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

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

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

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
.composer
composer.lock
package-lock.json
.phpunit.result.cache
.php-cs-fixer.cache
vendor/
test/

Expand All @@ -14,4 +16,4 @@ Thumbs.db
*.swp

# phpstorm
.idea/*
.idea/*
34 changes: 34 additions & 0 deletions .php_cs.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'no_unused_imports' => true,
'not_operator_with_successor_space' => false,
'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,
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
],
'single_trait_insert_per_statement' => true,
])
->setFinder($finder);
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
"leafs/anchor": "^1.1"
},
"require-dev": {
"pestphp/pest": "^1.21"
}
}
"pestphp/pest": "^1.21",
"friendsofphp/php-cs-fixer": "^3.0"
},
"scripts": {
"format": "vendor/bin/php-cs-fixer fix --config=.php_cs.dist.php --allow-risky=yes",
"test": "vendor/bin/pest"
}
}
Loading

0 comments on commit 24d68f9

Please sign in to comment.