You are here

public static function Constraint::getErrorName in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Constraint.php \Symfony\Component\Validator\Constraint::getErrorName()

Returns the name of the given error code.

Parameters

int $errorCode The error code:

Return value

string The name of the error code

Throws

InvalidArgumentException If the error code does not exist

1 call to Constraint::getErrorName()
ConstraintTest::testGetErrorNameForUnknownCode in vendor/symfony/validator/Tests/ConstraintTest.php
@expectedException \Symfony\Component\Validator\Exception\InvalidArgumentException

File

vendor/symfony/validator/Constraint.php, line 78

Class

Constraint
Contains the properties of a constraint definition.

Namespace

Symfony\Component\Validator

Code

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()));
  }
  return static::$errorNames[$errorCode];
}