comparison vendor/symfony/dependency-injection/ContainerBuilder.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 1fec387a4317
children 129ea1e6d783
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
122 private $autoconfiguredInstanceof = array(); 122 private $autoconfiguredInstanceof = array();
123 123
124 private $removedIds = array(); 124 private $removedIds = array();
125 private $alreadyLoading = array(); 125 private $alreadyLoading = array();
126 126
127 private static $internalTypes = array(
128 'int' => true,
129 'float' => true,
130 'string' => true,
131 'bool' => true,
132 'resource' => true,
133 'object' => true,
134 'array' => true,
135 'null' => true,
136 'callable' => true,
137 'iterable' => true,
138 'mixed' => true,
139 );
140
127 public function __construct(ParameterBagInterface $parameterBag = null) 141 public function __construct(ParameterBagInterface $parameterBag = null)
128 { 142 {
129 parent::__construct($parameterBag); 143 parent::__construct($parameterBag);
130 144
131 $this->trackResources = interface_exists('Symfony\Component\Config\Resource\ResourceInterface'); 145 $this->trackResources = interface_exists('Symfony\Component\Config\Resource\ResourceInterface');
339 public function getReflectionClass($class, $throw = true) 353 public function getReflectionClass($class, $throw = true)
340 { 354 {
341 if (!$class = $this->getParameterBag()->resolveValue($class)) { 355 if (!$class = $this->getParameterBag()->resolveValue($class)) {
342 return; 356 return;
343 } 357 }
358
359 if (isset(self::$internalTypes[$class])) {
360 return null;
361 }
362
344 $resource = null; 363 $resource = null;
345 364
346 try { 365 try {
347 if (isset($this->classReflectors[$class])) { 366 if (isset($this->classReflectors[$class])) {
348 $classReflector = $this->classReflectors[$class]; 367 $classReflector = $this->classReflectors[$class];
1387 if (!\is_string($value) || 38 > \strlen($value)) { 1406 if (!\is_string($value) || 38 > \strlen($value)) {
1388 return $value; 1407 return $value;
1389 } 1408 }
1390 $envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders; 1409 $envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders;
1391 1410
1411 $completed = false;
1392 foreach ($envPlaceholders as $env => $placeholders) { 1412 foreach ($envPlaceholders as $env => $placeholders) {
1393 foreach ($placeholders as $placeholder) { 1413 foreach ($placeholders as $placeholder) {
1394 if (false !== stripos($value, $placeholder)) { 1414 if (false !== stripos($value, $placeholder)) {
1395 if (true === $format) { 1415 if (true === $format) {
1396 $resolved = $bag->escapeValue($this->getEnv($env)); 1416 $resolved = $bag->escapeValue($this->getEnv($env));
1397 } else { 1417 } else {
1398 $resolved = sprintf($format, $env); 1418 $resolved = sprintf($format, $env);
1399 } 1419 }
1400 if ($placeholder === $value) { 1420 if ($placeholder === $value) {
1401 $value = $resolved; 1421 $value = $resolved;
1422 $completed = true;
1402 } else { 1423 } else {
1403 if (!is_string($resolved) && !is_numeric($resolved)) { 1424 if (!is_string($resolved) && !is_numeric($resolved)) {
1404 throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type %s inside string value "%s".', $env, gettype($resolved), $value)); 1425 throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type %s inside string value "%s".', $env, gettype($resolved), $this->resolveEnvPlaceholders($value)));
1405 } 1426 }
1406 $value = str_ireplace($placeholder, $resolved, $value); 1427 $value = str_ireplace($placeholder, $resolved, $value);
1407 } 1428 }
1408 $usedEnvs[$env] = $env; 1429 $usedEnvs[$env] = $env;
1409 $this->envCounters[$env] = isset($this->envCounters[$env]) ? 1 + $this->envCounters[$env] : 1; 1430 $this->envCounters[$env] = isset($this->envCounters[$env]) ? 1 + $this->envCounters[$env] : 1;
1431
1432 if ($completed) {
1433 break 2;
1434 }
1410 } 1435 }
1411 } 1436 }
1412 } 1437 }
1413 1438
1414 return $value; 1439 return $value;
1452 /** 1477 /**
1453 * @final 1478 * @final
1454 */ 1479 */
1455 public function log(CompilerPassInterface $pass, $message) 1480 public function log(CompilerPassInterface $pass, $message)
1456 { 1481 {
1457 $this->getCompiler()->log($pass, $message); 1482 $this->getCompiler()->log($pass, $this->resolveEnvPlaceholders($message));
1458 } 1483 }
1459 1484
1460 /** 1485 /**
1461 * {@inheritdoc} 1486 * {@inheritdoc}
1462 */ 1487 */