Skip to content

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

@gugglegum

Description

@gugglegum

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions