Skip to content

Generator example from DocBlock will not work #1371

@Antarian

Description

@Antarian

* $gen->createClassNameDetails('Cool\\Stuff\\Balloon', 'Controller', 'Controller');

In current implementation name either needs to be absolute, or to make it work generator code needs to change.
E.g. change line 150

$className = rtrim($fullNamespacePrefix, '\\').'\\'.Str::asClassName($name, $suffix);

to:

try {
    Validator::classDoesNotExist($name);
    $className = rtrim($fullNamespacePrefix, '\\').'\\'.Str::asClassName($name, $suffix);
} catch (RuntimeCommandException $e) {
    $className = $name;
}

This would have edge case if there is match with class even if $name value is only partial. But that should be very rare.
Like Prototype\\DummyEntity may exist and we really want "App\Entity\Prototype\DummyEntity".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions