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

Skip to content

Commit 43c0565

Browse files
committed
bug #13338 Validator deprecation fixes (fabpot)
This PR was merged into the 2.7 branch. Discussion ---------- Validator deprecation fixes | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- a34220e [Validator] always use the lazy loading metadata factory 818ca58 [Validator] removed usage of deprecated getMessageParameters() and getMessagePluralization() in unit tests c6f1f69 [Validator] fixed deprecation notices for BuildViolation() calls in constraints fb3f9d2 [Validator] fixed usage of deprecate Validator features 91606b5 [Validator] removed obsolete code 5aa44ee removed the Validator BC layer for PHP < 5.3.9 a4139c0 removed code for PHP < 5.3.9 6dc8979 bumped min PHP version to 5.3.9
2 parents 9a6f52e + a34220e commit 43c0565

File tree

170 files changed

+1328
-2197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+1328
-2197
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ language: php
22

33
matrix:
44
include:
5-
- php: 5.3.3
65
- php: 5.3
76
- php: 5.4
87
- php: 5.5
98
- php: 5.6
10-
- php: 5.3.3
9+
- php: 5.3
1110
env: components=low
1211
- php: 5.6
1312
env: components=high

autoload.php.dist

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ class DeprecationErrorHandler
4444
$class = isset($trace[$i]['object']) ? get_class($trace[$i]['object']) : $trace[$i]['class'];
4545
$method = $trace[$i]['function'];
4646

47-
$type = 0 === strpos($method, 'testLegacy') || 0 === strpos($method, 'provideLegacy') || strpos($class, '\Legacy') ? 'legacy' : 'remaining';
47+
$type =
48+
0 === strpos($method, 'testLegacy')
49+
|| 0 === strpos($method, 'provideLegacy')
50+
|| strpos($class, '\Legacy')
51+
? 'legacy' : 'remaining';
4852

4953
if ('legacy' === $type && 0 === (error_reporting() & E_USER_DEPRECATED)) {
5054
@++$deprecations[$type]['Silenced']['count'];

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=5.3.3",
19+
"php": ">=5.3.9",
2020
"doctrine/common": "~2.3",
2121
"twig/twig": "~1.12,>=1.12.3",
2222
"psr/log": "~1.0"

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/LegacyUniqueEntityValidator2Dot4ApiTest.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bridge\Doctrine\Validator\Constraints;
1313

1414
use Doctrine\Common\Persistence\ManagerRegistry;
15+
use Symfony\Component\Validator\Context\ExecutionContextInterface;
1516
use Symfony\Component\Validator\Constraint;
1617
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
1718
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
@@ -133,9 +134,16 @@ public function validate($entity, Constraint $constraint)
133134

134135
$errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0];
135136

136-
$this->buildViolation($constraint->message)
137-
->atPath($errorPath)
138-
->setInvalidValue($criteria[$fields[0]])
139-
->addViolation();
137+
if ($this->context instanceof ExecutionContextInterface) {
138+
$this->context->buildViolation($constraint->message)
139+
->atPath($errorPath)
140+
->setInvalidValue($criteria[$fields[0]])
141+
->addViolation();
142+
} else {
143+
$this->buildViolation($constraint->message)
144+
->atPath($errorPath)
145+
->setInvalidValue($criteria[$fields[0]])
146+
->addViolation();
147+
}
140148
}
141149
}

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=5.3.3",
19+
"php": ">=5.3.9",
2020
"doctrine/common": "~2.3"
2121
},
2222
"require-dev": {

src/Symfony/Bridge/Monolog/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=5.3.3",
19+
"php": ">=5.3.9",
2020
"monolog/monolog": "~1.11"
2121
},
2222
"require-dev": {

src/Symfony/Bridge/Propel1/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=5.3.3",
19+
"php": ">=5.3.9",
2020
"symfony/http-foundation": "~2.0,>=2.0.5|~3.0.0",
2121
"symfony/http-kernel": "~2.0,>=2.0.5|~3.0.0",
2222
"symfony/form": "~2.3,>=2.3.8|~3.0.0",

src/Symfony/Bridge/ProxyManager/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=5.3.3",
19+
"php": ">=5.3.9",
2020
"symfony/dependency-injection": "~2.3|~3.0.0",
2121
"ocramius/proxy-manager": "~0.4|~1.0"
2222
},

src/Symfony/Bridge/Swiftmailer/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=5.3.3",
19+
"php": ">=5.3.9",
2020
"swiftmailer/swiftmailer": ">=4.2.0,<6.0-dev"
2121
},
2222
"suggest": {

0 commit comments

Comments
 (0)