Fix wrong expression language value
This commit is contained in:
parent
11da6f6eea
commit
4288f1c9f9
@ -37,6 +37,8 @@ class ExpressionValidator extends ConstraintValidator
|
||||
}
|
||||
} elseif (null !== $expressionLanguage && !$expressionLanguage instanceof ExpressionLanguage) {
|
||||
@trigger_error(sprintf('The "%s" first argument must be an instance of "%s" or null since 4.4. "%s" given', __METHOD__, ExpressionLanguage::class, \is_object($expressionLanguage) ? \get_class($expressionLanguage) : \gettype($expressionLanguage)), E_USER_DEPRECATED);
|
||||
|
||||
$expressionLanguage = null;
|
||||
}
|
||||
|
||||
$this->expressionLanguage = $expressionLanguage;
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\Validator\Tests\Constraints;
|
||||
|
||||
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
||||
use Symfony\Component\PropertyAccess\PropertyAccess;
|
||||
use Symfony\Component\Validator\Constraints\Expression;
|
||||
use Symfony\Component\Validator\Constraints\ExpressionValidator;
|
||||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
||||
@ -302,11 +303,13 @@ class ExpressionValidatorTest extends ConstraintValidatorTestCase
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation The "Symfony\Component\Validator\Constraints\ExpressionValidator::__construct" first argument must be an instance of "Symfony\Component\ExpressionLanguage\ExpressionLanguage" or null since 4.4. "string" given
|
||||
* @expectedDeprecation The "Symfony\Component\Validator\Constraints\ExpressionValidator::__construct" first argument must be an instance of "Symfony\Component\ExpressionLanguage\ExpressionLanguage" or null since 4.4. "Symfony\Component\PropertyAccess\PropertyAccessor" given
|
||||
*/
|
||||
public function testConstructorInvalidType()
|
||||
public function testDeprecatedArgumentType()
|
||||
{
|
||||
new ExpressionValidator('foo');
|
||||
$validator = new ExpressionValidator(PropertyAccess::createPropertyAccessor());
|
||||
$validator->initialize($this->createContext());
|
||||
$validator->validate(null, new Expression(['expression' => 'false']));
|
||||
}
|
||||
|
||||
public function testPassingCustomValues()
|
||||
|
Reference in New Issue
Block a user