Skip to content

Commit 804c22f

Browse files
committed
Favor LogicException for missing classes & functions
1 parent e18deb6 commit 804c22f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Constraints/EmailValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Egulias\EmailValidator\Validation\NoRFCWarningsValidation;
1616
use Symfony\Component\Validator\Constraint;
1717
use Symfony\Component\Validator\ConstraintValidator;
18-
use Symfony\Component\Validator\Exception\RuntimeException;
18+
use Symfony\Component\Validator\Exception\LogicException;
1919
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
2020

2121
/**
@@ -100,7 +100,7 @@ public function validate($value, Constraint $constraint)
100100

101101
if (Email::VALIDATION_MODE_STRICT === $constraint->mode) {
102102
if (!class_exists('\Egulias\EmailValidator\EmailValidator')) {
103-
throw new RuntimeException('Strict email validation requires egulias/email-validator ~1.2|~2.0');
103+
throw new LogicException('Strict email validation requires egulias/email-validator ~1.2|~2.0');
104104
}
105105

106106
$strictValidator = new \Egulias\EmailValidator\EmailValidator();

Constraints/ExpressionValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
1515
use Symfony\Component\Validator\Constraint;
1616
use Symfony\Component\Validator\ConstraintValidator;
17-
use Symfony\Component\Validator\Exception\RuntimeException;
17+
use Symfony\Component\Validator\Exception\LogicException;
1818
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
1919

2020
/**
@@ -55,7 +55,7 @@ private function getExpressionLanguage()
5555
{
5656
if (null === $this->expressionLanguage) {
5757
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
58-
throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
58+
throw new LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
5959
}
6060
$this->expressionLanguage = new ExpressionLanguage();
6161
}

Constraints/ImageValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Symfony\Component\Validator\Constraint;
1515
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
16-
use Symfony\Component\Validator\Exception\RuntimeException;
16+
use Symfony\Component\Validator\Exception\LogicException;
1717
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
1818

1919
/**
@@ -218,7 +218,7 @@ public function validate($value, Constraint $constraint)
218218

219219
if ($constraint->detectCorrupted) {
220220
if (!\function_exists('imagecreatefromstring')) {
221-
throw new RuntimeException('Corrupted images detection requires installed and enabled GD extension');
221+
throw new LogicException('Corrupted images detection requires installed and enabled GD extension');
222222
}
223223

224224
$resource = @imagecreatefromstring(file_get_contents($value));

0 commit comments

Comments
 (0)