From 19d46fc916bc90251068e21a66010cb0d5b7e368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Mon, 24 May 2021 17:05:58 +0200 Subject: [PATCH] PHP CS Fixer 3 --- .github/workflows/ci.yml | 2 +- .gitignore | 2 +- .php_cs.php => .php-cs-fixer.php | 4 ++-- check | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) rename .php_cs.php => .php-cs-fixer.php (98%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2823857..c48d005 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/.gitignore b/.gitignore index d9c3777..a683006 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ package-lock.json composer.lock vendor/ -.php_cs.cache +.php-cs-fixer.cache .vscode/ coverage/ node_modules diff --git a/.php_cs.php b/.php-cs-fixer.php similarity index 98% rename from .php_cs.php rename to .php-cs-fixer.php index 4841dd7..3ac1448 100644 --- a/.php_cs.php +++ b/.php-cs-fixer.php @@ -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 @@ -137,7 +137,7 @@ ->ignoreDotFiles(true) ->ignoreVCS(true); -return Config::create() +return (new Config()) ->setFinder($finder) ->setRules($rules) ->setRiskyAllowed(true) diff --git a/check b/check index c437764..3d24b54 100755 --- a/check +++ b/check @@ -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