Skip to content

Commit

Permalink
PHP CS Fixer 3
Browse files Browse the repository at this point in the history
  • Loading branch information
stancl committed May 24, 2021
1 parent 3b203d7 commit 19d46fc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Install php-cs-fixer
run: composer global require friendsofphp/php-cs-fixer
- name: Run php-cs-fixer
run: $HOME/.composer/vendor/bin/php-cs-fixer fix --config=.php_cs.php
run: $HOME/.composer/vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php
- name: Commit changes from php-cs-fixer
uses: EndBug/add-and-commit@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package-lock.json
composer.lock
vendor/
.php_cs.cache
.php-cs-fixer.cache
.vscode/
coverage/
node_modules
4 changes: 2 additions & 2 deletions .php_cs.php → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
'linebreak_after_opening_tag' => true,
'line_ending' => true,
'lowercase_cast' => true,
'lowercase_constants' => true,
'constant_case' => true,
'lowercase_keywords' => true,
'lowercase_static_reference' => true, // added from Symfony
'magic_method_casing' => true, // added from Symfony
Expand Down Expand Up @@ -137,7 +137,7 @@
->ignoreDotFiles(true)
->ignoreVCS(true);

return Config::create()
return (new Config())
->setFinder($finder)
->setRules($rules)
->setRiskyAllowed(true)
Expand Down
8 changes: 4 additions & 4 deletions check
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ offer_run() {
exit 1
}

if (php-cs-fixer fix --dry-run --config=.php_cs.php > /dev/null 2>/dev/null); then
if (php-cs-fixer fix --dry-run --config=.php-cs-fixer.php > /dev/null 2>/dev/null); then
echo '✅ php-cs-fixer OK'
else
read -p "⚠️ php-cs-fixer found issues. Fix (Y/n)? " fix
case ${fix:0:1} in
n|N )
echo '❌ php-cs-fixer FAIL'
offer_run 'php-cs-fixer fix --config=.php_cs.php'
offer_run 'php-cs-fixer fix --config=.php-cs-fixer.php'
;;
* )
if (php-cs-fixer fix --config=.php_cs.php > /dev/null 2>/dev/null); then
if (php-cs-fixer fix --config=.php-cs-fixer.php > /dev/null 2>/dev/null); then
echo '✅ php-cs-fixer OK'
else
echo '❌ php-cs-fixer FAIL'
offer_run 'php-cs-fixer fix --config=.php_cs.php'
offer_run 'php-cs-fixer fix --config=.php-cs-fixer.php'
fi
;;
esac
Expand Down

0 comments on commit 19d46fc

Please sign in to comment.