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];
// 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;
$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)) {
}
}
- 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));
}
}
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));
}
/**
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));
}
/**
*/
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;
}
}
*/
public function validatedBy()
{
- return get_class($this).'Validator';
+ return \get_class($this).'Validator';
}
/**