[DI] fix dumping errored definitions
This commit is contained in:
parent
4103a6ebd2
commit
8179928336
|
@ -794,21 +794,27 @@ EOF;
|
||||||
EOF;
|
EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->serviceCalls = [];
|
if ($definition->hasErrors() && $e = $definition->getErrors()) {
|
||||||
$this->inlinedDefinitions = $this->getDefinitionsFromArguments([$definition], null, $this->serviceCalls);
|
$this->addThrow = true;
|
||||||
|
|
||||||
if ($definition->isDeprecated()) {
|
$code .= sprintf(" \$this->throw(%s);\n", $this->export(reset($e)));
|
||||||
$code .= sprintf(" @trigger_error(%s, E_USER_DEPRECATED);\n\n", $this->export($definition->getDeprecationMessage($id)));
|
} else {
|
||||||
|
$this->serviceCalls = [];
|
||||||
|
$this->inlinedDefinitions = $this->getDefinitionsFromArguments([$definition], null, $this->serviceCalls);
|
||||||
|
|
||||||
|
if ($definition->isDeprecated()) {
|
||||||
|
$code .= sprintf(" @trigger_error(%s, E_USER_DEPRECATED);\n\n", $this->export($definition->getDeprecationMessage($id)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->getProxyDumper()->isProxyCandidate($definition)) {
|
||||||
|
$factoryCode = $asFile ? ($definition->isShared() ? "\$this->load('%s.php', false)" : '$this->factories[%2$s](false)') : '$this->%s(false)';
|
||||||
|
$code .= $this->getProxyDumper()->getProxyFactoryCode($definition, $id, sprintf($factoryCode, $methodName, $this->doExport($id)));
|
||||||
|
}
|
||||||
|
|
||||||
|
$code .= $this->addServiceInclude($id, $definition);
|
||||||
|
$code .= $this->addInlineService($id, $definition);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->getProxyDumper()->isProxyCandidate($definition)) {
|
|
||||||
$factoryCode = $asFile ? ($definition->isShared() ? "\$this->load('%s.php', false)" : '$this->factories[%2$s](false)') : '$this->%s(false)';
|
|
||||||
$code .= $this->getProxyDumper()->getProxyFactoryCode($definition, $id, sprintf($factoryCode, $methodName, $this->doExport($id)));
|
|
||||||
}
|
|
||||||
|
|
||||||
$code .= $this->addServiceInclude($id, $definition);
|
|
||||||
$code .= $this->addInlineService($id, $definition);
|
|
||||||
|
|
||||||
if ($asFile) {
|
if ($asFile) {
|
||||||
$code = implode("\n", array_map(function ($line) { return $line ? substr($line, 8) : $line; }, explode("\n", $code)));
|
$code = implode("\n", array_map(function ($line) { return $line ? substr($line, 8) : $line; }, explode("\n", $code)));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -120,6 +120,11 @@ class Symfony_DI_PhpDumper_Service_Locator_Argument extends Container
|
||||||
*/
|
*/
|
||||||
protected function getFoo4Service()
|
protected function getFoo4Service()
|
||||||
{
|
{
|
||||||
return $this->privates['foo4'] = new \stdClass();
|
$this->throw('BOOM');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function throw($message)
|
||||||
|
{
|
||||||
|
throw new RuntimeException($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue