Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d604110

Browse files
committed
[Validator] Add optional expressionLanguage argument to ExpressionValidator
1 parent f35a0d2 commit d604110

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Symfony/Component/Validator/Constraints/ExpressionValidator.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,22 @@ class ExpressionValidator extends ConstraintValidator
3838
private $expressionLanguage;
3939

4040
/**
41-
* @param PropertyAccessorInterface|null $propertyAccessor Optional as of Symfony 2.5
41+
* @param PropertyAccessorInterface|null $propertyAccessor Optional as of Symfony 2.5
42+
* @param ExpressionLanguage $expressionLanguage
4243
*
4344
* @throws UnexpectedTypeException If the property accessor is invalid
4445
*/
45-
public function __construct($propertyAccessor = null)
46+
public function __construct($propertyAccessor = null, $expressionLanguage = null)
4647
{
4748
if (null !== $propertyAccessor && !$propertyAccessor instanceof PropertyAccessorInterface) {
4849
throw new UnexpectedTypeException($propertyAccessor, 'null or \Symfony\Component\PropertyAccess\PropertyAccessorInterface');
4950
}
51+
if (null !== $expressionLanguage && !$expressionLanguage instanceof ExpressionLanguage) {
52+
throw new UnexpectedTypeException($expressionLanguage, 'null or \Symfony\Component\ExpressionLanguage\ExpressionLanguage');
53+
}
5054

5155
$this->propertyAccessor = $propertyAccessor;
56+
$this->expressionLanguage = $expressionLanguage;
5257
}
5358

5459
/**

0 commit comments

Comments
 (0)