Laravel 5.5 の妥協できる PHP-CS-Fixer 設定ファイルが完成した – oki2a24 を作る途中で、 https://styleci.readme.io/docs/presets#section-laravel の各ルールが、 PHP-CS-Fixer のどのルールと対応するのか、それは PHP-CS-Fixer の @PSR ルールや @PhpCsFixer ルールに含まれるか、の対応が知りたいと思い、一覧表にまとめました。
対応表
"PHP-CS-Fixer rule" の列で太字となっている、または "**" で囲まれている場合は "StyleCI Laravel" の名前と異なる。 "****" となっている場合は、対応するルールを見つけられなかった。
No | StyleCI Laravel | PHP-CS-Fixer rule | @PhpCsFixer | @PhpCsFixer:risky | @PSR2 |
---|---|---|---|---|---|
1 | align_phpdoc | align_multiline_comment | x | ||
2 | binary_operator_spaces | binary_operator_spaces | x | ||
3 | blank_line_after_namespace | blank_line_after_namespace | x | x | |
4 | blank_line_after_opening_tag | blank_line_after_opening_tag | x | ||
5 | blank_line_before_return | ** ‘blank_line_before_statement’ => [‘statements’ => [‘return’]],** | x | ||
6 | braces | braces | x | x | |
7 | cast_spaces | cast_spaces | x | ||
8 | class_definition | class_definition | x | x | |
9 | concat_without_spaces | concat_space | |||
10 | declare_equal_normalize | declare_equal_normalize | x | ||
11 | elseif | elseif | x | x | |
12 | encoding | encoding | x | x | |
13 | full_opening_tag | full_opening_tag | x | x | |
14 | function_declaration | function_declaration | x | x | |
15 | function_typehint_space | function_typehint_space | x | ||
16 | hash_to_slash_comment | single_line_comment_style | x | ||
17 | heredoc_to_nowdoc | heredoc_to_nowdoc | x | ||
18 | include | include | x | ||
19 | indentation | indentation_type | x | x | |
20 | length_ordered_imports | **** | |||
21 | lowercase_cast | lowercase_cast | x | ||
22 | lowercase_constants | lowercase_constants | x | x | |
23 | lowercase_keywords | lowercase_keywords | x | x | |
24 | magic_constant_casing | magic_constant_casing | x | ||
25 | method_argument_space | method_argument_space | x | x | |
26 | method_separation | ** ‘class_attributes_separation’ => [‘elements’ => [‘method’]],** | x | ||
27 | method_visibility_required | ** ‘visibility_required’ => [‘elements’ => [‘method’]],** | x | x | |
28 | native_function_casing | native_function_casing | x | ||
29 | no_alias_functions | no_alias_functions | x | ||
30 | no_blank_lines_after_class_opening | no_blank_lines_after_class_opening | x | ||
31 | no_blank_lines_after_phpdoc | no_blank_lines_after_phpdoc | x | ||
32 | no_blank_lines_after_throw | **** | |||
33 | no_blank_lines_between_imports | ** ‘no_extra_blank_lines’ => [‘tokens’ => [‘use’]],** | x | ||
34 | no_blank_lines_between_traits | ** ‘no_extra_blank_lines’ => [‘tokens’ => [‘use_trait’]],** | x | ||
35 | no_closing_tag | no_closing_tag | x | x | |
36 | no_empty_phpdoc | no_empty_phpdoc | x | ||
37 | no_empty_statement | no_empty_statement | x | ||
38 | no_extra_consecutive_blank_lines | ** ‘no_extra_blank_lines’ => [‘tokens’ => [‘extra’]],** | x | ||
39 | no_leading_import_slash | no_leading_import_slash | x | ||
40 | no_leading_namespace_whitespace | no_leading_namespace_whitespace | x | ||
41 | no_multiline_whitespace_around_double_arrow | no_multiline_whitespace_around_double_arrow | x | ||
42 | no_multiline_whitespace_before_semicolons | multiline_whitespace_before_semicolons | x | ||
43 | no_short_bool_cast | no_short_bool_cast | x | ||
44 | no_singleline_whitespace_before_semicolons | no_singleline_whitespace_before_semicolons | x | ||
45 | no_spaces_after_function_name | no_spaces_after_function_name | x | x | |
46 | no_spaces_inside_offset | no_spaces_around_offset | x | ||
47 | no_spaces_inside_parenthesis | no_spaces_inside_parenthesis | x | x | |
48 | no_trailing_comma_in_list_call | no_trailing_comma_in_list_call | x | ||
49 | no_trailing_comma_in_singleline_array | no_trailing_comma_in_singleline_array | x | ||
50 | no_trailing_whitespace | no_trailing_whitespace | x | x | |
51 | no_trailing_whitespace_in_comment | no_trailing_whitespace_in_comment | x | x | |
52 | no_unneeded_control_parentheses | no_unneeded_control_parentheses | x | ||
53 | no_unreachable_default_argument_value | no_unreachable_default_argument_value | x | ||
54 | no_unused_imports | no_unused_imports | x | ||
55 | no_useless_return | no_useless_return | x | ||
56 | no_whitespace_before_comma_in_array | no_whitespace_before_comma_in_array | x | ||
57 | no_whitespace_in_blank_line | no_whitespace_in_blank_line | x | ||
58 | normalize_index_brace | normalize_index_brace | x | ||
59 | not_operator_with_successor_space | not_operator_with_successor_space | |||
60 | object_operator_without_whitespace | object_operator_without_whitespace | x | ||
61 | phpdoc_indent | phpdoc_indent | x | ||
62 | phpdoc_inline_tag | phpdoc_inline_tag | x | ||
63 | phpdoc_no_access | phpdoc_no_access | x | ||
64 | phpdoc_no_package | phpdoc_no_package | x | ||
65 | phpdoc_no_useless_inheritdoc | phpdoc_no_useless_inheritdoc | x | ||
66 | phpdoc_scalar | phpdoc_scalar | x | ||
67 | phpdoc_single_line_var_spacing | phpdoc_single_line_var_spacing | x | ||
68 | phpdoc_summary | phpdoc_summary | x | ||
69 | phpdoc_to_comment | phpdoc_to_comment | x | ||
70 | phpdoc_trim | phpdoc_trim | x | ||
71 | phpdoc_type_to_var | **** | |||
72 | phpdoc_types | phpdoc_types | x | ||
73 | phpdoc_var_without_name | phpdoc_var_without_name | x | ||
74 | post_increment | ** ‘increment_style’ => [‘style’ => ‘post’],** | x | ||
75 | print_to_echo | no_mixed_echo_print | x | ||
76 | property_visibility_required | ** ‘visibility_required’ => [‘elements’ => [‘property’]],** | x | x | |
77 | psr4 | psr4 | x | ||
78 | self_accessor | self_accessor | x | ||
79 | short_array_syntax | ** ‘array_syntax’ => [‘syntax’ => ‘short’],** | x | ||
80 | short_scalar_cast | short_scalar_cast | x | ||
81 | simplified_null_return | simplified_null_return | |||
82 | single_blank_line_at_eof | single_blank_line_at_eof | x | x | |
83 | single_blank_line_before_namespace | single_blank_line_before_namespace | x | ||
84 | single_class_element_per_statement | single_class_element_per_statement | x | x | |
85 | single_import_per_statement | single_import_per_statement | x | x | |
86 | single_line_after_imports | single_line_after_imports | x | x | |
87 | single_quote | single_quote | x | ||
88 | space_after_semicolon | space_after_semicolon | x | ||
89 | standardize_not_equals | standardize_not_equals | x | ||
90 | switch_case_semicolon_to_colon | switch_case_semicolon_to_colon | x | x | |
91 | switch_case_space | switch_case_space | x | x | |
92 | ternary_operator_spaces | ternary_operator_spaces | x | ||
93 | trailing_comma_in_multiline_array | trailing_comma_in_multiline_array | x | ||
94 | trim_array_spaces | trim_array_spaces | x | ||
95 | unalign_equals | **** | |||
96 | unary_operator_spaces | unary_operator_spaces | x | ||
97 | unix_line_endings | **** | |||
98 | whitespace_after_comma_in_array | whitespace_after_comma_in_array | x |
おわりに
表を作るのに、 PHP-CS-Fixer Configurator を活用いたしました。本当に便利と思います。
また、 php-cs-fixer descrive <rule>
コマンドも利用いたしました。
以上です。