Skip to content

Commit a7971af

Browse files
committed
🔧 Optimized php-cs-fixer configuration
1 parent 7933db4 commit a7971af

File tree

1 file changed

+36
-24
lines changed

1 file changed

+36
-24
lines changed

‎.php-cs-fixer.dist.php

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,39 @@
11
<?php
22

3-
$finder = Symfony\Component\Finder\Finder::create()
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
$rules = [
7+
'@PSR2' => true,
8+
'array_indentation' => true,
9+
'array_syntax' => ['syntax' => 'short'],
10+
'binary_operator_spaces' => true,
11+
'blank_line_before_statement' => [
12+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
13+
],
14+
'class_attributes_separation' => [
15+
'elements' => ['const' => 'one','method' => 'one','property' => 'one'],
16+
],
17+
'concat_space' => ['spacing' => 'one'],
18+
'method_argument_space' => [
19+
'on_multiline' => 'ensure_fully_multiline',
20+
'keep_multiple_spaces_after_comma' => true,
21+
],
22+
'method_chaining_indentation' => true,
23+
'no_unused_imports' => true,
24+
'not_operator_with_successor_space' => false,
25+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
26+
'phpdoc_scalar' => true,
27+
'phpdoc_single_line_var_spacing' => true,
28+
'phpdoc_var_without_name' => true,
29+
'return_type_declaration' => true,
30+
'single_quote' => true,
31+
'single_trait_insert_per_statement' => true,
32+
'trailing_comma_in_multiline' => true,
33+
'unary_operator_spaces' => true,
34+
];
35+
36+
$finder = Finder::create()
437
->in([
538
__DIR__ . '/src',
639
__DIR__ . '/tests',
@@ -10,27 +43,6 @@
1043
->ignoreDotFiles(true)
1144
->ignoreVCS(true);
1245

13-
return (new PhpCsFixer\Config())
14-
->setRules([
15-
'@PSR2' => true,
16-
'array_syntax' => ['syntax' => 'short'],
17-
'ordered_imports' => ['sort_algorithm' => 'alpha'],
18-
'no_unused_imports' => true,
19-
'not_operator_with_successor_space' => false,
20-
'trailing_comma_in_multiline' => true,
21-
'phpdoc_scalar' => true,
22-
'unary_operator_spaces' => true,
23-
'binary_operator_spaces' => true,
24-
'blank_line_before_statement' => [
25-
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
26-
],
27-
'phpdoc_single_line_var_spacing' => true,
28-
'phpdoc_var_without_name' => true,
29-
'method_argument_space' => [
30-
'on_multiline' => 'ensure_fully_multiline',
31-
'keep_multiple_spaces_after_comma' => true,
32-
],
33-
'single_trait_insert_per_statement' => true,
34-
'single_quote' => true,
35-
])
46+
return (new Config())
47+
->setRules($rules)
3648
->setFinder($finder);

0 commit comments

Comments
 (0)