fixed CSC

This commit is contained in:
Fabien Potencier 2019-08-22 11:15:28 +02:00
parent 8c2e128a1a
commit 3051c59eff

View File

@ -115,9 +115,11 @@ final class Address
if (false === strpos($string, '<')) {
return new self($string, '');
}
if (!preg_match(self::FROM_STRING_PATTERN, $string, $matches)) {
throw new InvalidArgumentException(sprintf('Could not parse "%s" to a "%s" instance.', $string, static::class));
}
return new self($matches['addrSpec'], trim($matches['displayName'], ' \'"'));
}
}