|
1 | 1 | <?php
|
2 | 2 |
|
3 |
| -$finder = PhpCsFixer\Finder::create() |
4 |
| - ->in(__DIR__.'/src') |
5 |
| - ->depth('>= 1') // ignore Kernel.php (and all files in src/*.php) |
6 |
| -; |
| 3 | +// Inspired by https://github.com/jolicode/codingstyle |
| 4 | + |
| 5 | +$header = <<<OEF |
| 6 | +This file is part of the appname project. |
| 7 | +
|
| 8 | +(c) Romain Gautier <mail@romain.sh> |
| 9 | +
|
| 10 | +For the full copyright and license information, please view the LICENSE |
| 11 | +file that was distributed with this source code. |
| 12 | +OEF; |
7 | 13 |
|
8 | 14 | return PhpCsFixer\Config::create()
|
9 | 15 | ->setRiskyAllowed(true)
|
10 | 16 | ->setRules([
|
11 | 17 | '@Symfony' => true,
|
12 | 18 | '@Symfony:risky' => true,
|
13 |
| - 'array_syntax' => [ |
14 |
| - 'syntax' => 'short', |
15 |
| - ], |
16 |
| - 'braces' => [ |
17 |
| - 'allow_single_line_closure' => true, |
18 |
| - ], |
19 |
| - 'modernize_types_casting' => true, |
20 |
| - // 'native_function_invocation' => true, |
| 19 | + 'header_comment' => ['header' => $header], |
| 20 | + 'array_syntax' => ['syntax' => 'short'], |
| 21 | + 'ordered_class_elements' => true, |
| 22 | + 'ordered_imports' => true, |
| 23 | + 'heredoc_to_nowdoc' => true, |
| 24 | + 'php_unit_strict' => true, |
| 25 | + 'php_unit_construct' => true, |
| 26 | + 'phpdoc_add_missing_param_annotation' => true, |
| 27 | + 'phpdoc_order' => true, |
| 28 | + 'strict_comparison' => true, |
| 29 | + 'strict_param' => true, |
21 | 30 | 'no_extra_consecutive_blank_lines' => [
|
22 | 31 | 'break',
|
23 | 32 | 'continue',
|
24 |
| - 'curly_brace_block', |
25 | 33 | 'extra',
|
26 |
| - 'parenthesis_brace_block', |
27 | 34 | 'return',
|
28 |
| - 'square_brace_block', |
29 | 35 | 'throw',
|
30 | 36 | 'use',
|
| 37 | + 'parenthesis_brace_block', |
| 38 | + 'square_brace_block', |
| 39 | + 'curly_brace_block', |
31 | 40 | ],
|
| 41 | + 'no_short_echo_tag' => true, |
32 | 42 | 'no_unreachable_default_argument_value' => true,
|
33 | 43 | 'no_useless_else' => true,
|
34 | 44 | 'no_useless_return' => true,
|
35 |
| - 'ordered_imports' => true, |
36 |
| - // 'phpdoc_add_missing_param_annotation' => [ |
37 |
| - // 'only_untyped' => false, |
38 |
| - // ], |
39 |
| - 'phpdoc_order' => true, |
40 |
| - 'psr4' => true, |
41 | 45 | 'semicolon_after_instruction' => true,
|
42 |
| - 'strict_comparison' => true, |
43 |
| - 'strict_param' => true, |
| 46 | + 'combine_consecutive_unsets' => true, |
44 | 47 | 'ternary_to_null_coalescing' => true,
|
45 | 48 | ])
|
46 |
| - ->setFinder($finder) |
47 |
| - ->setCacheFile(__DIR__.'/var/.php_cs.cache') |
| 49 | + ->setFinder( |
| 50 | + PhpCsFixer\Finder::create() |
| 51 | + ->in('src') |
| 52 | + ) |
48 | 53 | ;
|
0 commit comments