You are here

public static function Constraint::getErrorName in Plug 7

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 lib/Symfony/validator/Symfony/Component/Validator/Tests/ConstraintTest.php
@expectedException \Symfony\Component\Validator\Exception\InvalidArgumentException

File

lib/Symfony/validator/Symfony/Component/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];
}