8000 [Validator] Fix wrong expression language value by yceruto · Pull Request #33831 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Validator] Fix wrong expression language value #33831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
8000 Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public function __construct(/*ExpressionLanguage */$expressionLanguage = null)
}
} 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -302,11 +303,13 @@ public function testLegacyExpressionLanguageUsage()

/**
* @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()
Expand Down
0