File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,9 @@ class AnnotationDirectoryLoader extends AnnotationFileLoader
34
34
*/
35
35
public function load ($ path , $ type = null )
36
36
{
37
- $ dir = $ this ->locator ->locate ($ path );
37
+ if (!is_dir ($ dir = $ this ->locator ->locate ($ path ))) {
38
+ return parent ::supports ($ path , $ type ) ? parent ::load ($ path , $ type ) : new RouteCollection ();
39
+ }
38
40
39
41
$ collection = new RouteCollection ();
40
42
$ collection ->addResource (new DirectoryResource ($ dir , '/\.php$/ ' ));
@@ -74,16 +76,18 @@ function (\SplFileInfo $current) {
74
76
*/
75
77
public function supports ($ resource , $ type = null )
76
78
{
77
- if (!is_string ($ resource )) {
79
+ if ('annotation ' === $ type ) {
80
+ return true ;
81
+ }
82
+
83
+ if ($ type || !is_string ($ resource )) {
78
84
return false ;
79
85
}
80
86
81
87
try {
82
- $ path = $ this ->locator ->locate ($ resource );
88
+ return is_dir ( $ this ->locator ->locate ($ resource) );
83
89
} catch (\Exception $ e ) {
84
90
return false ;
85
91
}
86
-
87
- return is_dir ($ path ) && (!$ type || 'annotation ' === $ type );
88
92
}
89
93
}
You can’t perform that action at this time.
0 commit comments