private function createSymfonyConstraint($constraintName, array $constraintConstructorParameters = [])
{
$fullClassName = sprintf(self::SYMFONY_CONSTRAINT_NAMESPACE, $constraintName);
try {
$constraintReflection = new ReflectionClass($fullClassName);
} catch (ReflectionException $previousException) {
$baseExceptionMessage = 'Symfony/Validator constraint "%s" does not exist.';
$exceptionMessage = sprintf($baseExceptionMessage, $constraintName);
throw new ComponentException($exceptionMessage, 0, $previousException);
}
if ($constraintReflection->hasMethod('__construct')) {
return $constraintReflection->newInstanceArgs($constraintConstructorParameters);
}
return $constraintReflection->newInstance();
}