Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit13410dc

Browse files
committed
prevent double deprecation message
1 parent68d1b3f commit13410dc

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ class ExpressionValidator extends ConstraintValidator
2727

2828
publicfunction__construct(/*ExpressionLanguage */$expressionLanguage =null)
2929
{
30-
if (!$expressionLanguageinstanceof ExpressionLanguage) {
31-
if (null !==$expressionLanguage) {
32-
@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);
33-
}
30+
if (\func_num_args() >1) {
31+
@trigger_error(sprintf('The "%s" instance should be passed as "%s" first argument instead of second argument since 4.4.', ExpressionLanguage::class,__METHOD__),E_USER_DEPRECATED);
32+
33+
$expressionLanguage =func_get_arg(1);
3434

35-
if (\func_num_args() >1 &&func_get_arg(1)instanceof ExpressionLanguage) {
36-
@trigger_error(sprintf('The "%s" instance should be passed as "%s" first argument instead of second argument since 4.4.', ExpressionLanguage::class,__METHOD__),E_USER_DEPRECATED);
37-
$expressionLanguage =func_get_arg(1);
35+
if (!$expressionLanguageinstanceof ExpressionLanguage) {
36+
thrownew \TypeError(sprintf('Argument 2 passed to %s() must be an instance of %s, %s given.',__METHOD__, ExpressionLanguage::class,\is_object($expressionLanguage) ?\get_class($expressionLanguage) :\gettype($expressionLanguage)));
3837
}
38+
}elseif (null !==$expressionLanguage && !$expressionLanguageinstanceof ExpressionLanguage) {
39+
@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);
3940
}
4041

4142
$this->expressionLanguage =$expressionLanguage;

‎src/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public function testExpressionLanguageUsage()
272272
$this->assertTrue($used,'Failed asserting that custom ExpressionLanguage instance is used.');
273273
}
274274

275-
/**
275+
/*
276276
* @group legacy
277277
* @expectedDeprecation The "Symfony\Component\ExpressionLanguage\ExpressionLanguage" instance should be passed as "Symfony\Component\Validator\Constraints\ExpressionValidator::__construct" first argument instead of second argument since 4.4.
278278
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp