Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong autoload/psr-4 in composer.json #306

Open
gugglegum opened this issue Nov 3, 2023 · 0 comments
Open

Wrong autoload/psr-4 in composer.json #306

gugglegum opened this issue Nov 3, 2023 · 0 comments
Assignees
Labels

Comments

@gugglegum
Copy link
Contributor

gugglegum commented Nov 3, 2023

Describe the bug

For some reason, autoload.psr-4 section is generated wrong when used custom namespace.

To Reproduce

Here's the generating code:

$options = GeneratorOptions::instance();
$options->setOrigin('https://**********.com/test/wsdl/inventory2.0.0RC4/InventoryService.wsdl')
    ->setDestination(__DIR__ . '/../test-wsdl-driver')
    ->setSrcDirname('src')
    ->setNamespace('My\Specific\Namespace\Wsdl')
    ->setNamespaceDictatesDirectories(false)
    ->setComposerName('test/test-wsdl-driver');
// Generator instantiation
$generator = new Generator($options);
// Package generation
$generator->generatePackage();

For some reason autoload section in composer.json contains a namespace after src folder:

    "autoload": {
        "psr-4": {
            "My\\Specific\\Namespace\\Wsdl\\": "./src\\My\\Specific\\Namespace\\Wsdl"
        }
    }

Expected behavior

I expect that according to setNamespaceDictatesDirectories(false) the root of WSDL code will be placed in the src folder and autoload section will look like:

    "autoload": {
        "psr-4": {
            "My\\Specific\\Namespace\\Wsdl\\": "src/"
        }
    }

Additional context

It would also be great if I could specify setSrcDirname('src/Inventory') and setNamespace('My\Specific\Namespace\Wsdl\Inventory'), but autoload.psr-4 would still be "My\\Specific\\Namespace\\Wsdl\\": "src/". This can be useful if I want to group multiple WSDL libraries in one composer package. Each actual WSDL library will be placed in a separate subfolder within src folder, but with a common root namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants