Today I'm bringing you more fixes and refactoring to the FileParser. This does the following:
Also let the search for a namespace and use statements stop on the trait and interface keyword (minor optimization).
Compare segments of the use statements and class name after an explode, this removes the 'hack' I previously added to work around use \My_Test being detected as a use statement for Test because it matched partially.
A bugfix for using class names relative to an import, e.g. use A\B\C; and then @return C\D.
A bugfix for the corner case where you had class names relative to an aliased import, e.g. use A\B\C as D; and then @return D\E.
Thanks to gradually refactoring the code, I noticed that the code for both aliased imports and non-aliased imports was now exactly the same. Due to this the code has become significantly smaller.
I also added more test cases in my test repository under testParentImports if you're interested in seeing all of them at work.
I think (I hope) I have all the cases and corner cases of imports working now.
Hello
Today I'm bringing you more fixes and refactoring to the
FileParser
. This does the following:trait
andinterface
keyword (minor optimization).explode
, this removes the 'hack' I previously added to work arounduse \My_Test
being detected as a use statement forTest
because it matched partially.use A\B\C;
and then@return C\D
.use A\B\C as D;
and then@return D\E
.I also added more test cases in my test repository under
testParentImports
if you're interested in seeing all of them at work.I think (I hope) I have all the cases and corner cases of imports working now.