comparison vendor/symfony/dependency-injection/Compiler/Compiler.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
20 * @author Johannes M. Schmitt <schmittjoh@gmail.com> 20 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
21 */ 21 */
22 class Compiler 22 class Compiler
23 { 23 {
24 private $passConfig; 24 private $passConfig;
25 private $log = array(); 25 private $log = [];
26 private $loggingFormatter; 26 private $loggingFormatter;
27 private $serviceReferenceGraph; 27 private $serviceReferenceGraph;
28 28
29 public function __construct() 29 public function __construct()
30 { 30 {
77 * @param string $type The type of the pass 77 * @param string $type The type of the pass
78 * @param int $priority Used to sort the passes 78 * @param int $priority Used to sort the passes
79 */ 79 */
80 public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/) 80 public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/)
81 { 81 {
82 if (func_num_args() >= 3) { 82 if (\func_num_args() >= 3) {
83 $priority = func_get_arg(2); 83 $priority = func_get_arg(2);
84 } else { 84 } else {
85 if (__CLASS__ !== get_class($this)) { 85 if (__CLASS__ !== \get_class($this)) {
86 $r = new \ReflectionMethod($this, __FUNCTION__); 86 $r = new \ReflectionMethod($this, __FUNCTION__);
87 if (__CLASS__ !== $r->getDeclaringClass()->getName()) { 87 if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
88 @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED); 88 @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED);
89 } 89 }
90 } 90 }
113 * @final 113 * @final
114 */ 114 */
115 public function log(CompilerPassInterface $pass, $message) 115 public function log(CompilerPassInterface $pass, $message)
116 { 116 {
117 if (false !== strpos($message, "\n")) { 117 if (false !== strpos($message, "\n")) {
118 $message = str_replace("\n", "\n".get_class($pass).': ', trim($message)); 118 $message = str_replace("\n", "\n".\get_class($pass).': ', trim($message));
119 } 119 }
120 120
121 $this->log[] = get_class($pass).': '.$message; 121 $this->log[] = \get_class($pass).': '.$message;
122 } 122 }
123 123
124 /** 124 /**
125 * Returns the log. 125 * Returns the log.
126 * 126 *
139 try { 139 try {
140 foreach ($this->passConfig->getPasses() as $pass) { 140 foreach ($this->passConfig->getPasses() as $pass) {
141 $pass->process($container); 141 $pass->process($container);
142 } 142 }
143 } catch (\Exception $e) { 143 } catch (\Exception $e) {
144 $usedEnvs = array(); 144 $usedEnvs = [];
145 $prev = $e; 145 $prev = $e;
146 146
147 do { 147 do {
148 $msg = $prev->getMessage(); 148 $msg = $prev->getMessage();
149 149