comparison vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.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
26 class ServiceReferenceGraph 26 class ServiceReferenceGraph
27 { 27 {
28 /** 28 /**
29 * @var ServiceReferenceGraphNode[] 29 * @var ServiceReferenceGraphNode[]
30 */ 30 */
31 private $nodes = array(); 31 private $nodes = [];
32 32
33 /** 33 /**
34 * Checks if the graph has a specific node. 34 * Checks if the graph has a specific node.
35 * 35 *
36 * @param string $id Id to check 36 * @param string $id Id to check
76 public function clear() 76 public function clear()
77 { 77 {
78 foreach ($this->nodes as $node) { 78 foreach ($this->nodes as $node) {
79 $node->clear(); 79 $node->clear();
80 } 80 }
81 $this->nodes = array(); 81 $this->nodes = [];
82 } 82 }
83 83
84 /** 84 /**
85 * Connects 2 nodes together in the Graph. 85 * Connects 2 nodes together in the Graph.
86 * 86 *
89 * @param string $destId 89 * @param string $destId
90 * @param mixed $destValue 90 * @param mixed $destValue
91 * @param string $reference 91 * @param string $reference
92 * @param bool $lazy 92 * @param bool $lazy
93 * @param bool $weak 93 * @param bool $weak
94 * @param bool $byConstructor
94 */ 95 */
95 public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null/*, bool $lazy = false, bool $weak = false*/) 96 public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null/*, bool $lazy = false, bool $weak = false, bool $byConstructor = false*/)
96 { 97 {
97 $lazy = func_num_args() >= 6 ? func_get_arg(5) : false; 98 $lazy = \func_num_args() >= 6 ? func_get_arg(5) : false;
98 $weak = func_num_args() >= 7 ? func_get_arg(6) : false; 99 $weak = \func_num_args() >= 7 ? func_get_arg(6) : false;
100 $byConstructor = \func_num_args() >= 8 ? func_get_arg(7) : false;
99 101
100 if (null === $sourceId || null === $destId) { 102 if (null === $sourceId || null === $destId) {
101 return; 103 return;
102 } 104 }
103 105
104 $sourceNode = $this->createNode($sourceId, $sourceValue); 106 $sourceNode = $this->createNode($sourceId, $sourceValue);
105 $destNode = $this->createNode($destId, $destValue); 107 $destNode = $this->createNode($destId, $destValue);
106 $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference, $lazy, $weak); 108 $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference, $lazy, $weak, $byConstructor);
107 109
108 $sourceNode->addOutEdge($edge); 110 $sourceNode->addOutEdge($edge);
109 $destNode->addInEdge($edge); 111 $destNode->addInEdge($edge);
110 } 112 }
111 113