Move empty condition in return statement

This commit is contained in:
apetitpa 2017-03-23 13:36:20 +01:00 committed by Fabien Potencier
parent a090ef855a
commit 4fcb24bacb
1 changed files with 2 additions and 10 deletions

View File

@ -138,11 +138,7 @@ class EmailValidator extends ConstraintValidator
*/
private function checkMX($host)
{
if ('' === $host) {
return false;
}
return checkdnsrr($host, 'MX');
return ('' !== $host) && checkdnsrr($host, 'MX');
}
/**
@ -154,10 +150,6 @@ class EmailValidator extends ConstraintValidator
*/
private function checkHost($host)
{
if ('' === $host) {
return false;
}
return $this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'));
return ('' !== $host) && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')));
}
}