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