improve docblocks around group sequences

This commit is contained in:
Christian Flothmann 2018-09-25 09:16:06 +02:00
parent 7c87dc9720
commit 179a081ee3
6 changed files with 36 additions and 44 deletions

View File

@ -211,7 +211,7 @@ class FormValidator extends ConstraintValidator
/** /**
* Returns the validation groups of the given form. * Returns the validation groups of the given form.
* *
* @return array The validation groups * @return string|GroupSequence|(string|GroupSequence)[] The validation groups
*/ */
private static function getValidationGroups(FormInterface $form) private static function getValidationGroups(FormInterface $form)
{ {
@ -246,10 +246,10 @@ class FormValidator extends ConstraintValidator
/** /**
* Post-processes the validation groups option for a given form. * Post-processes the validation groups option for a given form.
* *
* @param array|callable $groups The validation groups * @param string|GroupSequence|(string|GroupSequence)[]|callable $groups The validation groups
* @param FormInterface $form The validated form * @param FormInterface $form The validated form
* *
* @return array The validation groups * @return (string|GroupSequence)[] The validation groups
*/ */
private static function resolveValidationGroups($groups, FormInterface $form) private static function resolveValidationGroups($groups, FormInterface $form)
{ {

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Validator; namespace Symfony\Component\Validator;
use Symfony\Component\Validator\Constraints\GroupSequence;
/** /**
* Defines the interface for a group sequence provider. * Defines the interface for a group sequence provider.
*/ */
@ -20,7 +22,7 @@ interface GroupSequenceProviderInterface
* Returns which validation groups should be used for a certain state * Returns which validation groups should be used for a certain state
* of the object. * of the object.
* *
* @return array An array of validation groups * @return string[]|GroupSequence An array of validation groups
*/ */
public function getGroupSequence(); public function getGroupSequence();
} }

View File

@ -485,7 +485,7 @@ class ClassMetadata extends ElementMetadata implements ClassMetadataInterface
/** /**
* Sets the default group sequence for this class. * Sets the default group sequence for this class.
* *
* @param array $groupSequence An array of group names * @param string[]|GroupSequence $groupSequence An array of group names
* *
* @return $this * @return $this
* *

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Validator; namespace Symfony\Component\Validator\Validator;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\GroupSequence;
use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\Validator\ConstraintViolationListInterface;
/** /**
@ -39,12 +40,9 @@ interface ContextualValidatorInterface
* If no constraint is passed, the constraint * If no constraint is passed, the constraint
* {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
* *
* @param mixed $value The value to validate * @param mixed $value The value to validate
* @param Constraint|Constraint[] $constraints The constraint(s) to validate * @param Constraint|Constraint[] $constraints The constraint(s) to validate against
* against * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
* @param array|null $groups The validation groups to
* validate. If none is given,
* "Default" is assumed
* *
* @return $this * @return $this
*/ */
@ -54,10 +52,9 @@ interface ContextualValidatorInterface
* Validates a property of an object against the constraints specified * Validates a property of an object against the constraints specified
* for this property. * for this property.
* *
* @param object $object The object * @param object $object The object
* @param string $propertyName The name of the validated property * @param string $propertyName The name of the validated property
* @param array|null $groups The validation groups to validate. If * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
* none is given, "Default" is assumed
* *
* @return $this * @return $this
*/ */
@ -67,12 +64,10 @@ interface ContextualValidatorInterface
* Validates a value against the constraints specified for an object's * Validates a value against the constraints specified for an object's
* property. * property.
* *
* @param object|string $objectOrClass The object or its class name * @param object|string $objectOrClass The object or its class name
* @param string $propertyName The name of the property * @param string $propertyName The name of the property
* @param mixed $value The value to validate against the * @param mixed $value The value to validate against the property's constraints
* property's constraints * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
* @param array|null $groups The validation groups to validate. If
* none is given, "Default" is assumed
* *
* @return $this * @return $this
*/ */

View File

@ -275,9 +275,9 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
/** /**
* Normalizes the given group or list of groups to an array. * Normalizes the given group or list of groups to an array.
* *
* @param mixed $groups The groups to normalize * @param string|GroupSequence|(string|GroupSequence)[] $groups The groups to normalize
* *
* @return array A group array * @return (string|GroupSequence)[] A group array
*/ */
protected function normalizeGroups($groups) protected function normalizeGroups($groups)
{ {
@ -298,7 +298,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
* *
* @param object $object The object to cascade * @param object $object The object to cascade
* @param string $propertyPath The current property path * @param string $propertyPath The current property path
* @param string[] $groups The validated groups * @param (string|GroupSequence)[] $groups The validated groups
* @param int $traversalStrategy The strategy for traversing the * @param int $traversalStrategy The strategy for traversing the
* cascaded object * cascaded object
* @param ExecutionContextInterface $context The current execution context * @param ExecutionContextInterface $context The current execution context
@ -361,7 +361,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
* *
* @param iterable $collection The collection * @param iterable $collection The collection
* @param string $propertyPath The current property path * @param string $propertyPath The current property path
* @param string[] $groups The validated groups * @param (string|GroupSequence)[] $groups The validated groups
* @param bool $stopRecursion Whether to disable * @param bool $stopRecursion Whether to disable
* recursive iteration. For * recursive iteration. For
* backwards compatibility * backwards compatibility
@ -441,7 +441,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
* the object * the object
* @param string $propertyPath The property path leading * @param string $propertyPath The property path leading
* to the object * to the object
* @param string[] $groups The groups in which the * @param (string|GroupSequence)[] $groups The groups in which the
* object should be validated * object should be validated
* @param string[]|null $cascadedGroups The groups in which * @param string[]|null $cascadedGroups The groups in which
* cascaded objects should * cascaded objects should
@ -630,7 +630,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
* value * value
* @param string $propertyPath The property path leading * @param string $propertyPath The property path leading
* to the value * to the value
* @param string[] $groups The groups in which the * @param (string|GroupSequence)[] $groups The groups in which the
* value should be validated * value should be validated
* @param string[]|null $cascadedGroups The groups in which * @param string[]|null $cascadedGroups The groups in which
* cascaded objects should * cascaded objects should

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\Validator\Validator; namespace Symfony\Component\Validator\Validator;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\GroupSequence;
use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\Validator\ConstraintViolationListInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface;
@ -29,12 +30,9 @@ interface ValidatorInterface extends MetadataFactoryInterface
* If no constraint is passed, the constraint * If no constraint is passed, the constraint
* {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
* *
* @param mixed $value The value to validate * @param mixed $value The value to validate
* @param Constraint|Constraint[] $constraints The constraint(s) to validate * @param Constraint|Constraint[] $constraints The constraint(s) to validate against
* against * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
* @param array|null $groups The validation groups to
* validate. If none is given,
* "Default" is assumed
* *
* @return ConstraintViolationListInterface A list of constraint violations * @return ConstraintViolationListInterface A list of constraint violations
* If the list is empty, validation * If the list is empty, validation
@ -46,10 +44,9 @@ interface ValidatorInterface extends MetadataFactoryInterface
* Validates a property of an object against the constraints specified * Validates a property of an object against the constraints specified
* for this property. * for this property.
* *
* @param object $object The object * @param object $object The object
* @param string $propertyName The name of the validated property * @param string $propertyName The name of the validated property
* @param array|null $groups The validation groups to validate. If * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
* none is given, "Default" is assumed
* *
* @return ConstraintViolationListInterface A list of constraint violations * @return ConstraintViolationListInterface A list of constraint violations
* If the list is empty, validation * If the list is empty, validation
@ -61,12 +58,10 @@ interface ValidatorInterface extends MetadataFactoryInterface
* Validates a value against the constraints specified for an object's * Validates a value against the constraints specified for an object's
* property. * property.
* *
* @param object|string $objectOrClass The object or its class name * @param object|string $objectOrClass The object or its class name
* @param string $propertyName The name of the property * @param string $propertyName The name of the property
* @param mixed $value The value to validate against the * @param mixed $value The value to validate against the property's constraints
* property's constraints * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
* @param array|null $groups The validation groups to validate. If
* none is given, "Default" is assumed
* *
* @return ConstraintViolationListInterface A list of constraint violations * @return ConstraintViolationListInterface A list of constraint violations
* If the list is empty, validation * If the list is empty, validation