Skip to content

Commit

Permalink
Use php-cs-fixer only.
Browse files Browse the repository at this point in the history
Apply cs fixes.
Update travis and scrutinizer configs.
  • Loading branch information
kamalkhan committed Mar 15, 2018
1 parent 6e73709 commit b103ee6
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 1,339 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
/.php_cs.cache
/coverage
/coverage.xml
/vendor
41 changes: 41 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

$header = <<<'EOF'
This file is part of bhittani/repository.
(c) Kamal Khan <[email protected]>
This source file is subject to the MIT license that
is bundled with this source code in the file LICENSE.
EOF;

return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'combine_consecutive_unsets' => true,
'header_comment' => ['header' => $header],
'heredoc_to_nowdoc' => true,
'no_extra_consecutive_blank_lines' => [
'break',
'continue',
'extra',
'return',
'throw',
'use',
'parenthesis_brace_block',
'square_brace_block',
'curly_brace_block'
],
'not_operator_with_successor_space' => true,
'no_short_echo_tag' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => ['sortAlgorithm' => 'length'],
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'single_line_after_imports' => true,
])->setFinder(PhpCsFixer\Finder::create()->in(__DIR__ . '/src'))
;
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build:
tests:
override:
-
command: composer ci
command: composer coverage-clover
coverage:
file: coverage.xml
format: php-clover
Expand Down
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ php: 5.5
matrix:
include:
- php: 5.5
env: CS_CHECK=true COVERAGE=true
env: CS_CHECK=1 COVERAGE=1
- php: 5.6
- php: 7.0
- php: 7.1
- php: 7.2

before_script: composer install
before_script:
- composer install --ignore-platform-reqs

script:
- |
Expand All @@ -33,7 +34,7 @@ script:

after_success:
- |
if [[ "$COVERAGE" != "" ]]; then
if [[ "$COVERAGE" != "" && "$CODACY_PROJECT_TOKEN" != "" ]]; then
composer require codacy/coverage --dev
composer coverage-clover
php vendor/bin/codacycoverage clover coverage.xml
Expand Down
16 changes: 10 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,24 @@
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"platform": {
"php": "5.5.9"
}
},
"require": {
"php": ">=5.5,<8.0-DEV"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"symplify/easy-coding-standard": "2.5"
"friendsofphp/php-cs-fixer": "^2.2"
},
"scripts": {
"test": "phpunit --colors=always",
"test-with-coverage": "phpunit --colors=always --coverage-clover coverage.xml",
"cs-check": "vendor/bin/ecs check src --config ecs.neon",
"cs-fix": "vendor/bin/ecs check src --config ecs.neon --fix",
"check": ["@cs-check", "@test"],
"ci": ["@cs-check", "test-with-coverage"]
"coverage-clover": "phpunit --colors=always --coverage-clover coverage.xml",
"cs-check": "php-cs-fixer fix --dry-run --using-cache=no",
"cs-fix": "php-cs-fixer fix --using-cache=no",
"check": ["@cs-check", "@test"]
},
"repositories": [
{ "packagist": false },
Expand Down
Loading

0 comments on commit b103ee6

Please sign in to comment.