10000 feature #35815 [Validator] Allow Sequentially constraints on classes … · symfony/symfony@7b89d1b · GitHub
[go: up one dir, main page]

Skip to content

Commit 7b89d1b

Browse files
feature #35815 [Validator] Allow Sequentially constraints on classes + target guards (ogizanagi)
This PR was merged into the 5.1-dev branch. Discussion ---------- [Validator] Allow Sequentially constraints on classes + target guards | Q | A | ------------- | --- | Branch? | master <!-- see below --> | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | N/A <!-- prefix each issue number with "Fix #", if any --> | License | MIT | Doc PR | todo in symfony/symfony-docs#13206 if not merged yet There is no reason to limit this constraint to properties, so let's add classes as targets. Additionally, let's ensure embedded constraints matches allowed targets too. Commits ------- 1e02a96 [Validator] Allow Sequentially constraints on classes
2 parents d297231 + 1e02a96 commit 7b89d1b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Validation for the nested constraints collection will stop at first violation.
1717
*
1818
* @Annotation
19-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
19+
* @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"})
2020
*
2121
* @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
2222
*/
@@ -38,4 +38,9 @@ protected function getCompositeOption()
3838
{
3939
return 'constraints';
4040
}
41+
42+
public function getTargets()
43+
{
44+
return [self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT];
45+
}
4146
}

0 commit comments

Comments
 (0)
0