Skip to content

Commit

Permalink
Added php-cs-fixer to have a consistent code format
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Jan 30, 2016
1 parent fd4ebc0 commit 2294af7
Show file tree
Hide file tree
Showing 22 changed files with 581 additions and 120 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,6 +7,7 @@ shariff-backend-php.tar.gz
### Composer ###
composer.phar
vendor/
.php_cs.cache

# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
Expand Down
23 changes: 23 additions & 0 deletions .php_cs
@@ -0,0 +1,23 @@
<?php

$finder = Symfony\CS\Finder\DefaultFinder::create()
->in(array(__DIR__.'/src'))
->exclude(array('Tests/Fixtures'))
;

return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers(array(
'-unalign_double_arrow',
'-unalign_equals',
'align_double_arrow',
'newline_after_open_tag',
'ordered_use',
'short_array_syntax',
'php_unit_construct',
'php_unit_strict',
'linefeed',
'eof_ending'
))
->setUsingCache(true)
->finder($finder);
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -16,6 +16,7 @@ before_script:
script:
- bash -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then phpcs --standard=PSR2 src/ tests/; fi;'
- vendor/bin/phpunit --coverage-text
- make cs_dry_run

addons:
apt:
Expand Down
5 changes: 5 additions & 0 deletions Makefile
@@ -0,0 +1,5 @@
cs:
vendor/bin/php-cs-fixer fix --verbose

cs_dry_run:
vendor/bin/php-cs-fixer fix --verbose --dry-run
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -25,7 +25,8 @@
"zendframework/zend-config": "*"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
"phpunit/phpunit": "~4.8",
"fabpot/php-cs-fixer": "~0.5|~1.0"
},
"config": {
"optimize-autoloader": true
Expand Down

0 comments on commit 2294af7

Please sign in to comment.