File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -179,16 +179,13 @@ final static public function getConstants()
179
179
$ constants = $ reflection ->getConstants ();
180
180
181
181
// Constant values needs to be unique
182
- if (count ($ constants ) > count (array_unique ($ constants ))) {
183
- $ ambiguous = array ();
184
- foreach (array_count_values ($ constants ) as $ constValue => $ countValue ) {
185
- if ($ countValue > 1 ) {
186
- $ ambiguous [] = $ constValue ;
187
- }
188
- }
182
+ if (max (array_count_values ($ constants )) > 1 ) {
183
+ $ ambiguous = array_map (function ($ v ) use ($ constants ) {
184
+ return implode ('/ ' , array_keys ($ constants , $ v )) . '= ' . $ v ;
185
+ }, array_unique (array_diff_assoc ($ constants , array_unique ($ constants ))));
189
186
throw new LogicException (sprintf (
190
187
'All possible values needs to be unique. The following are ambiguous: %s ' ,
191
- " ' " . implode (" ', ' " , $ ambiguous ) . " ' "
188
+ implode (', ' , $ ambiguous )
192
189
));
193
190
}
194
191
You can’t perform that action at this time.
0 commit comments