src/Leevel/Kernel/Console/Autoload.php
protected function appNamespaces(): array
    {
        $path = $this->app->path().'/composer.json';

        if (!is_file($path)) {
            return [];
        }

        $options = $this->getFileContent($path);

        $appNamespaces = $options['autoload']['psr-4'] ?? [];

        if ($appNamespaces) {
            $appNamespaces = array_map(function (string $value) {
                return rtrim($value, '\\');
            }, array_keys($appNamespaces));
        }

        $extraNamespaces = $options['extra']['leevel-console']['autoload']['namespaces'] ?? [];

        return array_merge($appNamespaces, $extraNamespaces);
    }
protected function appNamespaces(): array
    {
        $path = $this->app->path().'/composer.json';

        if (!is_file($path)) {
            return [];
        }

        $options = $this->getFileContent($path);

        $appNamespaces = $options['autoload']['psr-4'] ?? [];

        if ($appNamespaces) {
            $appNamespaces = array_map(function (string $value) {
                return rtrim($value, '\\');
            }, array_keys($appNamespaces));
        }

        $extraNamespaces = $options['extra']['leevel-console']['autoload']['namespaces'] ?? [];

        return array_merge($appNamespaces, $extraNamespaces);
    }
取得应用的 composer 命名空间配置.

@return array