Skip to content

Impossible to use maker to generate code #1390

@mamadoumouctar

Description

@mamadoumouctar

Symfony version(s) affected

7.0.0

Description

After installing version 7 of symfony, it is impossible to use make to gender code because the compilation system sends the wrong class to "Symfony\Bundle\MakerBundle\Util\MakerFileLinkFormatter" in the maker bundle.

How to reproduce

Install symfony with the webapp option then try to generate controllers, voters... You can alway get the same error message

Possible Solution

Remove the type FileLinkFormatter $fileLinkFormatter to the constructor of "Symfony\Bundle\MakerBundle\Util\MakerFileLinkFormatter" like this.

public function __construct(
        private $fileLinkFormatter = null,
    ) {
    }

after try to generate code

Additional Context

I execute this command and get the following output

symfony console make:controller Home
TypeError {#203
  #message: "Symfony\Bundle\MakerBundle\Util\MakerFileLinkFormatter::__construct(): Argument symfony/symfony#1 ($fileLinkFormatter) must be of type ?Symfony\Component\HttpKernel\Debug\FileLinkFormatter, Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter given, called in C:\Lab\php\first-symfony-7\var\cache\dev\ContainerCiS97zf\getMaker_FileLinkFormatterService.php on line 22"
  #code: 0
  #file: "C:\Lab\php\first-symfony-7\vendor\symfony\maker-bundle\src\Util\MakerFileLinkFormatter.php"
  #line: 22
  trace: {
    C:\Lab\php\first-symfony-7\vendor\symfony\maker-bundle\src\Util\MakerFileLinkFormatter.php:22 { …}
    C:\Lab\php\first-symfony-7\var\cache\dev\ContainerCiS97zf\getMaker_FileLinkFormatterService.php:22 {
      ContainerCiS97zf\getMaker_FileLinkFormatterService::do($container, $lazyLoad = true)^
      ›     //dd(self::getDebug_FileLinkFormatterService($container));
      ›     return $container->privates['maker.file_link_formatter'] = new \Symfony\Bundle\MakerBundle\Util\MakerFileLinkFormatter(($container->privates['debug.file_link_formatter'] ?? self::getDebug_FileLinkFormatterService($container)));
      › }
    }
    C:\Lab\php\first-symfony-7\var\cache\dev\ContainerCiS97zf\App_KernelDevDebugContainer.php:479 { …}
    C:\Lab\php\first-symfony-7\var\cache\dev\ContainerCiS97zf\getMaker_FileManagerService.php:25 { …}
    C:\Lab\php\first-symfony-7\var\cache\dev\ContainerCiS97zf\App_KernelDevDebugContainer.php:479 { …}
    C:\Lab\php\first-symfony-7\var\cache\dev\ContainerCiS97zf\getMaker_PhpCompatUtilService.php:22 { …}
    C:\Lab\php\first-symfony-7\var\cache\dev\ContainerCiS97zf\App_KernelDevDebugContainer.php:479 { …}
    C:\Lab\php\first-symfony-7\var\cache\dev\ContainerCiS97zf\getMaker_AutoCommand_MakeControllerService.php:27 { …}
    C:\Lab\php\first-symfony-7\var\cache\dev\ContainerCiS97zf\App_KernelDevDebugContainer.php:479 { …}
    C:\Lab\php\first-symfony-7\var\cache\dev\ContainerCiS97zf\get_Maker_AutoCommand_MakeController_LazyService.php:23 { …}
    C:\Lab\php\first-symfony-7\vendor\symfony\console\Command\LazyCommand.php:185 { …}
    C:\Lab\php\first-symfony-7\vendor\symfony\console\Application.php:314 { …}
    C:\Lab\php\first-symfony-7\vendor\symfony\framework-bundle\Console\Application.php:79 { …}
    C:\Lab\php\first-symfony-7\vendor\symfony\console\Application.php:169 { …}
    C:\Lab\php\first-symfony-7\vendor\symfony\runtime\Runner\Symfony\ConsoleApplicationRunner.php:49 { …}
    C:\Lab\php\first-symfony-7\vendor\autoload_runtime.php:29 { …}
    C:\Lab\php\first-symfony-7\bin\console:11 { …}
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions