|
1 | 1 | <?php
|
2 | 2 |
|
3 | 3 | return [
|
| 4 | + /** Will show up as the configuration name when using this rules configurations. */ |
4 | 5 | 'config_name' => 'Laravel Fixer',
|
5 |
| - 'fixer' => [ |
6 |
| - 'suppress' => env('SUPPRESS_FIXER_INFO', false) |
7 |
| - ], |
| 6 | + |
| 7 | + /** By default, we will ignore any and all dot files. */ |
8 | 8 | 'ignore_dot_files' => true,
|
| 9 | + |
| 10 | + /** By default, we will ignore all the source control metadata */ |
9 | 11 | 'ignore_vcs' => true,
|
| 12 | + |
| 13 | + /** The list of directories you want to fix. These are the default laravel directories. */ |
10 | 14 | 'find_directories' => [
|
11 | 15 | app_path(),
|
12 | 16 | config_path(),
|
13 | 17 | database_path(),
|
14 | 18 | resource_path(),
|
15 | 19 | base_path('/routes'),
|
16 |
| - //base_path('/tests') |
| 20 | + base_path('/tests') |
17 | 21 |
|
18 | 22 | ],
|
| 23 | + |
| 24 | + /** We will fix all files in those directories that match a pattern in this list. */ |
19 | 25 | 'file_name_pattern_whitelist' => [
|
20 | 26 | '*.php',
|
21 | 27 | ],
|
| 28 | + |
| 29 | + /** However, we will not fix files that match patterns in this list. */ |
22 | 30 | 'file_name_pattern_blacklist' => [
|
23 | 31 | '*.blade.php',
|
24 | 32 | ],
|
| 33 | + |
| 34 | + /** |
| 35 | + * These are all the rules. |
| 36 | + * Find them all at https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v3.0.0/doc/rules/index.rst |
| 37 | + */ |
25 | 38 | 'rules' => [
|
| 39 | + /** PHP arrays should be declared using the configured syntax. */ |
26 | 40 | 'array_syntax' => ['syntax' => 'short'],
|
| 41 | + |
| 42 | + /** Binary operators should be surrounded by space as configured. */ |
27 | 43 | 'binary_operator_spaces' => [
|
28 | 44 | 'default' => 'single_space',
|
29 | 45 | 'operators' => ['=>' => null]
|
30 | 46 | ],
|
| 47 | + |
| 48 | + /** There MUST be one blank line after the namespace declaration. */ |
31 | 49 | 'blank_line_after_namespace' => true,
|
| 50 | + |
| 51 | + /** Ensure there is no code on the same line as the PHP open tag and it is followed by a blank line. */ |
32 | 52 | 'blank_line_after_opening_tag' => true,
|
| 53 | + |
| 54 | + /** An empty line feed must precede any configured statement. */ |
33 | 55 | 'blank_line_before_statement' => [
|
34 | 56 | 'statements' => ['return']
|
35 | 57 | ],
|
| 58 | + |
| 59 | + /** The body of each structure MUST be enclosed by braces. Braces should be properly placed. Body of braces should be properly indented. */ |
36 | 60 | 'braces' => true,
|
| 61 | + |
| 62 | + /** A single space or none should be between cast and variable. */ |
37 | 63 | 'cast_spaces' => true,
|
| 64 | + |
| 65 | + /** Class, trait and interface elements must be separated with one or none blank line. */ |
38 | 66 | 'class_attributes_separation' => [
|
39 | 67 | 'elements' => ['method']
|
40 | 68 | ],
|
| 69 | + |
| 70 | + /** Whitespace around the keywords of a class, trait or interfaces definition should be one space. */ |
41 | 71 | 'class_definition' => true,
|
| 72 | + |
| 73 | + /** Concatenation should be spaced according configuration. */ |
42 | 74 | 'concat_space' => [
|
43 | 75 | 'spacing' => 'none'
|
44 | 76 | ],
|
| 77 | + |
| 78 | + /** Equal sign in declare statement should be surrounded by spaces or not following configuration. */ |
45 | 79 | 'declare_equal_normalize' => true,
|
| 80 | + |
| 81 | + /** The keyword elseif should be used instead of else if so that all control keywords look like single words. */ |
46 | 82 | 'elseif' => true,
|
| 83 | + |
| 84 | + /** PHP code MUST use only UTF-8 without BOM (remove BOM). */ |
47 | 85 | 'encoding' => true,
|
| 86 | + |
| 87 | + /** PHP code must use the long <?php tags or short-echo <?= tags and not other tag variations. */ |
48 | 88 | 'full_opening_tag' => true,
|
49 |
| - 'fully_qualified_strict_types' => true, // added by Shift |
| 89 | + |
| 90 | + /** Transforms imported FQCN parameters and return types in function arguments to short version. */ |
| 91 | + 'fully_qualified_strict_types' => true, |
| 92 | + |
| 93 | + /** Spaces should be properly placed in a function declaration. */ |
50 | 94 | 'function_declaration' => true,
|
| 95 | + |
| 96 | + /** nsure single space between function's argument and its typehint. */ |
51 | 97 | 'function_typehint_space' => true,
|
| 98 | + |
| 99 | + /** Convert heredoc to nowdoc where possible. */ |
52 | 100 | 'heredoc_to_nowdoc' => true,
|
| 101 | + |
| 102 | + /** Include/Require and file path should be divided with a single space. File path should not be placed under brackets. */ |
53 | 103 | 'include' => true,
|
| 104 | + |
| 105 | + /** Pre- or post-increment and decrement operators should be used if possible. */ |
54 | 106 | 'increment_style' => ['style' => 'post'],
|
| 107 | + |
| 108 | + /** Code MUST use configured indentation type. */ |
55 | 109 | 'indentation_type' => true,
|
| 110 | + |
| 111 | + /** Ensure there is no code on the same line as the PHP open tag. */ |
56 | 112 | 'linebreak_after_opening_tag' => true,
|
| 113 | + |
| 114 | + /** All PHP files must use same line ending. */ |
57 | 115 | 'line_ending' => true,
|
| 116 | + |
| 117 | + /** Cast should be written in lower case. */ |
58 | 118 | 'lowercase_cast' => true,
|
| 119 | + |
| 120 | + /** */ |
59 | 121 | 'lowercase_constants' => true,
|
| 122 | + |
| 123 | + /** PHP keywords MUST be in lower case. */ |
60 | 124 | 'lowercase_keywords' => true,
|
61 |
| - 'lowercase_static_reference' => true, // added from Symfony |
62 |
| - 'magic_method_casing' => true, // added from Symfony |
| 125 | + |
| 126 | + /** Class static references self, static and parent MUST be in lower case. */ |
| 127 | + 'lowercase_static_reference' => true, |
| 128 | + |
| 129 | + /** Magic method definitions and calls must be using the correct casing. */ |
| 130 | + 'magic_method_casing' => true, |
| 131 | + |
| 132 | + /** Magic constants should be referred to using the correct casing */ |
63 | 133 | 'magic_constant_casing' => true,
|
| 134 | + |
| 135 | + /** |
| 136 | + * In method arguments and method call, there MUST NOT be a space before each comma and |
| 137 | + * there MUST be one space after each comma. Argument lists MAY be split across multiple |
| 138 | + * lines, where each subsequent line is indented once. When doing so, the first item in the |
| 139 | + * list MUST be on the next line, and there MUST be only one argument per line. |
| 140 | + */ |
64 | 141 | 'method_argument_space' => true,
|
| 142 | + |
| 143 | + /** Function defined by PHP should be called using the correct casing. */ |
65 | 144 | 'native_function_casing' => true,
|
| 145 | + |
| 146 | + /** (risky) Master functions shall be used instead of aliases. */ |
66 | 147 | 'no_alias_functions' => true,
|
| 148 | + |
| 149 | + /** Removes extra blank lines and/or blank lines following configuration. */ |
67 | 150 | 'no_extra_blank_lines' => [
|
68 | 151 | 'tokens' => [
|
69 | 152 | 'extra',
|
|
72 | 155 | 'use_trait',
|
73 | 156 | ]
|
74 | 157 | ],
|
| 158 | + /** There should be no empty lines after class opening brace. */ |
75 | 159 | 'no_blank_lines_after_class_opening' => true,
|
76 | 160 | 'no_blank_lines_after_phpdoc' => true,
|
77 | 161 | 'no_closing_tag' => true,
|
|
0 commit comments