1
0
Fork 0
mirror of https://github.com/archtechx/laravel-seo.git synced 2025-12-12 01:44:03 +00:00

PHP CS Fixer 3

This commit is contained in:
Samuel Štancl 2021-05-24 17:05:58 +02:00
parent 3b203d70ff
commit 19d46fc916
4 changed files with 8 additions and 8 deletions

View file

@ -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:

2
.gitignore vendored
View file

@ -2,7 +2,7 @@
package-lock.json
composer.lock
vendor/
.php_cs.cache
.php-cs-fixer.cache
.vscode/
coverage/
node_modules

View file

@ -42,7 +42,7 @@ $rules = [
'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
@ -137,7 +137,7 @@ $finder = Finder::create()
->ignoreDotFiles(true)
->ignoreVCS(true);
return Config::create()
return (new Config())
->setFinder($finder)
->setRules($rules)
->setRiskyAllowed(true)

8
check
View file

@ -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