Skip to content

Commit 1ceac73

Browse files
committed
Add some documentation
1 parent 3e29348 commit 1ceac73

File tree

1 file changed

+91
-7
lines changed

1 file changed

+91
-7
lines changed

config/fixer.php

Lines changed: 91 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,152 @@
11
<?php
22

33
return [
4+
/** Will show up as the configuration name when using this rules configurations. */
45
'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. */
88
'ignore_dot_files' => true,
9+
10+
/** By default, we will ignore all the source control metadata */
911
'ignore_vcs' => true,
12+
13+
/** The list of directories you want to fix. These are the default laravel directories. */
1014
'find_directories' => [
1115
app_path(),
1216
config_path(),
1317
database_path(),
1418
resource_path(),
1519
base_path('/routes'),
16-
//base_path('/tests')
20+
base_path('/tests')
1721

1822
],
23+
24+
/** We will fix all files in those directories that match a pattern in this list. */
1925
'file_name_pattern_whitelist' => [
2026
'*.php',
2127
],
28+
29+
/** However, we will not fix files that match patterns in this list. */
2230
'file_name_pattern_blacklist' => [
2331
'*.blade.php',
2432
],
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+
*/
2538
'rules' => [
39+
/** PHP arrays should be declared using the configured syntax. */
2640
'array_syntax' => ['syntax' => 'short'],
41+
42+
/** Binary operators should be surrounded by space as configured. */
2743
'binary_operator_spaces' => [
2844
'default' => 'single_space',
2945
'operators' => ['=>' => null]
3046
],
47+
48+
/** There MUST be one blank line after the namespace declaration. */
3149
'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. */
3252
'blank_line_after_opening_tag' => true,
53+
54+
/** An empty line feed must precede any configured statement. */
3355
'blank_line_before_statement' => [
3456
'statements' => ['return']
3557
],
58+
59+
/** The body of each structure MUST be enclosed by braces. Braces should be properly placed. Body of braces should be properly indented. */
3660
'braces' => true,
61+
62+
/** A single space or none should be between cast and variable. */
3763
'cast_spaces' => true,
64+
65+
/** Class, trait and interface elements must be separated with one or none blank line. */
3866
'class_attributes_separation' => [
3967
'elements' => ['method']
4068
],
69+
70+
/** Whitespace around the keywords of a class, trait or interfaces definition should be one space. */
4171
'class_definition' => true,
72+
73+
/** Concatenation should be spaced according configuration. */
4274
'concat_space' => [
4375
'spacing' => 'none'
4476
],
77+
78+
/** Equal sign in declare statement should be surrounded by spaces or not following configuration. */
4579
'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. */
4682
'elseif' => true,
83+
84+
/** PHP code MUST use only UTF-8 without BOM (remove BOM). */
4785
'encoding' => true,
86+
87+
/** PHP code must use the long <?php tags or short-echo <?= tags and not other tag variations. */
4888
'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. */
5094
'function_declaration' => true,
95+
96+
/** nsure single space between function's argument and its typehint. */
5197
'function_typehint_space' => true,
98+
99+
/** Convert heredoc to nowdoc where possible. */
52100
'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. */
53103
'include' => true,
104+
105+
/** Pre- or post-increment and decrement operators should be used if possible. */
54106
'increment_style' => ['style' => 'post'],
107+
108+
/** Code MUST use configured indentation type. */
55109
'indentation_type' => true,
110+
111+
/** Ensure there is no code on the same line as the PHP open tag. */
56112
'linebreak_after_opening_tag' => true,
113+
114+
/** All PHP files must use same line ending. */
57115
'line_ending' => true,
116+
117+
/** Cast should be written in lower case. */
58118
'lowercase_cast' => true,
119+
120+
/** */
59121
'lowercase_constants' => true,
122+
123+
/** PHP keywords MUST be in lower case. */
60124
'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 */
63133
'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+
*/
64141
'method_argument_space' => true,
142+
143+
/** Function defined by PHP should be called using the correct casing. */
65144
'native_function_casing' => true,
145+
146+
/** (risky) Master functions shall be used instead of aliases. */
66147
'no_alias_functions' => true,
148+
149+
/** Removes extra blank lines and/or blank lines following configuration. */
67150
'no_extra_blank_lines' => [
68151
'tokens' => [
69152
'extra',
@@ -72,6 +155,7 @@
72155
'use_trait',
73156
]
74157
],
158+
/** There should be no empty lines after class opening brace. */
75159
'no_blank_lines_after_class_opening' => true,
76160
'no_blank_lines_after_phpdoc' => true,
77161
'no_closing_tag' => true,

0 commit comments

Comments
 (0)