File tree 2 files changed +11
-5
lines changed
2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
namespace gossi \codegen \generator \comparator ;
3
3
4
- use phootwork \lang \Comparator ;
5
4
use gossi \codegen \model \PhpConstant ;
5
+ use phootwork \lang \Comparator ;
6
6
7
7
class DefaultConstantComparator implements Comparator {
8
-
8
+
9
+ private $ comparator ;
10
+
11
+ public function __construct () {
12
+ $ this ->comparator = new DefaultUseStatementComparator ();
13
+ }
14
+
9
15
/**
10
16
* @param PhpConstant $a
11
17
* @param PhpConstant $b
12
18
*/
13
19
public function compare ($ a , $ b ) {
14
- return strcasecmp ($ a ->getName (), $ b ->getName ());
20
+ return $ this -> comparator -> compare ($ a ->getName (), $ b ->getName ());
15
21
}
16
22
17
23
}
Original file line number Diff line number Diff line change @@ -57,12 +57,12 @@ public function testDefaultConstantComparator() {
57
57
$ ordered = $ list ->map (function ($ item ) {
58
58
return $ item ->getName ();
59
59
})->toArray ();
60
-
60
+
61
61
$ this ->assertEquals ([
62
62
'bar ' ,
63
+ 'baz ' ,
63
64
'BAR ' ,
64
65
'BAZ ' ,
65
- 'baz ' ,
66
66
'FOO '
67
67
], $ ordered );
68
68
}
You can’t perform that action at this time.
0 commit comments