Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Constraint.php

function Constraint::getErrorName

Returns the name of the given error code.

Throws

InvalidArgumentException If the error code does not exist

File

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

Class

Constraint
Contains the properties of a constraint definition.

Namespace

Symfony\Component\Validator

Code

public static function getErrorName(string $errorCode) : string {
    if (isset(static::ERROR_NAMES[$errorCode])) {
        return static::ERROR_NAMES[$errorCode];
    }
    throw new InvalidArgumentException(\sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, static::class));
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal