Skip to content

Commit 24e0bf8

Browse files
committed
minor #47039 Throw error with debug message when ExpressionLanguage Component is not installed (WebMamba)
This PR was squashed before being merged into the 6.2 branch. Discussion ---------- Throw error with debug message when ExpressionLanguage Component is not installed | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | | License | MIT | Doc PR | When using the ExpressionLanguageSyntax constraints without installing the ExpressionLanguage component you get a random error. This PR throws an exception with a debugging message to suggest you install the expression language component. Commits ------- 5e4471a952 Throw error with debug message when ExpressionLanguage Component is not installed
2 parents 6550cdd + 1177ceb commit 24e0bf8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Constraints/ExpressionLanguageSyntaxValidator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ class ExpressionLanguageSyntaxValidator extends ConstraintValidator
3131

3232
public function __construct(ExpressionLanguage $expressionLanguage = null)
3333
{
34+
if (!class_exists(ExpressionLanguage::class)) {
35+
throw new \LogicException(sprintf('The "%s" class requires the "ExpressionLanguage" component. Try running "composer require symfony/expression-language".', self::class));
36+
}
37+
3438
$this->expressionLanguage = $expressionLanguage;
3539
}
3640

0 commit comments

Comments
 (0)