Skip to content

[CodeQuality] Skip AbstractUid instances on ControllerMethodInjectionToConstructorRector #9660

@kevin-emo

Description

@kevin-emo

Bug Report

Subject Details
Rector version 2.3.7

This is the same issue type as #9639 .

AbstractUid instances such as UuidV4 can be injected in Controllers, therefor, they should not be moved to Constructors.

https://github.com/symfony/uid/blob/8.0/AbstractUid.php

Minimal PHP Code Causing Issue

https://getrector.com/demo/62c7fbd6-82fe-4186-8175-a9cce4cb9ae6

<?php

 use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
 use Symfony\Component\Routing\Annotation\Route;
 use Symfony\Component\Uid\UuidV4;

 final class HelloController extends AbstractController
 {
     #[Route('/path/{uuid}', name: 'name')]
     public function someAction(
        UuidV4 $uuid,
     ) {
         return $this->render('template.html.twig');
     }
 }

Expected Behaviour

Skip it.

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