Welcome Guest, Not a member yet? Register   Sign In
Problem with detecting commands when custom namespace is declared
#1

I'm not really sure if this is a bug or not, but it seems that the Commands detection is failing when we add a custom module via $psr4 array in Autoload class and this module is placed in the app/ folder.

I downloaded myth-auth and followed the instructions regarding manual installation (it's nothing related to this package, I use it as an example). So, my autoload looks like this:

PHP Code:
$psr4 = [
    'App'         => APPPATH,                // To ensure filters, etc still found,
    APP_NAMESPACE => APPPATH,                // For custom namespace
    'Config'      => APPPATH 'Config',
    'Myth\Auth'   => APPPATH 'ThirdParty/myth-auth/src',
]; 


Command php spark list doesn't show any new commands and we also can't run any of these commands shipped with this package. Running command php spark namespaces shows that new namespace (Myth\Auth) is found.

After some digging, I discovered that Myth\Auth in qualified as an App namespace by FileLocator::findQualifiedNameFromPath().

When we change the order of the entries in $psr4 and place Myth\Auth at the beginning of the array it starts to work correctly. So, my question is... whether this is the desired behavior or not?
Reply


Messages In This Thread
Problem with detecting commands when custom namespace is declared - by michalsn - 04-15-2020, 11:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB