public function ConstraintViolation::__toString

Converts the violation into a string for debugging purposes.

Return value

string The violation as string.

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/ConstraintViolation.php, line 96

Class

ConstraintViolation
Default implementation of {@ConstraintViolationInterface}.

Namespace

Symfony\Component\Validator

Code

public function __toString() {
  $class = (string) (is_object($this->root) ? get_class($this->root) : $this->root);
  $propertyPath = (string) $this->propertyPath;
  $code = $this->code;
  if ('' !== $propertyPath && '[' !== $propertyPath[0] && '' !== $class) {
    $class .= '.';
  }
  if (!empty($code)) {
    $code = ' (code ' . $code . ')';
  }
  return $class . $propertyPath . ":\n    " . $this
    ->getMessage() . $code;
}