1 | <?php |
||
2 | |||
3 | use PhpCsFixer\Config; |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
Config . Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
![]() |
|||
4 | use PhpCsFixer\Finder; |
||
0 ignored issues
–
show
The type
PhpCsFixer\Finder was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
5 | |||
6 | $rules = [ |
||
7 | 'array_syntax' => ['syntax' => 'short'], |
||
8 | |||
9 | 'blank_line_after_namespace' => true, |
||
10 | 'blank_line_after_opening_tag' => true, |
||
11 | 'braces' => true, |
||
12 | 'cast_spaces' => true, |
||
13 | 'concat_space' => [ |
||
14 | 'spacing' => 'none', |
||
15 | ], |
||
16 | 'declare_equal_normalize' => true, |
||
17 | 'elseif' => true, |
||
18 | 'encoding' => true, |
||
19 | 'full_opening_tag' => true, |
||
20 | 'fully_qualified_strict_types' => true, // added by Shift |
||
21 | 'function_declaration' => true, |
||
22 | 'function_typehint_space' => true, |
||
23 | 'heredoc_to_nowdoc' => true, |
||
24 | 'include' => true, |
||
25 | 'increment_style' => ['style' => 'post'], |
||
26 | 'indentation_type' => true, |
||
27 | 'linebreak_after_opening_tag' => true, |
||
28 | 'line_ending' => true, |
||
29 | 'lowercase_cast' => true, |
||
30 | 'lowercase_keywords' => true, |
||
31 | 'lowercase_static_reference' => true, // added from Symfony |
||
32 | 'magic_method_casing' => true, // added from Symfony |
||
33 | 'magic_constant_casing' => true, |
||
34 | 'method_argument_space' => true, |
||
35 | 'native_function_casing' => true, |
||
36 | 'no_alias_functions' => true, |
||
37 | 'no_extra_blank_lines' => [ |
||
38 | 'tokens' => [ |
||
39 | 'extra', |
||
40 | 'throw', |
||
41 | 'use', |
||
42 | 'use_trait', |
||
43 | ], |
||
44 | ], |
||
45 | 'no_blank_lines_after_class_opening' => true, |
||
46 | 'no_blank_lines_after_phpdoc' => true, |
||
47 | 'no_closing_tag' => true, |
||
48 | 'no_empty_phpdoc' => true, |
||
49 | 'no_empty_statement' => true, |
||
50 | 'no_leading_import_slash' => true, |
||
51 | 'no_leading_namespace_whitespace' => true, |
||
52 | 'no_mixed_echo_print' => [ |
||
53 | 'use' => 'echo', |
||
54 | ], |
||
55 | 'no_multiline_whitespace_around_double_arrow' => true, |
||
56 | 'multiline_whitespace_before_semicolons' => [ |
||
57 | 'strategy' => 'no_multi_line', |
||
58 | ], |
||
59 | 'no_short_bool_cast' => true, |
||
60 | 'no_singleline_whitespace_before_semicolons' => true, |
||
61 | 'no_spaces_after_function_name' => true, |
||
62 | 'no_spaces_inside_parenthesis' => true, |
||
63 | 'no_trailing_comma_in_list_call' => true, |
||
64 | 'no_trailing_comma_in_singleline_array' => true, |
||
65 | 'no_trailing_whitespace' => true, |
||
66 | 'no_trailing_whitespace_in_comment' => true, |
||
67 | 'no_unreachable_default_argument_value' => true, |
||
68 | 'no_useless_return' => true, |
||
69 | 'no_whitespace_before_comma_in_array' => true, |
||
70 | 'no_whitespace_in_blank_line' => true, |
||
71 | 'normalize_index_brace' => true, |
||
72 | 'not_operator_with_successor_space' => true, |
||
73 | 'object_operator_without_whitespace' => true, |
||
74 | 'phpdoc_indent' => true, |
||
75 | 'phpdoc_no_access' => true, |
||
76 | 'phpdoc_no_package' => true, |
||
77 | 'phpdoc_no_useless_inheritdoc' => true, |
||
78 | 'phpdoc_scalar' => true, |
||
79 | 'phpdoc_single_line_var_spacing' => true, |
||
80 | 'phpdoc_summary' => true, |
||
81 | 'phpdoc_to_comment' => true, |
||
82 | 'phpdoc_trim' => true, |
||
83 | 'phpdoc_types' => true, |
||
84 | 'phpdoc_var_without_name' => true, |
||
85 | 'self_accessor' => true, |
||
86 | 'short_scalar_cast' => true, |
||
87 | 'simplified_null_return' => false, // disabled by Shift |
||
88 | 'single_blank_line_at_eof' => true, |
||
89 | 'single_blank_line_before_namespace' => true, |
||
90 | 'single_import_per_statement' => true, |
||
91 | 'single_line_after_imports' => true, |
||
92 | 'single_line_comment_style' => [ |
||
93 | 'comment_types' => ['hash'], |
||
94 | ], |
||
95 | 'single_quote' => true, |
||
96 | 'space_after_semicolon' => true, |
||
97 | 'standardize_not_equals' => true, |
||
98 | 'switch_case_semicolon_to_colon' => true, |
||
99 | 'switch_case_space' => true, |
||
100 | 'ternary_operator_spaces' => true, |
||
101 | 'trim_array_spaces' => true, |
||
102 | 'unary_operator_spaces' => true, |
||
103 | 'whitespace_after_comma_in_array' => true, |
||
104 | |||
105 | // php-cs-fixer 3: Renamed rules |
||
106 | 'constant_case' => ['case' => 'lower'], |
||
107 | 'general_phpdoc_tag_rename' => true, |
||
108 | 'phpdoc_inline_tag_normalizer' => true, |
||
109 | 'phpdoc_tag_type' => true, |
||
110 | 'psr_autoloading' => true, |
||
111 | 'trailing_comma_in_multiline' => ['elements' => ['arrays']], |
||
112 | |||
113 | // php-cs-fixer 3: Changed options |
||
114 | 'binary_operator_spaces' => [ |
||
115 | 'default' => 'single_space', |
||
116 | 'operators' => ['=>' => null], |
||
117 | ], |
||
118 | 'blank_line_before_statement' => [ |
||
119 | 'statements' => ['return'], |
||
120 | ], |
||
121 | 'class_attributes_separation' => [ |
||
122 | 'elements' => [ |
||
123 | 'const' => 'one', |
||
124 | 'method' => 'one', |
||
125 | 'property' => 'one', |
||
126 | ], |
||
127 | ], |
||
128 | 'class_definition' => [ |
||
129 | 'multi_line_extends_each_single_line' => true, |
||
130 | 'single_item_single_line' => true, |
||
131 | 'single_line' => true, |
||
132 | ], |
||
133 | 'ordered_imports' => [ |
||
134 | 'sort_algorithm' => 'alpha', |
||
135 | ], |
||
136 | |||
137 | // php-cs-fixer 3: Removed rootless options (*) |
||
138 | 'no_unneeded_control_parentheses' => [ |
||
139 | 'statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield'], |
||
140 | ], |
||
141 | 'no_spaces_around_offset' => [ |
||
142 | 'positions' => ['inside', 'outside'], |
||
143 | ], |
||
144 | 'visibility_required' => [ |
||
145 | 'elements' => ['property', 'method', 'const'], |
||
146 | ], |
||
147 | |||
148 | ]; |
||
149 | |||
150 | $finder = Finder::create() |
||
151 | ->in([ |
||
152 | __DIR__.'/src', |
||
153 | __DIR__.'/config', |
||
154 | ]) |
||
155 | ->name('*.php') |
||
156 | ->notName('*.blade.php') |
||
157 | ->ignoreDotFiles(true) |
||
158 | ->ignoreVCS(true); |
||
159 | |||
160 | return (new Config()) |
||
161 | ->setFinder($finder) |
||
162 | ->setRules($rules) |
||
163 | ->setRiskyAllowed(true) |
||
164 | ->setUsingCache(true); |
||
165 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths