Skip to content

Commit 9671516

Browse files
committed
Use phootwork cs-fixer
1 parent a29120b commit 9671516

File tree

6 files changed

+18
-57
lines changed

6 files changed

+18
-57
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ vendor/
44
coverage/
55
cache/
66
api/
7+
.php_cs.cache

.php_cs

+9-52
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,13 @@
11
<?php
2-
use Symfony\CS\Config\Config;
3-
use Symfony\CS\Finder\DefaultFinder;
4-
use Symfony\CS\Fixer\Contrib\HeaderCommentFixer;
5-
use Symfony\CS\FixerInterface;
62

7-
$finder = DefaultFinder::create()
8-
->exclude('fixtures')
3+
$config = new phootwork\fixer\Config();
4+
$config->getFinder()
5+
->exclude(['fixtures'])
96
->in(__DIR__ . '/src')
10-
->in(__DIR__ . '/tests')
11-
;
7+
->in(__DIR__ . '/tests');
128

13-
return Config::create()
14-
->level(FixerInterface::NONE_LEVEL)
15-
->finder($finder)
16-
->setUsingLinter(true)
17-
->setUsingCache(false)
18-
->fixers([
19-
'encoding',
20-
'short_tag',
21-
'eof_ending',
22-
'function_call_space',
23-
'function_declaration',
24-
'line_after_namespace',
25-
'linefeed',
26-
'lowercase_constants',
27-
'lowercase_keywords',
28-
'method_argument_space',
29-
'multiple_use',
30-
'parenthesis',
31-
'php_closing_tag',
32-
'single_line_after_imports',
33-
'trailing_spaces',
34-
'visibility',
35-
'array_element_no_space_before_comma',
36-
'array_element_white_space_after_comma',
37-
'double_arrow_multiline_whitespaces',
38-
'duplicate_semicolon',
39-
'extra_empty_lines',
40-
'function_typehint_space',
41-
'namespace_no_leading_whitespace',
42-
'no_empty_lines_after_phpdocs',
43-
'phpdoc_scalar',
44-
'phpdoc_types',
45-
'remove_leading_slash_use',
46-
'remove_lines_between_uses',
47-
'self_accessor',
48-
'single_array_no_trailing_comma',
49-
'single_quote',
50-
'unused_use',
51-
'whitespacy_lines',
52-
'concat_with_spaces',
53-
'ordered_use',
54-
'short_array_syntax',
55-
])
56-
;
9+
$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;
10+
11+
$config->setCacheFile($cacheDir . '/.php_cs.cache');
12+
13+
return $config;

composer.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@
3838
},
3939
"require-dev" : {
4040
"phpunit/phpunit" : "^5.7",
41-
"sami/sami" : "^4|^3"
41+
"sami/sami" : "^4|^3",
42+
"phootwork/php-cs-fixer-config" : "~0.1"
4243
},
4344
"scripts" : {
45+
"check" : "@cs",
46+
"cs" : "php-cs-fixer fix -v --diff --dry-run",
47+
"cs-fix" : "php-cs-fixer fix -v --diff",
4448
"test" : "phpunit",
4549
"api" : "sami.php update sami.php"
4650
}
47-
}
51+
}

src/FormatterCli.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
namespace gossi\formatter;
33

4+
use gossi\formatter\commands\FormatterCommand;
45
use Symfony\Component\Console\Application;
56
use Symfony\Component\Console\Input\InputInterface;
6-
use gossi\formatter\commands\FormatterCommand;
77

88
class FormatterCli extends Application {
99

src/formatters/BaseFormatter.php

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use phootwork\tokenizer\Token;
1010
use phootwork\tokenizer\TokenVisitorInterface;
1111

12-
1312
class BaseFormatter implements TokenVisitorInterface {
1413

1514
/** @var Parser */

tests/parser/ContextTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function testGroupStack() {
111111
// if
112112
'context.group_enter block',
113113
'context.group_leave block',
114-
// for
114+
// for
115115
'context.group_enter block',
116116
'context.group_leave block',
117117
// call

0 commit comments

Comments
 (0)