Conditions | 1 |
Paths | 1 |
Total Lines | 153 |
Code Lines | 85 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
65 | public function validateCasesProvider(): array |
||
66 | { |
||
67 | return [ |
||
68 | 'correct setup' => [ |
||
69 | null, |
||
70 | null, |
||
71 | [], |
||
72 | [], |
||
73 | ], |
||
74 | 'ambiguous has_one - no relation name' => [ |
||
75 | Hat::class, |
||
76 | 'belongs_to', |
||
77 | [ |
||
78 | 'Hatter' => Member::class, |
||
79 | ], |
||
80 | [ |
||
81 | 'SilverStripe\Dev\Tests\Validation\Member / Hat : Back relation not found or ambiguous (needs class.relation format)', |
||
82 | 'SilverStripe\Dev\Tests\Validation\Hat / Hatter : Relation is not in the expected format (needs class.relation format)', |
||
83 | ], |
||
84 | ], |
||
85 | 'ambiguous has_one - incorrect relation name' => [ |
||
86 | Hat::class, |
||
87 | 'belongs_to', |
||
88 | [ |
||
89 | 'Hatter' => Member::class . '.ObviouslyWrong', |
||
90 | ], |
||
91 | [ |
||
92 | 'SilverStripe\Dev\Tests\Validation\Member / Hat : Back relation not found or ambiguous (needs class.relation format)', |
||
93 | 'SilverStripe\Dev\Tests\Validation\Hat / Hatter : Back relation not found', |
||
94 | ], |
||
95 | ], |
||
96 | 'ambiguous has_one - too many relations' => [ |
||
97 | Hat::class, |
||
98 | 'belongs_to', |
||
99 | [ |
||
100 | 'Hatter' => Member::class . '.Hat', |
||
101 | 'HatterCopy' => Member::class . '.Hat', |
||
102 | ], |
||
103 | [ |
||
104 | 'SilverStripe\Dev\Tests\Validation\Member / Hat : Back relation is ambiguous', |
||
105 | ], |
||
106 | ], |
||
107 | 'invalid has one' => [ |
||
108 | Member::class, |
||
109 | 'has_one', |
||
110 | [ |
||
111 | 'HomeTeam' => Team::class . '.UnnecessaryRelation', |
||
112 | 'Hat' => Hat::class, |
||
113 | ], |
||
114 | [ |
||
115 | 'SilverStripe\Dev\Tests\Validation\Member / HomeTeam : Relation SilverStripe\Dev\Tests\Validation\Team.UnnecessaryRelation is not in the expected format (needs class only format).' |
||
116 | ], |
||
117 | ], |
||
118 | 'ambiguous has_many - no relation name' => [ |
||
119 | Team::class, |
||
120 | 'has_many', |
||
121 | [ |
||
122 | 'Members' => Member::class, |
||
123 | 'FreelancerMembers' => Freelancer::class . '.TemporaryTeam', |
||
124 | ], |
||
125 | [ |
||
126 | 'SilverStripe\Dev\Tests\Validation\Team / Members : Relation is not in the expected format (needs class.relation format)', |
||
127 | 'SilverStripe\Dev\Tests\Validation\Member / HomeTeam : Back relation not found or ambiguous (needs class.relation format)', |
||
128 | ], |
||
129 | ], |
||
130 | 'ambiguous has_many - incorrect relation name' => [ |
||
131 | Team::class, |
||
132 | 'has_many', |
||
133 | [ |
||
134 | 'Members' => Member::class . '.ObviouslyWrong', |
||
135 | 'FreelancerMembers' => Freelancer::class . '.TemporaryTeam', |
||
136 | ], |
||
137 | [ |
||
138 | 'SilverStripe\Dev\Tests\Validation\Team / Members : Back relation not found or ambiguous (needs class.relation format)', |
||
139 | 'SilverStripe\Dev\Tests\Validation\Member / HomeTeam : Back relation not found or ambiguous (needs class.relation format)', |
||
140 | ], |
||
141 | ], |
||
142 | 'ambiguous has_many - too many relations' => [ |
||
143 | Team::class, |
||
144 | 'has_many', |
||
145 | [ |
||
146 | 'Members' => Member::class . '.HomeTeam', |
||
147 | 'MembersCopy' => Member::class . '.HomeTeam', |
||
148 | 'FreelancerMembers' => Freelancer::class . '.TemporaryTeam', |
||
149 | ], |
||
150 | [ |
||
151 | 'SilverStripe\Dev\Tests\Validation\Member / HomeTeam : Back relation is ambiguous', |
||
152 | ], |
||
153 | ], |
||
154 | 'ambiguous many_many - no relation name' => [ |
||
155 | Hat::class, |
||
156 | 'belongs_many_many', |
||
157 | [ |
||
158 | 'TeamHats' => Team::class, |
||
159 | ], |
||
160 | [ |
||
161 | 'SilverStripe\Dev\Tests\Validation\Team / ReserveHats : Back relation not found or ambiguous (needs class.relation format)', |
||
162 | 'SilverStripe\Dev\Tests\Validation\Hat / TeamHats : Relation is not in the expected format (needs class.relation format)', |
||
163 | ], |
||
164 | ], |
||
165 | 'ambiguous many_many - incorrect relation name' => [ |
||
166 | Hat::class, |
||
167 | 'belongs_many_many', |
||
168 | [ |
||
169 | 'TeamHats' => Team::class . '.ObviouslyWrong', |
||
170 | ], |
||
171 | [ |
||
172 | 'SilverStripe\Dev\Tests\Validation\Team / ReserveHats : Back relation not found or ambiguous (needs class.relation format)', |
||
173 | 'SilverStripe\Dev\Tests\Validation\Hat / TeamHats : Back relation not found', |
||
174 | ], |
||
175 | ], |
||
176 | 'ambiguous many_many - too many relations' => [ |
||
177 | Hat::class, |
||
178 | 'belongs_many_many', |
||
179 | [ |
||
180 | 'TeamHats' => Team::class . '.ReserveHats', |
||
181 | 'TeamHatsCopy' => Team::class . '.ReserveHats', |
||
182 | ], |
||
183 | [ |
||
184 | 'SilverStripe\Dev\Tests\Validation\Team / ReserveHats : Back relation is ambiguous', |
||
185 | ], |
||
186 | ], |
||
187 | 'ambiguous many_many through - no relation name' => [ |
||
188 | Member::class, |
||
189 | 'belongs_many_many', |
||
190 | [ |
||
191 | 'FreelancerTeams' => Team::class, |
||
192 | ], |
||
193 | [ |
||
194 | 'SilverStripe\Dev\Tests\Validation\Team / Freelancers : Back relation not found or ambiguous (needs class.relation format)', |
||
195 | 'SilverStripe\Dev\Tests\Validation\Member / FreelancerTeams : Relation is not in the expected format (needs class.relation format)', |
||
196 | ], |
||
197 | ], |
||
198 | 'ambiguous many_many through - incorrect relation name' => [ |
||
199 | Member::class, |
||
200 | 'belongs_many_many', |
||
201 | [ |
||
202 | 'FreelancerTeams' => Team::class . '.ObviouslyWrong', |
||
203 | ], |
||
204 | [ |
||
205 | 'SilverStripe\Dev\Tests\Validation\Team / Freelancers : Back relation not found or ambiguous (needs class.relation format)', |
||
206 | 'SilverStripe\Dev\Tests\Validation\Member / FreelancerTeams : Back relation not found', |
||
207 | ], |
||
208 | ], |
||
209 | 'ambiguous many_many through - too many relations' => [ |
||
210 | Member::class, |
||
211 | 'belongs_many_many', |
||
212 | [ |
||
213 | 'FreelancerTeams' => Team::class . '.Freelancers', |
||
214 | 'FreelancerTeamsCopy' => Team::class . '.Freelancers', |
||
215 | ], |
||
216 | [ |
||
217 | 'SilverStripe\Dev\Tests\Validation\Team / Freelancers : Back relation is ambiguous', |
||
218 | ], |
||
292 |
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