Skip to content

Commit ffe6f08

Browse files
feature #51085 [Validator] Remove Doctrine annotations support (derrabus)
This PR was merged into the 7.0 branch. Discussion ---------- [Validator] Remove Doctrine annotations support | Q | A | ------------- | --- | Branch? | 7.0 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Follows #50982 | License | MIT | Doc PR | symfony/symfony-docs#18589 Commits ------- d18dfa5 [Validator] Remove Doctrine annotations support
2 parents badd6e4 + d18dfa5 commit ffe6f08

File tree

94 files changed

+12
-1141
lines changed

Some content is hidden

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

94 files changed

+12
-1141
lines changed

UPGRADE-7.0.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@ Validator
316316
* Remove static property `$errorNames` from all constraints, use const `ERROR_NAMES` instead
317317
* Remove `VALIDATION_MODE_LOOSE` from `Email` constraint, use `VALIDATION_MODE_HTML5` instead
318318
* Remove constraint `ExpressionLanguageSyntax`, use `ExpressionSyntax` instead
319+
* Remove Doctrine annotations support in favor of native attributes
320+
* Remove the annotation reader parameter from the constructor signature of `AnnotationLoader`
321+
* Remove `ValidatorBuilder::setDoctrineAnnotationReader()`
322+
* Remove `ValidatorBuilder::addDefaultDoctrineAnnotationReader()`
319323

320324
VarDumper
321325
---------

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
/**
1717
* Constraint for the Unique Entity validator.
1818
*
19-
* @Annotation
20-
* @Target({"CLASS", "ANNOTATION"})
21-
*
2219
* @author Benjamin Eberlei <kontakt@beberlei.de>
2320
*/
2421
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Security/Core/Validator/Constraints/UserPassword.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313

1414
use Symfony\Component\Validator\Constraint;
1515

16-
/**
17-
* @Annotation
18-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
19-
*/
2016
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
2117
class UserPassword extends Constraint
2218
{

src/Symfony/Component/Validator/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ CHANGELOG
1010
* Remove static property `$errorNames` from all constraints, use const `ERROR_NAMES` instead
1111
* Remove `VALIDATION_MODE_LOOSE` from `Email` constraint, use `VALIDATION_MODE_HTML5` instead
1212
* Remove constraint `ExpressionLanguageSyntax`, use `ExpressionSyntax` instead
13+
* Remove Doctrine annotations support in favor of native attributes
14+
* Remove the annotation reader parameter from the constructor signature of `AnnotationLoader`
15+
* Remove `ValidatorBuilder::setDoctrineAnnotationReader()`
16+
* Remove `ValidatorBuilder::addDefaultDoctrineAnnotationReader()`
1317

1418
6.4
1519
---

src/Symfony/Component/Validator/Constraints/All.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
namespace Symfony\Component\Validator\Constraints;
1313

1414
/**
15-
* @Annotation
16-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
17-
*
1815
* @author Bernhard Schussek <bschussek@gmail.com>
1916
*/
2017
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/AtLeastOneOf.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
namespace Symfony\Component\Validator\Constraints;
1313

1414
/**
15-
* @Annotation
16-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
17-
*
1815
* @author Przemysław Bogusz <przemyslaw.bogusz@tubotax.pl>
1916
*/
2017
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/Bic.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
use Symfony\Component\Validator\Exception\LogicException;
1919

2020
/**
21-
* @Annotation
22-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
23-
*
2421
* @author Michael Hirschler <michael.vhirsch@gmail.com>
2522
*/
2623
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/Blank.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use Symfony\Component\Validator\Constraint;
1515

1616
/**
17-
* @Annotation
18-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
19-
*
2017
* @author Bernhard Schussek <bschussek@gmail.com>
2118
*/
2219
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/Callback.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use Symfony\Component\Validator\Constraint;
1515

1616
/**
17-
* @Annotation
18-
* @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"})
19-
*
2017
* @author Bernhard Schussek <bschussek@gmail.com>
2118
*/
2219
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/CardScheme.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
/**
1717
* Metadata for the CardSchemeValidator.
1818
*
19-
* @Annotation
20-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
21-
*
2219
* @author Tim Nagel <t.nagel@infinite.net.au>
2320
* @author Bernhard Schussek <bschussek@gmail.com>
2421
*/

src/Symfony/Component/Validator/Constraints/Cascade.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
1616

1717
/**
18-
* @Annotation
19-
* @Target({"CLASS"})
20-
*
2118
* @author Jules Pietri <jules@heahprod.com>
2219
*/
2320
#[\Attribute(\Attribute::TARGET_CLASS)]

src/Symfony/Component/Validator/Constraints/Choice.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use Symfony\Component\Validator\Constraint;
1515

1616
/**
17-
* @Annotation
18-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
19-
*
2017
* @author Bernhard Schussek <bschussek@gmail.com>
2118
*/
2219
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/Cidr.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
/**
1818
* Validates that a value is a valid CIDR notation.
1919
*
20-
* @Annotation
21-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
22-
*
2320
* @author Sorin Pop <popsorin15@gmail.com>
2421
* @author Calin Bolea <calin.bolea@gmail.com>
2522
*/

src/Symfony/Component/Validator/Constraints/Collection.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
1515

1616
/**
17-
* @Annotation
18-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
19-
*
2017
* @author Bernhard Schussek <bschussek@gmail.com>
2118
*/
2219
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/Count.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
use Symfony\Component\Validator\Exception\MissingOptionsException;
1616

1717
/**
18-
* @Annotation
19-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
20-
*
2118
* @author Bernhard Schussek <bschussek@gmail.com>
2219
*/
2320
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/Country.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
use Symfony\Component\Validator\Exception\LogicException;
1717

1818
/**
19-
* @Annotation
20-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
21-
*
2219
* @author Bernhard Schussek <bschussek@gmail.com>
2320
*/
2421
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/CssColor.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
use Symfony\Component\Validator\Exception\InvalidArgumentException;
1616

1717
/**
18-
* @Annotation
19-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
20-
*
2118
* @author Mathieu Santostefano <msantostefano@protonmail.com>
2219
*/
2320
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/Currency.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
use Symfony\Component\Validator\Exception\LogicException;
1717

1818
/**
19-
* @Annotation
20-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
21-
*
2219
* @author Miha Vrhovnik <miha.vrhovnik@pagein.si>
2320
* @author Bernhard Schussek <bschussek@gmail.com>
2421
*/

src/Symfony/Component/Validator/Constraints/Date.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use Symfony\Component\Validator\Constraint;
1515

1616
/**
17-
* @Annotation
18-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
19-
*
2017
* @author Bernhard Schussek <bschussek@gmail.com>
2118
*/
2219
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/DateTime.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use Symfony\Component\Validator\Constraint;
1515

1616
/**
17-
* @Annotation
18-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
19-
*
2017
* @author Bernhard Schussek <bschussek@gmail.com>
2118
*/
2219
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/DisableAutoMapping.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
/**
1818
* Disables auto mapping.
1919
*
20-
* Using the annotations on a property has higher precedence than using it on a class,
20+
* Using the attribute on a property has higher precedence than using it on a class,
2121
* which has higher precedence than any configuration that might be defined outside the class.
2222
*
23-
* @Annotation
24-
*
2523
* @author Kévin Dunglas <dunglas@gmail.com>
2624
*/
2725
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::TARGET_CLASS)]

src/Symfony/Component/Validator/Constraints/DivisibleBy.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
namespace Symfony\Component\Validator\Constraints;
1313

1414
/**
15-
* @Annotation
16-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
17-
*
1815
* @author Colin O'Dell <colinodell@gmail.com>
1916
*/
2017
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/Email.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
use Symfony\Component\Validator\Exception\LogicException;
1818

1919
/**
20-
* @Annotation
21-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
22-
*
2320
* @author Bernhard Schussek <bschussek@gmail.com>
2421
*/
2522
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/EnableAutoMapping.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
/**
1818
* Enables auto mapping.
1919
*
20-
* Using the annotations on a property has higher precedence than using it on a class,
20+
* Using the attribute on a property has higher precedence than using it on a class,
2121
* which has higher precedence than any configuration that might be defined outside the class.
2222
*
23-
* @Annotation
24-
*
2523
* @author Kévin Dunglas <dunglas@gmail.com>
2624
*/
2725
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::TARGET_CLASS)]

src/Symfony/Component/Validator/Constraints/EqualTo.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
namespace Symfony\Component\Validator\Constraints;
1313

1414
/**
15-
* @Annotation
16-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
17-
*
1815
* @author Daniel Holmes <daniel@danielholmes.org>
1916
* @author Bernhard Schussek <bschussek@gmail.com>
2017
*/

src/Symfony/Component/Validator/Constraints/Expression.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
use Symfony\Component\Validator\Exception\LogicException;
1818

1919
/**
20-
* @Annotation
21-
* @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"})
22-
*
2320
* @author Fabien Potencier <fabien@symfony.com>
2421
* @author Bernhard Schussek <bschussek@gmail.com>
2522
*/

src/Symfony/Component/Validator/Constraints/ExpressionSyntax.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use Symfony\Component\Validator\Constraint;
1515

1616
/**
17-
* @Annotation
18-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
19-
*
2017
* @author Andrey Sevastianov <mrpkmail@gmail.com>
2118
*/
2219
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/File.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
1616

1717
/**
18-
* @Annotation
19-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
20-
*
2118
* @property int $maxSize
2219
*
2320
* @author Bernhard Schussek <bschussek@gmail.com>

src/Symfony/Component/Validator/Constraints/GreaterThan.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
namespace Symfony\Component\Validator\Constraints;
1313

1414
/**
15-
* @Annotation
16-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
17-
*
1815
* @author Daniel Holmes <daniel@danielholmes.org>
1916
* @author Bernhard Schussek <bschussek@gmail.com>
2017
*/

src/Symfony/Component/Validator/Constraints/GreaterThanOrEqual.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
namespace Symfony\Component\Validator\Constraints;
1313

1414
/**
15-
* @Annotation
16-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
17-
*
1815
* @author Daniel Holmes <daniel@danielholmes.org>
1916
* @author Bernhard Schussek <bschussek@gmail.com>
2017
*/

src/Symfony/Component/Validator/Constraints/GroupSequence.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@
4444
*
4545
* $validator->validate($address, null, "Address")
4646
*
47-
* @Annotation
48-
*
49-
* @Target({"CLASS", "ANNOTATION"})
50-
*
5147
* @author Bernhard Schussek <bschussek@gmail.com>
5248
*/
5349
#[\Attribute(\Attribute::TARGET_CLASS)]

src/Symfony/Component/Validator/Constraints/GroupSequenceProvider.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
/**
1515
* Attribute to define a group sequence provider.
1616
*
17-
* @Annotation
18-
*
19-
* @Target({"CLASS", "ANNOTATION"})
20-
*
2117
* @author Bernhard Schussek <bschussek@gmail.com>
2218
*/
2319
#[\Attribute(\Attribute::TARGET_CLASS)]

src/Symfony/Component/Validator/Constraints/Hostname.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use Symfony\Component\Validator\Constraint;
1515

1616
/**
17-
* @Annotation
18-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
19-
*
2017
* @author Dmitrii Poddubnyi <dpoddubny@gmail.com>
2118
*/
2219
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

src/Symfony/Component/Validator/Constraints/Iban.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use Symfony\Component\Validator\Constraint;
1515

1616
/**
17-
* @Annotation
18-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
19-
*
2017
* @author Manuel Reinhard <manu@sprain.ch>
2118
* @author Michael Schummel
2219
* @author Bernhard Schussek <bschussek@gmail.com>

src/Symfony/Component/Validator/Constraints/IdenticalTo.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
namespace Symfony\Component\Validator\Constraints;
1313

1414
/**
15-
* @Annotation
16-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
17-
*
1815
* @author Daniel Holmes <daniel@danielholmes.org>
1916
* @author Bernhard Schussek <bschussek@gmail.com>
2017
*/

src/Symfony/Component/Validator/Constraints/Image.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
namespace Symfony\Component\Validator\Constraints;
1313

1414
/**
15-
* @Annotation
16-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
17-
*
1815
* @author Benjamin Dulau <benjamin.dulau@gmail.com>
1916
* @author Bernhard Schussek <bschussek@gmail.com>
2017
*/

src/Symfony/Component/Validator/Constraints/Ip.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
/**
1919
* Validates that a value is a valid IP address.
2020
*
21-
* @Annotation
22-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
23-
*
2421
* @author Bernhard Schussek <bschussek@gmail.com>
2522
* @author Joseph Bielawski <stloyd@gmail.com>
2623
*/

src/Symfony/Component/Validator/Constraints/IsFalse.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use Symfony\Component\Validator\Constraint;
1515

1616
/**
17-
* @Annotation
18-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
19-
*
2017
* @author Bernhard Schussek <bschussek@gmail.com>
2118
*/
2219
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]

0 commit comments

Comments
 (0)