Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b649e6a

Browse filesBrowse files
committed
Fix an assignation
1 parent 98481b9 commit b649e6a
Copy full SHA for b649e6a

File tree

1 file changed

+12
-10
lines changed
Filter options

1 file changed

+12
-10
lines changed

‎src/Symfony/Component/DependencyInjection/Util/ServiceTypeHelper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Util/ServiceTypeHelper.php
+12-10Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
final class ServiceTypeHelper
2424
{
25-
private static $classNames;
25+
private static $classNames = array();
2626
private $container;
2727
private $typeMap;
2828

@@ -69,12 +69,14 @@ private function populateAvailableTypes()
6969
};
7070
spl_autoload_register($throwingAutoloader);
7171

72-
$this->typeMap = array();
73-
foreach ($this->container->getDefinitions() as $id => $definition) {
74-
$this->populateAvailableType($id, $definition);
72+
try {
73+
$this->typeMap = array();
74+
foreach ($this->container->getDefinitions() as $id => $definition) {
75+
$this->populateAvailableType($id, $definition);
76+
}
77+
} finally {
78+
spl_autoload_unregister($throwingAutoloader);
7579
}
76-
77-
spl_autoload_unregister($throwingAutoloader);
7880
}
7981

8082
/**
@@ -128,16 +130,16 @@ private function getClass(Definition $definition)
128130

129131
// Normalize the class name (`\Foo` -> `Foo`)
130132
$class = $this->container->getParameterBag()->resolveValue($class);
131-
if (isset(self::$classNames[$class])) {
132-
return self::$classNames[$class] ?: null;
133+
if (array_key_exists($class, self::$classNames)) {
134+
return self::$classNames[$class];
133135
}
134136

135137
try {
136138
$name = (new \ReflectionClass($class))->name;
137139
} catch (\ReflectionException $e) {
138-
$name = false;
140+
$name = null;
139141
}
140142

141-
return self::$classNames[$class] = $name ?: null;
143+
return self::$classNames[$class] = $name;
142144
}
143145
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.