From 45eda99ba30a42bb6f6dd65ad8bd0386ee71f22a Mon Sep 17 00:00:00 2001 From: jo Date: Wed, 15 Sep 2021 14:07:26 +0200 Subject: [PATCH] Add php-cs-fixer setup Exclude propel generated files from php-cs-fixer --- legacy/.gitignore | 4 ++++ legacy/.php-cs-fixer.php | 15 +++++++++++++++ legacy/Makefile | 9 ++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 legacy/.php-cs-fixer.php diff --git a/legacy/.gitignore b/legacy/.gitignore index 69471bea6..279935729 100644 --- a/legacy/.gitignore +++ b/legacy/.gitignore @@ -8,6 +8,10 @@ /tests/results.html /tests/test_results.xml +# Tools +/tools/ +.php-cs-fixer.cache + ## Github Composer .gitignore ## See https://github.com/github/gitignore/blob/master/Composer.gitignore ################################################################################ diff --git a/legacy/.php-cs-fixer.php b/legacy/.php-cs-fixer.php new file mode 100644 index 000000000..7e24cf328 --- /dev/null +++ b/legacy/.php-cs-fixer.php @@ -0,0 +1,15 @@ +in(__DIR__) + ->exclude('application/models/airtime/map') + ->exclude('application/models/airtime/om'); + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PhpCsFixer' => true, + 'concat_space' => ['spacing' => 'one'], + 'ordered_class_elements' => false, + 'yoda_style' => false, +]) + ->setFinder($finder); diff --git a/legacy/Makefile b/legacy/Makefile index 664e1d9d5..3bb5ac27f 100644 --- a/legacy/Makefile +++ b/legacy/Makefile @@ -1,4 +1,4 @@ -.PHONY: build +.PHONY: build php-cs-fixer SHELL = bash @@ -10,3 +10,10 @@ test: vendor build: composer install --no-progress --no-interaction --no-dev + +tools/php-cs-fixer: + mkdir -p tools/php-cs-fixer + composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer + +php-cs-fixer: tools/php-cs-fixer + tools/php-cs-fixer/vendor/bin/php-cs-fixer fix