I have two separate PHP modules each containing a vendor folder created by composer. Both modules use the composer autoloader which is registered before any of the module's class is instantiated.
Each vendor folder contains a different version of Doctrine, so in the same runtime, if I instantiate any Doctrine class from one module, any subsequent calls to the same Doctrine class from the other module, will use the first instantiated class as it is already autoloaded by PHP (it has same namespace, same name).
Is there a way to go around this without actually renaming all the namespaces and use declarations of one or both of the different Doctrine libraries?