Skip to content

Commit b06dd78

Browse files
committed
php-cs-fixer config
1 parent 2ccf8ce commit b06dd78

File tree

2 files changed

+50
-47
lines changed

2 files changed

+50
-47
lines changed

.php_cs

+47-45
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,58 @@
11
<?php
2-
use Symfony\CS\Config\Config;
3-
use Symfony\CS\Finder\DefaultFinder;
4-
use Symfony\CS\Fixer\Contrib\HeaderCommentFixer;
2+
53
use Symfony\CS\FixerInterface;
64

7-
$finder = DefaultFinder::create()
5+
$finder = PhpCsFixer\Finder::create()
86
->exclude(['fixture', 'generated'])
97
->in(__DIR__ . '/src')
108
->in(__DIR__ . '/tests')
119
;
1210

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

composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@
3535
"nikic/php-parser" : "^4.1.0"
3636
},
3737
"require-dev" : {
38-
"phpunit/phpunit" : "^7.4.4"
38+
"phpunit/phpunit" : "^7.4.4",
39+
"friendsofphp/php-cs-fixer": "^2.15"
3940
},
4041
"scripts" : {
4142
"test" : "phpunit",
4243
"api" : "sami.php update sami.php"
4344
}
44-
}
45+
}

0 commit comments

Comments
 (0)