Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
9 * file that was distributed with this source code. | 9 * file that was distributed with this source code. |
10 */ | 10 */ |
11 | 11 |
12 namespace Symfony\Component\DependencyInjection\Compiler; | 12 namespace Symfony\Component\DependencyInjection\Compiler; |
13 | 13 |
14 use Symfony\Component\DependencyInjection\ContainerBuilder; | |
14 use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; | 15 use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; |
15 use Symfony\Component\DependencyInjection\ContainerBuilder; | |
16 | 16 |
17 /** | 17 /** |
18 * Checks your services for circular references. | 18 * Checks your services for circular references. |
19 * | 19 * |
20 * References from method calls are ignored since we might be able to resolve | 20 * References from method calls are ignored since we might be able to resolve |
34 */ | 34 */ |
35 public function process(ContainerBuilder $container) | 35 public function process(ContainerBuilder $container) |
36 { | 36 { |
37 $graph = $container->getCompiler()->getServiceReferenceGraph(); | 37 $graph = $container->getCompiler()->getServiceReferenceGraph(); |
38 | 38 |
39 $this->checkedNodes = array(); | 39 $this->checkedNodes = []; |
40 foreach ($graph->getNodes() as $id => $node) { | 40 foreach ($graph->getNodes() as $id => $node) { |
41 $this->currentPath = array($id); | 41 $this->currentPath = [$id]; |
42 | 42 |
43 $this->checkOutEdges($node->getOutEdges()); | 43 $this->checkOutEdges($node->getOutEdges()); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
62 if (!$node->getValue() || (!$edge->isLazy() && !$edge->isWeak())) { | 62 if (!$node->getValue() || (!$edge->isLazy() && !$edge->isWeak())) { |
63 $searchKey = array_search($id, $this->currentPath); | 63 $searchKey = array_search($id, $this->currentPath); |
64 $this->currentPath[] = $id; | 64 $this->currentPath[] = $id; |
65 | 65 |
66 if (false !== $searchKey) { | 66 if (false !== $searchKey) { |
67 throw new ServiceCircularReferenceException($id, array_slice($this->currentPath, $searchKey)); | 67 throw new ServiceCircularReferenceException($id, \array_slice($this->currentPath, $searchKey)); |
68 } | 68 } |
69 | 69 |
70 $this->checkOutEdges($node->getOutEdges()); | 70 $this->checkOutEdges($node->getOutEdges()); |
71 } | 71 } |
72 | 72 |