Bug Report
| Subject |
Details |
| Rector version |
last dev-main |
| Installed as |
composer dependency |
When running the ControllerMethodInjectionToConstructorRector rule, Rector conflates parameters with the same name that were originally injecting different services. This results in the wrong service being used.
Minimal PHP Code Causing Issue
See https://getrector.com/demo/2d8eff48-9798-46f7-8b07-ded8716af201
<?php
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class ExampleController extends AbstractController
{
public function foo(Foo $service): void
{
dump($service);
}
public function bar(Bar $service): void
{
dump($service);
}
}
Responsible rules
ControllerMethodInjectionToConstructorRector
Expected Behaviour
It should skip these cases.
Thanks!