You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php
+16-10
Original file line number
Diff line number
Diff line change
@@ -27,10 +27,19 @@
27
27
*/
28
28
class AnnotationLoader implements LoaderInterface
29
29
{
30
+
/**
31
+
* @deprecated since Symfony 6.4, this property will be removed in 7.0
32
+
*
33
+
* @var Reader|null
34
+
*/
30
35
protected$reader;
31
36
32
37
publicfunction__construct(Reader$reader = null)
33
38
{
39
+
if ($reader) {
40
+
trigger_deprecation('symfony/validator', '6.4', 'Passing a "%s" instance as argument 1 to "%s()" is deprecated, pass null or omit the parameter instead.', get_debug_type($reader), __METHOD__);
41
+
}
42
+
34
43
$this->reader = $reader;
35
44
}
36
45
@@ -87,10 +96,7 @@ public function loadClassMetadata(ClassMetadata $metadata): bool
if ($reflectioninstanceof \ReflectionClass && $annotations = $this->reader->getClassAnnotations($reflection)) {
122
+
trigger_deprecation('symfony/validator', '6.4', 'Class "%s" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.', $reflection->getName());
if ($reflectioninstanceof \ReflectionMethod && $annotations = $this->reader->getMethodAnnotations($reflection)) {
125
+
trigger_deprecation('symfony/validator', '6.4', 'Method "%s::%s()" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.', $reflection->getDeclaringClass()->getName(), $reflection->getName());
if ($reflectioninstanceof \ReflectionProperty && $annotations = $this->reader->getPropertyAnnotations($reflection)) {
128
+
trigger_deprecation('symfony/validator', '6.4', 'Property "%s::$%s" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.', $reflection->getDeclaringClass()->getName(), $reflection->getName());
@@ -42,11 +45,22 @@ public function testNonConstraintsAreRejected()
42
45
]);
43
46
}
44
47
48
+
/**
49
+
* @group legacy
50
+
*/
45
51
publicfunctiontestAnnotations()
46
52
{
53
+
$this->expectDeprecation('Since symfony/validator 6.4: Passing a "Doctrine\Common\Annotations\AnnotationReader" instance as argument 1 to "Symfony\Component\Validator\Mapping\Loader\AnnotationLoader::__construct()" is deprecated, pass null or omit the parameter instead.');
$this->expectDeprecation('Since symfony/validator 6.4: Class "Symfony\Component\Validator\Tests\Constraints\WhenTestWithAnnotations" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
59
+
$this->expectDeprecation('Since symfony/validator 6.4: Property "Symfony\Component\Validator\Tests\Constraints\WhenTestWithAnnotations::$foo" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
60
+
$this->expectDeprecation('Since symfony/validator 6.4: Property "Symfony\Component\Validator\Tests\Constraints\WhenTestWithAnnotations::$bar" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
61
+
$this->expectDeprecation('Since symfony/validator 6.4: Property "Symfony\Component\Validator\Tests\Constraints\WhenTestWithAnnotations::$qux" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
62
+
$this->expectDeprecation('Since symfony/validator 6.4: Method "Symfony\Component\Validator\Tests\Constraints\WhenTestWithAnnotations::getBaz()" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
0 commit comments