Skip to content

Commit 4fa1d32

Browse files
committed
[Validator] Un-deprecate passing an annotation reader to AnnotationLoader
1 parent f354c1e commit 4fa1d32

File tree

7 files changed

+5
-48
lines changed

7 files changed

+5
-48
lines changed

UPGRADE-6.4.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ Validator
157157
---------
158158

159159
* Deprecate Doctrine annotations support in favor of native attributes
160-
* Deprecate passing an annotation reader to the constructor signature of `AnnotationLoader`
161160
* Deprecate `ValidatorBuilder::setDoctrineAnnotationReader()`
162161
* Deprecate `ValidatorBuilder::addDefaultDoctrineAnnotationReader()`
163162
* Deprecate `ValidatorBuilder::enableAnnotationMapping()`, use `ValidatorBuilder::enableAttributeMapping()` instead

src/Symfony/Component/Validator/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ CHANGELOG
77
* Allow single integer for the `versions` option of the `Uuid` constraint
88
* Allow single constraint to be passed to the `constraints` option of the `When` constraint
99
* Deprecate Doctrine annotations support in favor of native attributes
10-
* Deprecate passing an annotation reader to the constructor signature of `AnnotationLoader`
1110
* Deprecate `ValidatorBuilder::setDoctrineAnnotationReader()`
1211
* Deprecate `ValidatorBuilder::addDefaultDoctrineAnnotationReader()`
1312
* Add `number`, `finite-number` and `finite-float` types to `Type` constraint

src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ class AnnotationLoader implements LoaderInterface
3838

3939
public function __construct(Reader $reader = null)
4040
{
41-
if ($reader) {
42-
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__);
43-
}
44-
4541
$this->reader = $reader;
4642
}
4743

src/Symfony/Component/Validator/Tests/Constraints/WhenTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ public function testNonConstraintsAreRejected()
5151
*/
5252
public function testAnnotations()
5353
{
54-
$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.');
55-
5654
$loader = new AnnotationLoader(new AnnotationReader());
5755
$metadata = new ClassMetadata(WhenTestWithAnnotations::class);
5856

src/Symfony/Component/Validator/Tests/Mapping/Loader/AnnotationLoaderWithHybridAnnotationsTest.php

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,58 +18,34 @@
1818
/**
1919
* @group legacy
2020
*/
21-
class AnnotationLoaderWithHybridAnnotationsTest extends AnnotationLoaderTest
21+
class AnnotationLoaderWithHybridAnnotationsTest extends AttributeLoaderTest
2222
{
2323
use ExpectDeprecationTrait;
2424

2525
public function testLoadClassMetadataReturnsTrueIfSuccessful()
2626
{
27-
$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.');
2827
$this->expectDeprecation('Since symfony/validator 6.4: Class "Symfony\Component\Validator\Tests\Fixtures\Attribute\Entity" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
2928
$this->expectDeprecation('Since symfony/validator 6.4: Property "Symfony\Component\Validator\Tests\Fixtures\Attribute\Entity::$firstName" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
3029

3130
parent::testLoadClassMetadataReturnsTrueIfSuccessful();
3231
}
3332

34-
public function testLoadClassMetadataReturnsFalseIfNotSuccessful()
35-
{
36-
$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.');
37-
38-
parent::testLoadClassMetadataReturnsFalseIfNotSuccessful();
39-
}
40-
4133
public function testLoadClassMetadata()
4234
{
43-
$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.');
4435
$this->expectDeprecation('Since symfony/validator 6.4: Class "Symfony\Component\Validator\Tests\Fixtures\Attribute\Entity" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
4536
$this->expectDeprecation('Since symfony/validator 6.4: Property "Symfony\Component\Validator\Tests\Fixtures\Attribute\Entity::$firstName" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
4637

4738
parent::testLoadClassMetadata();
4839
}
4940

50-
public function testLoadParentClassMetadata()
51-
{
52-
$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.');
53-
54-
parent::testLoadParentClassMetadata();
55-
}
56-
5741
public function testLoadClassMetadataAndMerge()
5842
{
59-
$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.');
6043
$this->expectDeprecation('Since symfony/validator 6.4: Class "Symfony\Component\Validator\Tests\Fixtures\Attribute\Entity" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
6144
$this->expectDeprecation('Since symfony/validator 6.4: Property "Symfony\Component\Validator\Tests\Fixtures\Attribute\Entity::$firstName" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
6245

6346
parent::testLoadClassMetadataAndMerge();
6447
}
6548

66-
public function testLoadGroupSequenceProviderAnnotation()
67-
{
68-
$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.');
69-
70-
parent::testLoadGroupSequenceProviderAnnotation();
71-
}
72-
7349
protected function createAnnotationLoader(): AnnotationLoader
7450
{
7551
return new AnnotationLoader(new AnnotationReader());

src/Symfony/Component/Validator/Tests/Mapping/Loader/AnnotationLoaderWithLegacyAnnotationsTest.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818
/**
1919
* @group legacy
2020
*/
21-
class AnnotationLoaderWithLegacyAnnotationsTest extends AnnotationLoaderTest
21+
class AnnotationLoaderWithLegacyAnnotationsTest extends AttributeLoaderTest
2222
{
2323
use ExpectDeprecationTrait;
2424

2525
public function testLoadClassMetadataReturnsTrueIfSuccessful()
2626
{
27-
$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.');
2827
$this->expectDeprecation('Since symfony/validator 6.4: Class "Symfony\Component\Validator\Tests\Fixtures\Annotation\Entity" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
2928
$this->expectDeprecation('Since symfony/validator 6.4: Property "Symfony\Component\Validator\Tests\Fixtures\Annotation\Entity::$firstName" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
3029
$this->expectDeprecation('Since symfony/validator 6.4: Property "Symfony\Component\Validator\Tests\Fixtures\Annotation\Entity::$childA" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
@@ -38,16 +37,8 @@ public function testLoadClassMetadataReturnsTrueIfSuccessful()
3837
parent::testLoadClassMetadataReturnsTrueIfSuccessful();
3938
}
4039

41-
public function testLoadClassMetadataReturnsFalseIfNotSuccessful()
42-
{
43-
$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.');
44-
45-
parent::testLoadClassMetadataReturnsFalseIfNotSuccessful();
46-
}
47-
4840
public function testLoadClassMetadata()
4941
{
50-
$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.');
5142
$this->expectDeprecation('Since symfony/validator 6.4: Class "Symfony\Component\Validator\Tests\Fixtures\Annotation\Entity" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
5243
$this->expectDeprecation('Since symfony/validator 6.4: Property "Symfony\Component\Validator\Tests\Fixtures\Annotation\Entity::$firstName" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
5344
$this->expectDeprecation('Since symfony/validator 6.4: Property "Symfony\Component\Validator\Tests\Fixtures\Annotation\Entity::$childA" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
@@ -63,15 +54,13 @@ public function testLoadClassMetadata()
6354

6455
public function testLoadParentClassMetadata()
6556
{
66-
$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.');
6757
$this->expectDeprecation('Since symfony/validator 6.4: Property "Symfony\Component\Validator\Tests\Fixtures\Annotation\EntityParent::$other" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
6858

6959
parent::testLoadParentClassMetadata();
7060
}
7161

7262
public function testLoadClassMetadataAndMerge()
7363
{
74-
$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.');
7564
$this->expectDeprecation('Since symfony/validator 6.4: Property "Symfony\Component\Validator\Tests\Fixtures\Annotation\EntityParent::$other" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
7665
$this->expectDeprecation('Since symfony/validator 6.4: Class "Symfony\Component\Validator\Tests\Fixtures\Annotation\Entity" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
7766
$this->expectDeprecation('Since symfony/validator 6.4: Property "Symfony\Component\Validator\Tests\Fixtures\Annotation\Entity::$firstName" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
@@ -88,7 +77,6 @@ public function testLoadClassMetadataAndMerge()
8877

8978
public function testLoadGroupSequenceProviderAnnotation()
9079
{
91-
$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.');
9280
$this->expectDeprecation('Since symfony/validator 6.4: Class "Symfony\Component\Validator\Tests\Fixtures\Annotation\GroupSequenceProviderEntity" uses Doctrine Annotations to configure validation constraints, which is deprecated. Use PHP attributes instead.');
9381

9482
parent::testLoadGroupSequenceProviderAnnotation();

src/Symfony/Component/Validator/Tests/Mapping/Loader/AnnotationLoaderTest.php renamed to src/Symfony/Component/Validator/Tests/Mapping/Loader/AttributeLoaderTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@
3030
use Symfony\Component\Validator\Constraints\Valid;
3131
use Symfony\Component\Validator\Mapping\ClassMetadata;
3232
use Symfony\Component\Validator\Mapping\Loader\AnnotationLoader;
33+
use Symfony\Component\Validator\Mapping\Loader\AttributeLoader;
3334
use Symfony\Component\Validator\Tests\Fixtures\ConstraintA;
3435

35-
class AnnotationLoaderTest extends TestCase
36+
class AttributeLoaderTest extends TestCase
3637
{
3738
public function testLoadClassMetadataReturnsTrueIfSuccessful()
3839
{
@@ -212,7 +213,7 @@ public function testLoadGroupSequenceProviderAnnotation()
212213

213214
protected function createAnnotationLoader(): AnnotationLoader
214215
{
215-
return new AnnotationLoader();
216+
return new AttributeLoader();
216217
}
217218

218219
protected function getFixtureNamespace(): string

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy