private function getLineNumber(ConstraintViolation $violation)
{
if (!preg_match('/lines\\[(\\d+)\\]/', $violation->getPropertyPath(), $matches)) {
throw new \InvalidArgumentException(sprintf('Cannot get line number of string "%s". Format has to be: line[%line_number%]', $violation->getPropertyPath()));
}
return intval($matches[1]);
}