Bug Report
Subject
Details
Rector version
v2.6.1
This rector replaces named services with non-existing FQCN services.
Minimal PHP Code Causing Issue
I have the following services:
rule.engine.payment.options :
class : AppBundle\RuleEngine\Rules\MoleculeRule
public : true
arguments :
$rules :
- # my rules
rule.engine.delivery.options :
class : AppBundle\RuleEngine\Rules\MoleculeRule
public : true
arguments :
$rules :
- # my rules
Note
There is no AppBundle\RuleEngine\Rules\MoleculeRule service!
Rector replaces the named rule with a non-existing FQCN service:
- $rule = static::getContainer()->get('rule.engine.payment.options');
+ $rule = static::getContainer()->get(\AppBundle\RuleEngine\Rules\MoleculeRule::class);
Expected Behaviour
While it's fine for something like
- static::getContainer()->get('request_stack')->push($request);
+ static::getContainer()->get(\Symfony\Component\HttpFoundation\RequestStack::class)->push($request);
or
- $this->twig = $this->getContainer()->get('twig');
+ $this->twig = $this->getContainer()->get(\Twig\Environment::class);
Rector should skip it when there's no explicit and unambiguous FQCN service for it.
Bug Report
This rector replaces named services with non-existing FQCN services.
Minimal PHP Code Causing Issue
I have the following services:
Note
There is no
AppBundle\RuleEngine\Rules\MoleculeRuleservice!Rector replaces the named rule with a non-existing FQCN service:
Expected Behaviour
While it's fine for something like
or
Rector should skip it when there's no explicit and unambiguous FQCN service for it.