8000 minor #28591 [Validator] improve docblocks around group sequences (xa… · symfony/symfony@3359e62 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3359e62

Browse files
minor #28591 [Validator] improve docblocks around group sequences (xabbuh)
This PR was merged into the 2.8 branch. Discussion ---------- [Validator] improve docblocks around group sequences | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | no | New feature? |no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #26889 | License | MIT | Doc PR | Commits ------- 179a081 improve docblocks around group sequences
2 parents 2e85ef5 + 179a081 commit 3359e62

File tree

6 files changed

+36
-44
lines changed

6 files changed

+36
-44
lines changed

src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ private static function allowDataWalking(FormInterface $form)
211211
/**
212212
* Returns the validation groups of the given form.
213213
*
214-
* @return array The validation groups
214+
* @return string|GroupSequence|(string|GroupSequence)[] The validation groups
215215
*/
216216
private static function getValidationGroups(FormInterface $form)
217217
{
@@ -246,10 +246,10 @@ private static function getValidationGroups(FormInterface $form)
246246
/**
247247
* Post-processes the validation groups option for a given form.
248248
*
249-
* @param array|callable $groups The validation groups
250-
* @param FormInterface $form The validated form
249+
* @param string|GroupSequence|(string|GroupSequence)[]|callable $groups The validation groups
250+
* @param FormInterface $form The validated form
251251
*
252-
* @return array The validation groups
252+
* @return (string|GroupSequence)[] The validation groups
253253
*/
254254
private static function resolveValidationGroups($groups, FormInterface $form)
255255
{

src/Symfony/Component/Validator/GroupSequenceProviderInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Validator;
1313

14+
use Symfony\Component\Validator\Constraints\GroupSequence;
15+
1416
/**
1517
* Defines the interface for a group sequence provider.
1618
*/
@@ -20,7 +22,7 @@ interface GroupSequenceProviderInterface
2022
* Returns which validation groups should be used for a certain state
2123
* of the object.
2224
*
23-
* @return array An array of validation groups
25+
* @return string[]|GroupSequence An array of validation groups
2426
*/
2527
public function getGroupSequence();
2628
}

src/Symfony/Component/Validator/Mapping/ClassMetadata.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ public function getConstrainedProperties()
485485
/**
486486
* Sets the default group sequence for this class.
487487
*
488-
* @param array $groupSequence An array of group names
488+
* @param string[]|GroupSequence $groupSequence An array of group names
489489
*
490490
* @return $this
491491
*

src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Validator\Validator;
1313

1414
use Symfony\Component\Validator\Constraint;
15+
use Symfony\Component\Validator\Constraints\GroupSequence;
1516
use Symfony\Component\Validator\ConstraintViolationListInterface;
1617

1718
/**
@@ -39,12 +40,9 @@ public function atPath($path);
3940
* If no constraint is passed, the constraint
4041
* {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
4142
*
42-
* @param mixed $value The value to validate
43-
* @param Constraint|Constraint[] $constraints The constraint(s) to validate
44-
* against
45-
* @param array|null $groups The validation groups to
46-
* validate. If none is given,
47-
* "Default" is assumed
43+
* @param mixed $value The value to validate
44+
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
45+
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
4846
*
4947
* @return $this
5048
*/
@@ -54,10 +52,9 @@ public function validate($value, $constraints = null, $groups = null);
5452
* Validates a property of an object against the constraints specified
5553
* for this property.
5654
*
57-
* @param object $object The object
58-
* @param string $propertyName The name of the validated property
59-
* @param array|null $groups The validation groups to validate. If
60-
* none is given, "Default" is assumed
55+
* @param object $object The object
56+
* @param string $propertyName The name of the validated property
57+
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
6158
*
6259
* @return $this
6360
*/
@@ -67,12 +64,10 @@ public function validateProperty($object, $propertyName, $groups = null);
6764
* Validates a value against the constraints specified for an object's
6865
* property.
6966
*
70-
* @param object|string $objectOrClass The object or its class name
71-
* @param string $propertyName The name of the property
72-
* @param mixed $value The value to validate against the
73-
* property's constraints
74-
* @param array|null $groups The validation groups to validate. If
75-
* none is given, "Default" is assumed
67+
* @param object|string $objectOrClass The object or its class name
68+
* @param string $propertyName The name of the property
69+
* @param mixed $value The value to validate against the property's constraints
70+
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
7671
*
7772
* @return $this
7873
*/

src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ public function getViolations()
275275
/**
276276
* Normalizes the given group or list of groups to an array.
277277
*
278-
* @param mixed $groups The groups to normalize
278+
* @param string|GroupSequence|(string|GroupSequence)[] $groups The groups to normalize
279279
*
280-
* @return array A group array
280+
* @return (string|GroupSequence)[] A group array
281281
*/
282282
protected function normalizeGroups($groups)
283283
{
@@ -298,7 +298,7 @@ protected function normalizeGroups($groups)
298298
*
299299
* @param object $object The object to cascade
300300
* @param string $propertyPath The current property path
301-
* @param string[] $groups The validated groups
301+
* @param (string|GroupSequence)[] $groups The validated groups
302302
* @param int $traversalStrategy The strategy for traversing the
303303
* cascaded object
304304
* @param ExecutionContextInterface $context The current execution context
@@ -361,7 +361,7 @@ private function validateObject($object, $propertyPath, array $groups, $traversa
361361
*
362362
* @param iterable $collection The collection
363363
* @param string $propertyPath The current property path
364-
* @param string[] $groups The validated groups
364+
* @param (string|GroupSequence)[] $groups The validated groups
365365
* @param bool $stopRecursion Whether to disable
366366
* recursive iteration. For
367367
* backwards compatibility
@@ -441,7 +441,7 @@ private function validateEachObjectIn($collection, $propertyPath, array $groups,
441441
* the object
442442
* @param string $propertyPath The property path leading
443443
* to the object
444-
* @param string[] $groups The groups in which the
444+
* @param (string|GroupSequence)[] $groups The groups in which the
445445
* object should be validated
446446
* @param string[]|null $cascadedGroups The groups in which
447447
* cascaded objects should
@@ -630,7 +630,7 @@ private function validateClassNode($object, $cacheKey, ClassMetadataInterface $m
630630
* value
631631
* @param string $propertyPath The property path leading
632632
* to the value
633-
* @param string[] $groups The groups in which the
633+
* @param (string|GroupSequence)[] $groups The groups in which the
634634
* value should be validated
635635
* @param string[]|null $cascadedGroups The groups in which
636636
* cascaded objects should

src/Symfony/Component/Validator/Validator/ValidatorInterface.php

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Validator\Validator;
1313

1414
use Symfony\Component\Validator\Constraint;
15+
use Symfony\Component\Validator\Constraints\GroupSequence;
1516
use Symfony\Component\Validator\ConstraintViolationListInterface;
1617
use Symfony\Component\Validator\Context\ExecutionContextInterface;
1718
use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface;
@@ -29,12 +30,9 @@ interface ValidatorInterface extends MetadataFactoryInterface
2930
* If no constraint is passed, the constraint
3031
* {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
3132
*
32-
* @param mixed $value The value to validate
33-
* @param Constraint|Constraint[] $constraints The constraint(s) to validate
34-
* against
35-
* @param array|null $groups The validation groups to
36-
* validate. If none is given,
37-
* "Default" is assumed
33+
* @param mixed $value The value to validate
34+
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
35+
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
3836
*
3937
* @return ConstraintViolationListInterface A list of constraint violations
4038
* If the list is empty, validation
@@ -46,10 +44,9 @@ public function validate($value, $constraints = null, $groups = null);
4644
* Validates a property of an object against the constraints specified
4745
* for this property.
4846
*
49-
* @param object $object The object
50-
* @param string $propertyName The name of the validated property
51-
* @param array|null $groups The validation groups to validate. If
52-
* none is given, "Default" is assumed
47+
* @param object $object The object
48+
* @param string $propertyName The name of the validated property
49+
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
5350
*
5451
* @return ConstraintViolationListInterface A list of constraint violations
5552
* If the list is empty, validation
@@ -61,12 +58,10 @@ public function validateProperty($object, $propertyName, $groups = null);
6158
* Validates a value against the constraints specified for an object's
6259
* property.
6360
*
64-
* @param object|string $objectOrClass The object or its class name
65-
* @param string $propertyName The name of the property
66-
* @param mixed $value The value to validate against the
67-
* property's constraints
68-
* @param array|null $groups The validation groups to validate. If
69-
* none is given, "Default" is assumed
61+
* @param object|string $objectOrClass The object or its class name
62+
* @param string $propertyName The name of the property
63+
* @param mixed $value The value to validate against the property's constraints
64+
* @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
7065
*
7166
* @return ConstraintViolationListInterface A list of constraint violations
7267
* If the list is empty, validation

0 commit comments

Comments
 (0)
0