projects
/
yaffs-website
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added the Search API Synonym module to deal specifically with licence and license...
[yaffs-website]
/
vendor
/
symfony
/
dependency-injection
/
Compiler
/
ResolveChildDefinitionsPass.php
diff --git
a/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php
b/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php
index a124e472aca8105a992d99fb182ec962b5fed2b8..d647eda2376c0b0c7a8617586db15b62d218ca72 100644
(file)
--- a/
vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php
+++ b/
vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php
@@
-15,6
+15,7
@@
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\ExceptionInterface;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\ExceptionInterface;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
+use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
/**
* This replaces all ChildDefinition instances with their equivalent fully
/**
* This replaces all ChildDefinition instances with their equivalent fully
@@
-25,6
+26,8
@@
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
*/
class ResolveChildDefinitionsPass extends AbstractRecursivePass
{
*/
class ResolveChildDefinitionsPass extends AbstractRecursivePass
{
+ private $currentPath;
+
protected function processValue($value, $isRoot = false)
{
if (!$value instanceof Definition) {
protected function processValue($value, $isRoot = false)
{
if (!$value instanceof Definition) {
@@
-36,6
+39,7
@@
class ResolveChildDefinitionsPass extends AbstractRecursivePass
$value = $this->container->getDefinition($this->currentId);
}
if ($value instanceof ChildDefinition) {
$value = $this->container->getDefinition($this->currentId);
}
if ($value instanceof ChildDefinition) {
+ $this->currentPath = array();
$value = $this->resolveDefinition($value);
if ($isRoot) {
$this->container->setDefinition($this->currentId, $value);
$value = $this->resolveDefinition($value);
if ($isRoot) {
$this->container->setDefinition($this->currentId, $value);
@@
-56,6
+60,8
@@
class ResolveChildDefinitionsPass extends AbstractRecursivePass
{
try {
return $this->doResolveDefinition($definition);
{
try {
return $this->doResolveDefinition($definition);
+ } catch (ServiceCircularReferenceException $e) {
+ throw $e;
} catch (ExceptionInterface $e) {
$r = new \ReflectionProperty($e, 'message');
$r->setAccessible(true);
} catch (ExceptionInterface $e) {
$r = new \ReflectionProperty($e, 'message');
$r->setAccessible(true);
@@
-71,6
+77,13
@@
class ResolveChildDefinitionsPass extends AbstractRecursivePass
throw new RuntimeException(sprintf('Parent definition "%s" does not exist.', $parent));
}
throw new RuntimeException(sprintf('Parent definition "%s" does not exist.', $parent));
}
+ $searchKey = array_search($parent, $this->currentPath);
+ $this->currentPath[] = $parent;
+
+ if (false !== $searchKey) {
+ throw new ServiceCircularReferenceException($parent, \array_slice($this->currentPath, $searchKey));
+ }
+
$parentDef = $this->container->findDefinition($parent);
if ($parentDef instanceof ChildDefinition) {
$id = $this->currentId;
$parentDef = $this->container->findDefinition($parent);
if ($parentDef instanceof ChildDefinition) {
$id = $this->currentId;
@@
-103,7
+116,7
@@
class ResolveChildDefinitionsPass extends AbstractRecursivePass
$def->setAutowired($parentDef->isAutowired());
$def->setChanges($parentDef->getChanges());
$def->setAutowired($parentDef->isAutowired());
$def->setChanges($parentDef->getChanges());
- $def->setBindings($parentDef->getBindings());
+ $def->setBindings($
definition->getBindings() + $
parentDef->getBindings());
// overwrite with values specified in the decorator
$changes = $definition->getChanges();
// overwrite with values specified in the decorator
$changes = $definition->getChanges();
@@
-150,7
+163,7
@@
class ResolveChildDefinitionsPass extends AbstractRecursivePass
if (is_numeric($k)) {
$def->addArgument($v);
} elseif (0 === strpos($k, 'index_')) {
if (is_numeric($k)) {
$def->addArgument($v);
} elseif (0 === strpos($k, 'index_')) {
- $def->replaceArgument((int) substr($k, strlen('index_')), $v);
+ $def->replaceArgument((int) substr($k,
\
strlen('index_')), $v);
} else {
$def->setArgument($k, $v);
}
} else {
$def->setArgument($k, $v);
}