File tree Expand file tree Collapse file tree 4 files changed +27
-5
lines changed
src/Symfony/Component/ClassLoader
Fixtures/ClassesWithParents Expand file tree Collapse file tree 4 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -283,12 +283,21 @@ private static function getClassHierarchy(\ReflectionClass $class)
283
283
}
284
284
}
285
285
286
+ return array_merge (self ::getInterfaces ($ class ), $ classes );
287
+ }
288
+
289
+ private static function getInterfaces (\ReflectionClass $ class )
290
+ {
291
+ $ classes = array ();
292
+
286
293
foreach ($ class ->getInterfaces () as $ interface ) {
287
- if ( $ interface -> isUserDefined () && ! isset ( self ::$ seen [ $ interface-> getName ()])) {
288
- self :: $ seen [ $ interface -> getName ()] = true ;
294
+ $ classes = array_merge ( $ classes , self ::getInterfaces ( $ interface));
295
+ }
289
296
290
- array_unshift ($ classes , $ interface );
291
- }
297
+ if ($ class ->isUserDefined () && $ class ->isInterface () && !isset (self ::$ seen [$ class ->getName ()])) {
298
+ self ::$ seen [$ class ->getName ()] = true ;
299
+
300
+ $ classes [] = $ class ;
292
301
}
293
302
294
303
return $ classes ;
Original file line number Diff line number Diff line change 13
13
14
14
use Symfony \Component \ClassLoader \ClassCollectionLoader ;
15
15
16
+ require_once __DIR__ .'/Fixtures/ClassesWithParents/GInterface.php ' ;
16
17
require_once __DIR__ .'/Fixtures/ClassesWithParents/CInterface.php ' ;
17
18
require_once __DIR__ .'/Fixtures/ClassesWithParents/B.php ' ;
18
19
require_once __DIR__ .'/Fixtures/ClassesWithParents/A.php ' ;
@@ -25,6 +26,7 @@ class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase
25
26
public function testClassReordering (array $ classes )
26
27
{
27
28
$ expected = array (
29
+ 'ClassesWithParents \\GInterface ' ,
28
30
'ClassesWithParents \\CInterface ' ,
29
31
'ClassesWithParents \\B ' ,
30
32
'ClassesWithParents \\A ' ,
@@ -45,6 +47,7 @@ public function getDifferentOrders()
45
47
array (array (
46
48
'ClassesWithParents \\A ' ,
47
49
'ClassesWithParents \\CInterface ' ,
50
+ 'ClassesWithParents \\GInterface ' ,
48
51
'ClassesWithParents \\B ' ,
49
52
)),
50
53
array (array (
@@ -81,6 +84,7 @@ public function testClassWithTraitsReordering(array $classes)
81
84
require_once __DIR__ .'/Fixtures/ClassesWithParents/E.php ' ;
82
85
83
86
$ expected = array (
87
+ 'ClassesWithParents \\GInterface ' ,
84
88
'ClassesWithParents \\CInterface ' ,
85
89
'ClassesWithParents \\CTrait ' ,
86
90
'ClassesWithParents \\ATrait ' ,
Original file line number Diff line number Diff line change 2
2
3
3
namespace ClassesWithParents ;
4
4
5
- interface CInterface {}
5
+ interface CInterface extends GInterface
6
+ {
7
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace ClassesWithParents ;
4
+
5
+ interface GInterface
6
+ {
7
+ }
You can’t perform that action at this time.
0 commit comments