comparison vendor/symfony/validator/ContainerConstraintValidatorFactory.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 private $validators; 26 private $validators;
27 27
28 public function __construct(ContainerInterface $container) 28 public function __construct(ContainerInterface $container)
29 { 29 {
30 $this->container = $container; 30 $this->container = $container;
31 $this->validators = array(); 31 $this->validators = [];
32 } 32 }
33 33
34 /** 34 /**
35 * {@inheritdoc} 35 * {@inheritdoc}
36 * 36 *
44 if (!isset($this->validators[$name])) { 44 if (!isset($this->validators[$name])) {
45 if ($this->container->has($name)) { 45 if ($this->container->has($name)) {
46 $this->validators[$name] = $this->container->get($name); 46 $this->validators[$name] = $this->container->get($name);
47 } else { 47 } else {
48 if (!class_exists($name)) { 48 if (!class_exists($name)) {
49 throw new ValidatorException(sprintf('Constraint validator "%s" does not exist or it is not enabled. Check the "validatedBy" method in your constraint class "%s".', $name, get_class($constraint))); 49 throw new ValidatorException(sprintf('Constraint validator "%s" does not exist or is not enabled. Check the "validatedBy" method in your constraint class "%s".', $name, \get_class($constraint)));
50 } 50 }
51 51
52 $this->validators[$name] = new $name(); 52 $this->validators[$name] = new $name();
53 } 53 }
54 } 54 }