1
1
<?php
2
- https://github.com/TYPO3/TYPO3.CMS/blob/5d3f7751abf1914d219554ce8e72105944208c77/Build/.php_cs
3
2
4
- if (PHP_SAPI !== 'cli ' ) {
5
- die ('This script supports command line usage only. Please check your command. ' );
6
- }
7
- // Define in which folders to search and which folders to exclude
8
- // Exclude some directories that are excluded by Git anyways to speed up the sniffing
9
- $ finder = PhpCsFixer \Finder::create ()
10
- ->exclude ('vendor ' )
11
- ->exclude ('Configuration ' )
12
- ->in (__DIR__ );
3
+ declare (strict_types=1 );
13
4
14
- // https://github.com/TYPO3/TYPO3.CMS/blob/5d3f7751abf1914d219554ce8e72105944208c77/Build/.php_cs
15
5
// Return a Code Sniffing configuration using
16
- // all sniffers needed for PSR-2
6
+ // all sniffers needed for PER
17
7
// and additionally:
18
8
// - Remove leading slashes in use clauses.
19
9
// - PHP single-line arrays should not have trailing comma.
20
10
// - Single-line whitespace before closing semicolon are prohibited.
21
11
// - Remove unused use statements in the PHP source code
22
12
// - Ensure Concatenation to have at least one whitespace around
23
13
// - Remove trailing whitespace at the end of blank lines.
24
- return PhpCsFixer \Config::create ()
14
+ return (new \PhpCsFixer \Config ())
15
+ ->setFinder (
16
+ (new PhpCsFixer \Finder ())
17
+ ->ignoreVCSIgnored (true )
18
+ ->in (__DIR__ )
19
+ )
25
20
->setRiskyAllowed (true )
26
21
->setRules ([
27
22
'@DoctrineAnnotation ' => true ,
28
- '@PSR2 ' => true ,
23
+ '@PER ' => true ,
29
24
'array_syntax ' => ['syntax ' => 'short ' ],
30
- 'blank_line_after_opening_tag ' => true ,
31
- 'braces ' => ['allow_single_line_closure ' => true ],
32
25
'cast_spaces ' => ['space ' => 'none ' ],
33
- 'compact_nullable_typehint ' => true ,
34
26
'concat_space ' => ['spacing ' => 'one ' ],
35
27
'declare_equal_normalize ' => ['space ' => 'none ' ],
28
+ 'declare_parentheses ' => true ,
36
29
'dir_constant ' => true ,
30
+ 'function_to_constant ' => ['functions ' => ['get_called_class ' , 'get_class ' , 'get_class_this ' , 'php_sapi_name ' , 'phpversion ' , 'pi ' ]],
37
31
'function_typehint_space ' => true ,
38
- 'hash_to_slash_comment ' => true ,
39
- 'lowercase_cast ' => true ,
40
- 'method_argument_space ' => ['on_multiline ' => 'ensure_fully_multiline ' ],
32
+ 'modernize_strpos ' => true ,
41
33
'modernize_types_casting ' => true ,
42
34
'native_function_casing ' => true ,
43
- 'new_with_braces ' => true ,
44
35
'no_alias_functions ' => true ,
45
36
'no_blank_lines_after_phpdoc ' => true ,
46
37
'no_empty_phpdoc ' => true ,
47
38
'no_empty_statement ' => true ,
48
- 'no_extra_consecutive_blank_lines ' => true ,
49
- 'no_leading_import_slash ' => true ,
39
+ 'no_extra_blank_lines ' => true ,
50
40
'no_leading_namespace_whitespace ' => true ,
51
41
'no_null_property_initialization ' => true ,
52
42
'no_short_bool_cast ' => true ,
53
43
'no_singleline_whitespace_before_semicolons ' => true ,
54
44
'no_superfluous_elseif ' => true ,
55
- 'no_trailing_comma_in_singleline_array ' => true ,
45
+ 'no_trailing_comma_in_singleline ' => true ,
56
46
'no_unneeded_control_parentheses ' => true ,
57
47
'no_unused_imports ' => true ,
58
48
'no_useless_else ' => true ,
59
- 'no_whitespace_in_blank_line ' => true ,
60
- 'ordered_imports ' => true ,
61
- 'php_unit_construct ' => ['assertEquals ' , 'assertSame ' , 'assertNotEquals ' , 'assertNotSame ' ],
49
+ 'no_useless_nullsafe_operator ' => true ,
50
+ 'ordered_imports ' => [ ' imports_order ' => [ ' class ' , ' function ' , ' const ' ], ' sort_algorithm ' => ' alpha ' ] ,
51
+ 'php_unit_construct ' => ['assertions ' => [ ' assertEquals ' , 'assertSame ' , 'assertNotEquals ' , 'assertNotSame ' ] ],
62
52
'php_unit_mock_short_will_return ' => true ,
63
53
'php_unit_test_case_static_method_calls ' => ['call_type ' => 'self ' ],
64
54
'phpdoc_no_access ' => true ,
70
60
'phpdoc_types_order ' => ['null_adjustment ' => 'always_last ' , 'sort_algorithm ' => 'none ' ],
71
61
'return_type_declaration ' => ['space_before ' => 'none ' ],
72
62
'single_quote ' => true ,
73
- 'single_trait_insert_per_statement ' => true ,
74
- 'whitespace_after_comma_in_array ' => true ,
75
- ])
76
- ->setFinder ($ finder );
63
+ 'single_space_around_construct ' => true ,
64
+ 'single_line_comment_style ' => ['comment_types ' => ['hash ' ]],
65
+ 'whitespace_after_comma_in_array ' => ['ensure_single_space ' => true ],
66
+ 'yoda_style ' => ['equal ' => false , 'identical ' => false , 'less_and_greater ' => false ],
67
+ ]);
0 commit comments