File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -168,7 +168,13 @@ private function extractUseStatement(\ArrayIterator $tokens)
168168 }
169169
170170 if (count ($ result ) == 1 ) {
171- $ result [] = substr ($ result [0 ], strrpos ($ result [0 ], '\\' ) + 1 );
171+ $ backslashPos = strrpos ($ result [0 ], '\\' );
172+
173+ if (false !== $ backslashPos ) {
174+ $ result [] = substr ($ result [0 ], $ backslashPos + 1 );
175+ } else {
176+ $ result [] = $ result [0 ];
177+ }
172178 }
173179
174180 return array_reverse ($ result );
Original file line number Diff line number Diff line change 1616 use Mockery as m ;
1717 use phpDocumentor \Reflection \DocBlock ,
1818 phpDocumentor \Reflection \DocBlock \Tag ;
19+ use phpDocumentor ;
1920 use \ReflectionClass ; // yes, the slash is part of the test
2021
2122 /**
@@ -49,6 +50,7 @@ public function testReadsAliasesFromClassReflection()
4950 'm ' => 'Mockery ' ,
5051 'DocBlock ' => 'phpDocumentor\Reflection\DocBlock ' ,
5152 'Tag ' => 'phpDocumentor\Reflection\DocBlock\Tag ' ,
53+ 'phpDocumentor ' => 'phpDocumentor ' ,
5254 'ReflectionClass ' => 'ReflectionClass '
5355 ];
5456 $ context = $ fixture ->createFromReflector (new ReflectionClass ($ this ));
@@ -79,6 +81,7 @@ public function testReadsAliasesFromProvidedNamespaceAndContent()
7981 'm ' => 'Mockery ' ,
8082 'DocBlock ' => 'phpDocumentor\Reflection\DocBlock ' ,
8183 'Tag ' => 'phpDocumentor\Reflection\DocBlock\Tag ' ,
84+ 'phpDocumentor ' => 'phpDocumentor ' ,
8285 'ReflectionClass ' => 'ReflectionClass '
8386 ];
8487 $ context = $ fixture ->createForNamespace (__NAMESPACE__ , file_get_contents (__FILE__ ));
You can’t perform that action at this time.
0 commit comments