bug #31442 [Validator] Fix finding translator parent definition in compiler pass (deguif)

This PR was merged into the 4.2 branch.

Discussion
----------

[Validator] Fix finding translator parent definition in compiler pass

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Method `ChildDefintion::getParent()` returns a string, but here it is expected to return an object of class `Definition` in order to call `getClass` on it in the loop.

Commits
-------

d261bb5dd1 Fix finding parent definition
This commit is contained in:
Nicolas Grekas 2019-05-11 11:53:29 +02:00
commit 3ae1e802ad

View File

@ -62,7 +62,7 @@ class AddValidatorInitializersPass implements CompilerPassInterface
}
while (!($class = $translator->getClass()) && $translator instanceof ChildDefinition) {
$translator = $translator->getParent();
$translator = $container->findDefinition($translator->getParent());
}
if (!is_subclass_of($class, LegacyTranslatorInterface::class)) {