Uh oh!
There was an error while loading. Please reload this page.
Load from the composer autoload - #4
Conversation
+1 i need this for cause i publish shared package that use location of class (https://github.com/thecodingmachine/graphqlite). (ci fail not related) |
fezfez
commented
Nov 18, 2019
@moufmouf : can you check this ? |
marc-jan
commented
Jan 22, 2020
moufmouf
commented
Jan 22, 2020
Hey guys! I'm absolutely sorry, I don't know how I missed this PR. I'm having a look at it right now! |
moufmouf
commented
Jan 22, 2020
Ok, I was worried that the new code might break when Composer 2 is released. So this PR looks great! |
moufmouf
commented
Jan 22, 2020
I did a few more tests and this PR still needs some work I think. In particular, it will fail if the composer autoloader is generated with an authoritative classmap: In this case, every reference to PSR-0 or PSR-4 is stripped from the Composer autoloader. I'm sure we kind find a workaround around this, but this is still to be developed. |
marc-jan
commented
Jan 22, 2020
@moufmouf Good one. I will have a look at it. |
marc-jan
commented
Jan 22, 2020
@moufmouf Also did some tests with --classmap-authoritative enabled and disabled in several projects and I'm always getting good/same results. Am I missing something? |
moufmouf
commented
Jan 23, 2020
Hey @marc-jangvs , Thanks a lot for your reactivity. Ok. I'm not 100% sure that classmap-authoritative is having an impact. Actually, I'm having trouble making this work. The Composer autoloader seems to behave in a weird way. I changed your unit test to load the "real" autoloader from Composer (rather than the test autoloader you wrote). This should work, but it fails. Having a look at what is going on, I realize that (in my case), the Did you manage to have this working for dependencies AND for project files? |
marc-jan
commented
Jan 23, 2020
@moufmouf Hm that is strange. I'm using it in combination with the GraphqLite package and for example I have a simple PingController in a generic package inside vendor. Also I have some controllers inside my project that I configured inside my
Didn't do anything else to make it work. |
fezfez
commented
Jun 20, 2020
Any news on this? |
I created an extra method
createFromComposerAutoloadto load the ClassNameMapper with data of the composer autoloader.If you use the
createFromComposerFilemethod you only get the specific information of your custom added autoloading. With the new loading option you can also get information of namespaces in vendor packages.I hope you like it.