Skip to content

Commit 114ce12

Browse files
[DI] Minor fixes in FactoryReturnTypePass
1 parent 22283bb commit 114ce12

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Compiler/FactoryReturnTypePass.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private function updateDefinition(ContainerBuilder $container, $id, Definition $
5858
if ($factory[0] instanceof Reference) {
5959
$previous[$id] = true;
6060
$factoryDefinition = $container->findDefinition((string) $factory[0]);
61-
$this->updateDefinition($container, (string) $factory[0], $factoryDefinition, $previous);
61+
$this->updateDefinition($container, strtolower($factory[0]), $factoryDefinition, $previous);
6262
$class = $factoryDefinition->getClass();
6363
} else {
6464
$class = $factory[0];
@@ -73,12 +73,12 @@ private function updateDefinition(ContainerBuilder $container, $id, Definition $
7373

7474
$returnType = $m->getReturnType();
7575
if (null !== $returnType && !$returnType->isBuiltin()) {
76-
$returnType = (string) $returnType;
76+
$returnType = $returnType instanceof \ReflectionNamedType ? $returnType->getName() : $returnType->__toString();
7777
if (null !== $class) {
7878
$declaringClass = $m->getDeclaringClass()->getName();
79-
if ('self' === $returnType) {
79+
if ('self' === strtolower($returnType)) {
8080
$returnType = $declaringClass;
81-
} elseif ('parent' === $returnType) {
81+
} elseif ('parent' === strtolower($returnType)) {
8282
$returnType = get_parent_class($declaringClass) ?: null;
8383
}
8484
}

ContainerBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
9191
private $usedTags = array();
9292

9393
/**
94-
* @var string[][] A map of env var names to their placeholders
94+
* @var string[][] a map of env var names to their placeholders
9595
*/
9696
private $envPlaceholders = array();
9797

9898
/**
99-
* @var int[] A map of env vars to their resolution counter.
99+
* @var int[] a map of env vars to their resolution counter
100100
*/
101101
private $envCounters = array();
102102

0 commit comments

Comments
 (0)