Add cs-fixer infrastructure like other apps

This commit is contained in:
Phil Davis 2020-02-18 08:47:39 +05:45
parent a16151eb46
commit 0455e70ffe
4 changed files with 25 additions and 2 deletions

3
.gitignore vendored
View file

@ -20,3 +20,6 @@ vendor
# IDE # IDE
nbproject nbproject
# Tests
.php_cs.cache

12
.php_cs.dist Normal file
View file

@ -0,0 +1,12 @@
<?php
$config = PhpCsFixer\Config::create();
$config->getFinder()
->exclude('vendor')
->in(__DIR__);
$config->setRules([
'@PSR1' => true,
'@Symfony' => true
]);
return $config;

View file

@ -40,7 +40,7 @@ before_script:
script: script:
- if [ $RUN_PHPSTAN == "FALSE" ]; then find Core -name "*.php" | xargs -n1 php -l; fi - if [ $RUN_PHPSTAN == "FALSE" ]; then find Core -name "*.php" | xargs -n1 php -l; fi
- if [ $RUN_PHPSTAN == "FALSE" ]; then ./vendor/bin/sabre-cs-fixer fix . --dry-run --diff; fi - if [ $RUN_PHPSTAN == "FALSE" ]; then php vendor/bin/php-cs-fixer fix --dry-run --diff; fi
- if [ $RUN_PHPSTAN == "TRUE" ]; then php vendor/bin/phpstan.phar analyse Core html; fi - if [ $RUN_PHPSTAN == "TRUE" ]; then php vendor/bin/phpstan.phar analyse Core html; fi
cache: cache:

View file

@ -19,7 +19,7 @@
"symfony/yaml" : "^3.4" "symfony/yaml" : "^3.4"
}, },
"require-dev" : { "require-dev" : {
"sabre/cs" : "~0.0.6" "friendsofphp/php-cs-fixer": "~2.16.1"
}, },
"replace" : { "replace" : {
"jeromeschneider/baikal" : "self.version" "jeromeschneider/baikal" : "self.version"
@ -33,5 +33,13 @@
}, },
"support" : { "support" : {
"source" : "https://github.com/sabre-io/Baikal" "source" : "https://github.com/sabre-io/Baikal"
},
"scripts": {
"cs-fixer": [
"php-cs-fixer fix"
],
"test": [
"composer cs-fixer"
]
} }
} }