Skip to content

Commit cfd9622

Browse files
committed
switch to packaged cs-config and test check on travis
1 parent ccf8c12 commit cfd9622

File tree

4 files changed

+20
-59
lines changed

4 files changed

+20
-59
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.buildpath
2+
.php_cs.cache
23
phpunit.xml
34
composer.lock
45
vendor/

.php_cs

+9-56
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,13 @@
11
<?php
22

3-
use Symfony\CS\FixerInterface;
4-
5-
$finder = PhpCsFixer\Finder::create()
6-
->exclude(['fixture', 'generated'])
3+
$config = new gossi\fixer\Config();
4+
$config->getFinder()
5+
->exclude(['fixture', 'generated'])
76
->in(__DIR__ . '/src')
8-
->in(__DIR__ . '/tests')
9-
;
7+
->in(__DIR__ . '/tests');
8+
9+
$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;
10+
11+
$config->setCacheFile($cacheDir . '/.php_cs.cache');
1012

11-
return PhpCsFixer\Config::create()
12-
//->level(FixerInterface::NONE_LEVEL)
13-
->setFinder($finder)
14-
//->setUsingLinter(true)
15-
->setUsingCache(false)
16-
->setRules([
17-
'array_syntax' => [
18-
'syntax' => 'short'
19-
],
20-
'blank_line_after_namespace' => true,
21-
'concat_space' => [
22-
'spacing' => 'one'
23-
],
24-
'encoding' => true,
25-
'full_opening_tag' => true,
26-
'function_declaration' => [
27-
'closure_function_spacing' => 'one'
28-
],
29-
'function_typehint_space' => true,
30-
'lowercase_constants' => true,
31-
'lowercase_keywords' => true,
32-
'method_argument_space' => true,
33-
'no_blank_lines_after_phpdoc' => true,
34-
'no_closing_tag' => true,
35-
'no_empty_statement' => true,
36-
'no_extra_blank_lines' => [
37-
'tokens' => ['use', 'extra']
38-
],
39-
'no_leading_import_slash' => true,
40-
'no_leading_namespace_whitespace' => true,
41-
'no_multiline_whitespace_around_double_arrow' => true,
42-
'no_spaces_after_function_name' => true,
43-
'no_spaces_inside_parenthesis' => true,
44-
'no_trailing_comma_in_singleline_array' => true,
45-
'no_trailing_whitespace' => true,
46-
'no_unused_imports' => true,
47-
'no_whitespace_before_comma_in_array' => true,
48-
'no_whitespace_in_blank_line' => true,
49-
'ordered_imports' => true,
50-
'phpdoc_scalar' => true,
51-
'phpdoc_types' => true,
52-
'self_accessor' => true,
53-
'single_blank_line_at_eof' => true,
54-
'single_import_per_statement' => true,
55-
'single_line_after_imports' => true,
56-
'single_quote' => true,
57-
'visibility_required' => true,
58-
'whitespace_after_comma_in_array' => true,
59-
])
60-
;
13+
return $config;

.travis.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ dist: trusty
55
php:
66
- 7.2
77
- 7.3
8-
# - hhvm # broken with nikic/php-parser
8+
9+
cache:
10+
directories:
11+
- $HOME/.php-cs-fixer
912

1013
install:
1114
- composer install
1215

1316
script:
1417
- vendor/bin/phpunit --coverage-clover=coverage.clover
18+
- vendor/bin/php-cs-fixer fix --config=.php_cs --verbose --diff --dry-run
1519

1620
after_script:
1721
- wget https://scrutinizer-ci.com/ocular.phar

composer.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@
3636
},
3737
"require-dev" : {
3838
"phpunit/phpunit" : "^7.4.4",
39-
"friendsofphp/php-cs-fixer": "^2.15"
39+
"gossi/php-cs-fixer-config" : "~0.1"
4040
},
4141
"scripts" : {
42+
"check" : "@cs",
43+
"cs" : "php-cs-fixer fix -v --diff --dry-run",
44+
"cs-fix" : "php-cs-fixer fix -v --diff",
4245
"test" : "phpunit",
4346
"api" : "sami.php update sami.php"
4447
}
45-
}
48+
}

0 commit comments

Comments
 (0)