[DI] Minor fixes in FactoryReturnTypePass
This commit is contained in:
parent
1678303549
commit
c231f811b5
@ -58,7 +58,7 @@ class FactoryReturnTypePass implements CompilerPassInterface
|
|||||||
if ($factory[0] instanceof Reference) {
|
if ($factory[0] instanceof Reference) {
|
||||||
$previous[$id] = true;
|
$previous[$id] = true;
|
||||||
$factoryDefinition = $container->findDefinition((string) $factory[0]);
|
$factoryDefinition = $container->findDefinition((string) $factory[0]);
|
||||||
$this->updateDefinition($container, (string) $factory[0], $factoryDefinition, $previous);
|
$this->updateDefinition($container, strtolower($factory[0]), $factoryDefinition, $previous);
|
||||||
$class = $factoryDefinition->getClass();
|
$class = $factoryDefinition->getClass();
|
||||||
} else {
|
} else {
|
||||||
$class = $factory[0];
|
$class = $factory[0];
|
||||||
@ -73,12 +73,12 @@ class FactoryReturnTypePass implements CompilerPassInterface
|
|||||||
|
|
||||||
$returnType = $m->getReturnType();
|
$returnType = $m->getReturnType();
|
||||||
if (null !== $returnType && !$returnType->isBuiltin()) {
|
if (null !== $returnType && !$returnType->isBuiltin()) {
|
||||||
$returnType = (string) $returnType;
|
$returnType = $returnType instanceof \ReflectionNamedType ? $returnType->getName() : $returnType->__toString();
|
||||||
if (null !== $class) {
|
if (null !== $class) {
|
||||||
$declaringClass = $m->getDeclaringClass()->getName();
|
$declaringClass = $m->getDeclaringClass()->getName();
|
||||||
if ('self' === $returnType) {
|
if ('self' === strtolower($returnType)) {
|
||||||
$returnType = $declaringClass;
|
$returnType = $declaringClass;
|
||||||
} elseif ('parent' === $returnType) {
|
} elseif ('parent' === strtolower($returnType)) {
|
||||||
$returnType = get_parent_class($declaringClass) ?: null;
|
$returnType = get_parent_class($declaringClass) ?: null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,12 +91,12 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||||||
private $usedTags = array();
|
private $usedTags = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[][] A map of env var names to their placeholders
|
* @var string[][] a map of env var names to their placeholders
|
||||||
*/
|
*/
|
||||||
private $envPlaceholders = array();
|
private $envPlaceholders = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int[] A map of env vars to their resolution counter.
|
* @var int[] a map of env vars to their resolution counter
|
||||||
*/
|
*/
|
||||||
private $envCounters = array();
|
private $envCounters = array();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user