Open
Description
Symfony version(s) affected
6.1.0
Description
Generating a custom class does not work as described in the Generator comment
https://github.com/symfony/maker-bundle/blob/main/src/Generator.php#L128-L132
/*
* // Full class names can also be passed. Imagine the user has an autoload
* // rule where Cool\Stuff lives in a "lib/" directory
* // Cool\Stuff\BalloonController
* $gen->createClassNameDetails('Cool\\Stuff\\Balloon', 'Controller', 'Controller');
*
*/
How to reproduce
Update composer.json to add the example in the documentation
"autoload": {
"psr-4": {
"Cool\\Stuff\\": "lib/",
"App\\": "src/",
Reload the class map:
composer dump
And in my generator, try to generate the example:
/*
* // Full class names can also be passed. Imagine the user has an autoload
* // rule where Cool\Stuff lives in a "lib/" directory
* // Cool\Stuff\BalloonController
* $gen->createClassNameDetails('Cool\\Stuff\\Balloon', 'Controller', 'Controller');
*/
$details = $generator->createClassNameDetails('Cool\\Stuff\\Balloon', 'Controller', 'Controller');
assert($details->getFullName() === 'Cool\\Stuff\\BalloonController');
Instead, its generator the full class name of "App\Controller\Cool\Stuff\BalloonController"
I've been hacking at this for a while, it might have something to do with the backslashes.
Possible Solution
No response
Additional Context
No response