11
11
* @see https://code.shin.company/defer-wordpress/
12
12
*/
13
13
14
- use PhpCsFixer \Config ;
15
- use PhpCsFixer \Finder ;
16
-
17
14
$ header = <<<'EOF'
18
15
🔌 A Wordpress plugin integrating my beloved "defer.js" library
19
16
into your websites. Hope you guys like it.
@@ -25,95 +22,86 @@ $header = <<<'EOF'
25
22
@see https://code.shin.company/defer-wordpress/
26
23
EOF;
27
24
28
- $ rules = array (
29
- '@PHP56Migration ' => true ,
30
- '@PHP70Migration ' => true ,
31
- '@PHP71Migration ' => true ,
32
- '@Symfony ' => true ,
33
- '@PSR2 ' => true ,
34
- 'align_multiline_comment ' => true ,
35
- 'array_indentation ' => true ,
36
- 'array_syntax ' => array ('syntax ' => 'long ' ),
37
- 'combine_consecutive_issets ' => true ,
38
- 'combine_consecutive_unsets ' => true ,
39
- 'compact_nullable_typehint ' => true ,
40
- 'concat_space ' => array ('spacing ' => 'one ' ),
41
- 'escape_implicit_backslashes ' => true ,
42
- 'explicit_indirect_variable ' => true ,
43
- 'explicit_string_variable ' => true ,
44
- 'fully_qualified_strict_types ' => true ,
45
- 'header_comment ' => array ('header ' => $ header , 'comment_type ' => 'PHPDoc ' , 'location ' => 'after_open ' , 'separate ' => 'both ' ),
46
- 'heredoc_to_nowdoc ' => true ,
47
- 'increment_style ' => array ('style ' => 'post ' ),
48
- 'list_syntax ' => array ('syntax ' => 'long ' ),
49
- 'method_argument_space ' => array ('on_multiline ' => 'ensure_fully_multiline ' ),
50
- 'method_chaining_indentation ' => true ,
51
- 'multiline_comment_opening_closing ' => true ,
52
- 'native_function_invocation ' => false ,
53
- 'no_alternative_syntax ' => true ,
54
- 'no_blank_lines_before_namespace ' => false ,
55
- 'no_binary_string ' => true ,
56
- 'no_empty_phpdoc ' => true ,
57
- 'no_null_property_initialization ' => true ,
58
- 'no_short_echo_tag ' => true ,
59
- 'no_superfluous_elseif ' => true ,
60
- 'no_unneeded_curly_braces ' => true ,
61
- 'no_unneeded_final_method ' => true ,
62
- 'no_useless_else ' => true ,
63
- 'no_useless_return ' => true ,
64
- 'ordered_class_elements ' => true ,
65
- 'ordered_imports ' => true ,
66
- 'php_unit_internal_class ' => true ,
67
- 'php_unit_ordered_covers ' => true ,
68
- 'php_unit_test_class_requires_covers ' => true ,
69
- 'phpdoc_add_missing_param_annotation ' => true ,
70
- 'phpdoc_order ' => true ,
71
- 'phpdoc_separation ' => false ,
72
- 'phpdoc_summary ' => false ,
73
- 'phpdoc_trim_consecutive_blank_line_separation ' => true ,
74
- 'phpdoc_types_order ' => true ,
75
- 'return_assignment ' => false ,
76
- 'semicolon_after_instruction ' => true ,
77
- 'single_line_comment_style ' => false ,
78
- 'single_quote ' => true ,
79
- 'yoda_style ' => false ,
80
-
81
- 'blank_line_before_statement ' => array (
82
- 'statements ' => array (
25
+ $ rules = [
26
+ '@Symfony ' => true ,
27
+ '@PSR2 ' => true ,
28
+ 'align_multiline_comment ' => true ,
29
+ 'array_indentation ' => true ,
30
+ 'array_syntax ' => ['syntax ' => 'long ' ],
31
+ 'braces ' => ['allow_single_line_closure ' => true ],
32
+ 'combine_consecutive_issets ' => true ,
33
+ 'combine_consecutive_unsets ' => true ,
34
+ 'compact_nullable_typehint ' => true ,
35
+ 'concat_space ' => ['spacing ' => 'one ' ],
36
+ 'escape_implicit_backslashes ' => true ,
37
+ 'explicit_indirect_variable ' => true ,
38
+ 'explicit_string_variable ' => true ,
39
+ 'fully_qualified_strict_types ' => true ,
40
+ 'header_comment ' => ['header ' => $ header , 'comment_type ' => 'PHPDoc ' ],
41
+ 'heredoc_to_nowdoc ' => true ,
42
+ 'increment_style ' => ['style ' => 'post ' ],
43
+ 'list_syntax ' => ['syntax ' => 'long ' ],
44
+ 'method_argument_space ' => ['on_multiline ' => 'ensure_fully_multiline ' ],
45
+ 'method_chaining_indentation ' => true ,
46
+ 'multiline_comment_opening_closing ' => true ,
47
+ 'native_function_invocation ' => false ,
48
+ 'no_alternative_syntax ' => true ,
49
+ 'no_blank_lines_before_namespace ' => false ,
50
+ 'no_binary_string ' => true ,
51
+ 'no_empty_phpdoc ' => true ,
52
+ 'no_null_property_initialization ' => true ,
53
+ 'no_short_echo_tag ' => true ,
54
+ 'no_superfluous_elseif ' => true ,
55
+ 'no_unneeded_curly_braces ' => true ,
56
+ 'no_useless_else ' => true ,
57
+ 'no_useless_return ' => true ,
58
+ 'ordered_class_elements ' => true ,
59
+ 'ordered_imports ' => true ,
60
+ 'php_unit_internal_class ' => true ,
61
+ 'php_unit_ordered_covers ' => true ,
62
+ 'php_unit_test_class_requires_covers ' => true ,
63
+ 'phpdoc_add_missing_param_annotation ' => true ,
64
+ 'phpdoc_order ' => true ,
65
+ 'phpdoc_separation ' => false ,
66
+ 'phpdoc_summary ' => false ,
67
+ 'phpdoc_types_order ' => true ,
68
+ 'return_assignment ' => false ,
69
+ 'semicolon_after_instruction ' => true ,
70
+ 'single_line_comment_style ' => false ,
71
+ 'single_quote ' => true ,
72
+ 'yoda_style ' => false ,
73
+ 'blank_line_before_statement ' => [
74
+ 'statements ' => [
83
75
'continue ' , 'declare ' , 'return ' , 'throw ' , 'try ' ,
84
76
'declare ' , 'for ' , 'foreach ' , 'goto ' , 'if ' ,
85
- ) ,
86
- ) ,
87
- 'no_extra_blank_lines ' => array (
88
- 'tokens ' => array (
77
+ ] ,
78
+ ] ,
79
+ 'no_extra_blank_lines ' => [
80
+ 'tokens ' => [
89
81
'continue ' , 'extra ' , 'return ' , 'throw ' , 'use ' ,
90
82
'parenthesis_brace_block ' , 'square_brace_block ' , 'curly_brace_block ' ,
91
- ),
92
- ),
93
- 'braces ' => array (
94
- 'allow_single_line_closure ' => true ,
95
- ),
96
- 'binary_operator_spaces ' => array (
83
+ ],
84
+ ],
85
+ 'binary_operator_spaces ' => [
97
86
'default ' => 'single_space ' ,
98
- 'operators ' => array (
99
- '=> ' => 'align_single_space ' ,
100
- '= ' => 'align_single_space ' ,
101
- ) ,
102
- ) ,
103
- ) ;
87
+ 'operators ' => [
88
+ '= ' => 'align_single_space_minimal ' ,
89
+ '=> ' => 'align_single_space_minimal ' ,
90
+ ] ,
91
+ ] ,
92
+ ] ;
104
93
105
- $ finder = Finder::create ()
94
+ $ finder = \ PhpCsFixer \ Finder::create ()
106
95
->in (__DIR__ )
107
96
->name ('*.php ' )
108
97
->exclude ('.idea ' )
109
98
->exclude ('.ppm ' )
110
- ->exclude ('_dist_ ' )
111
- ->exclude ('node_modules ' )
112
- ->exclude ('vendor ' )
99
+ ->exclude ('cache ' )
113
100
->ignoreDotFiles (true )
114
- ->ignoreVCS (true );
101
+ ->ignoreVCS (false );
115
102
116
- return Config::create ()
103
+ return \ PhpCsFixer \ Config::create ()
117
104
->setFinder ($ finder )
118
105
->setRules ($ rules )
119
- ->setUsingCache (true );
106
+ ->setLineEnding ("\n" )
107
+ ->setUsingCache (false );
0 commit comments