X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fvalidator%2FConstraint.php;fp=vendor%2Fsymfony%2Fvalidator%2FConstraint.php;h=45d4bcf41a4b8a0bae26cc56486a1f413ba2ffa7;hp=c5890c658aeaec6acdc11376be6a7295fc2e6768;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/vendor/symfony/validator/Constraint.php b/vendor/symfony/validator/Constraint.php index c5890c658..45d4bcf41 100644 --- a/vendor/symfony/validator/Constraint.php +++ b/vendor/symfony/validator/Constraint.php @@ -70,11 +70,7 @@ abstract class Constraint public static function getErrorName($errorCode) { if (!isset(static::$errorNames[$errorCode])) { - throw new InvalidArgumentException(sprintf( - 'The error code "%s" does not exist for constraint of type "%s".', - $errorCode, - get_called_class() - )); + throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, \get_called_class())); } return static::$errorNames[$errorCode]; @@ -116,15 +112,15 @@ abstract class Constraint // The "groups" option is added to the object lazily $knownOptions['groups'] = true; - if (is_array($options) && count($options) >= 1 && isset($options['value']) && !property_exists($this, 'value')) { + if (\is_array($options) && \count($options) >= 1 && isset($options['value']) && !property_exists($this, 'value')) { $options[$this->getDefaultOption()] = $options['value']; unset($options['value']); } - if (is_array($options)) { + if (\is_array($options)) { reset($options); } - if (is_array($options) && count($options) > 0 && is_string(key($options))) { + if (\is_array($options) && \count($options) > 0 && \is_string(key($options))) { foreach ($options as $option => $value) { if (array_key_exists($option, $knownOptions)) { $this->$option = $value; @@ -133,13 +129,11 @@ abstract class Constraint $invalidOptions[] = $option; } } - } elseif (null !== $options && !(is_array($options) && 0 === count($options))) { + } elseif (null !== $options && !(\is_array($options) && 0 === \count($options))) { $option = $this->getDefaultOption(); if (null === $option) { - throw new ConstraintDefinitionException( - sprintf('No default option is configured for constraint %s', get_class($this)) - ); + throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint %s', \get_class($this))); } if (array_key_exists($option, $knownOptions)) { @@ -150,18 +144,12 @@ abstract class Constraint } } - if (count($invalidOptions) > 0) { - throw new InvalidOptionsException( - sprintf('The options "%s" do not exist in constraint %s', implode('", "', $invalidOptions), get_class($this)), - $invalidOptions - ); + if (\count($invalidOptions) > 0) { + throw new InvalidOptionsException(sprintf('The options "%s" do not exist in constraint %s', implode('", "', $invalidOptions), \get_class($this)), $invalidOptions); } - if (count($missingOptions) > 0) { - throw new MissingOptionsException( - sprintf('The options "%s" must be set for constraint %s', implode('", "', array_keys($missingOptions)), get_class($this)), - array_keys($missingOptions) - ); + if (\count($missingOptions) > 0) { + throw new MissingOptionsException(sprintf('The options "%s" must be set for constraint %s', implode('", "', array_keys($missingOptions)), \get_class($this)), array_keys($missingOptions)); } } @@ -185,7 +173,7 @@ abstract class Constraint return; } - throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option)); + throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), array($option)); } /** @@ -211,7 +199,7 @@ abstract class Constraint return $this->groups; } - throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option)); + throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), array($option)); } /** @@ -231,7 +219,7 @@ abstract class Constraint */ public function addImplicitGroupName($group) { - if (in_array(self::DEFAULT_GROUP, $this->groups) && !in_array($group, $this->groups)) { + if (\in_array(self::DEFAULT_GROUP, $this->groups) && !\in_array($group, $this->groups)) { $this->groups[] = $group; } } @@ -274,7 +262,7 @@ abstract class Constraint */ public function validatedBy() { - return get_class($this).'Validator'; + return \get_class($this).'Validator'; } /**