Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ValidatorInterface.php

interface ValidatorInterface

Same name in this branch
  1. 11.1.x vendor/ramsey/uuid/src/Validator/ValidatorInterface.php \Ramsey\Uuid\Validator\ValidatorInterface

Validates PHP values against constraints.

@author Bernhard Schussek <bschussek@gmail.com>

Hierarchy

  • interface \Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface
    • interface \Symfony\Component\Validator\Validator\ValidatorInterface extends \Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface

Expanded class hierarchy of ValidatorInterface

All classes that implement ValidatorInterface

18 files declare their use of ValidatorInterface
CompoundConstraintTestCase.php in vendor/symfony/validator/Test/CompoundConstraintTestCase.php
ConstraintValidatorTestCase.php in vendor/symfony/validator/Test/ConstraintValidatorTestCase.php
ExecutionContext.php in vendor/symfony/validator/Context/ExecutionContext.php
ExecutionContext.php in core/lib/Drupal/Core/Validation/ExecutionContext.php
ExecutionContextFactory.php in vendor/symfony/validator/Context/ExecutionContextFactory.php

... See full list

1 string reference to 'ValidatorInterface'
file.services.yml in core/modules/file/file.services.yml
core/modules/file/file.services.yml
1 service uses ValidatorInterface
file.recursive_validator in core/modules/file/file.services.yml
Symfony\Component\Validator\Validator\ValidatorInterface

File

vendor/symfony/validator/Validator/ValidatorInterface.php, line 25

Namespace

Symfony\Component\Validator\Validator
View source
interface ValidatorInterface extends MetadataFactoryInterface {
    
    /**
     * Validates a value against a constraint or a list of constraints.
     *
     * If no constraint is passed, the constraint
     * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
     *
     * @param Constraint|Constraint[]                               $constraints The constraint(s) to validate against
     * @param string|GroupSequence|array<string|GroupSequence>|null $groups      The validation groups to validate. If none is given, "Default" is assumed
     *
     * @return ConstraintViolationListInterface A list of constraint violations
     *                                          If the list is empty, validation
     *                                          succeeded
     */
    public function validate(mixed $value, Constraint|array|null $constraints = null, string|GroupSequence|array|null $groups = null) : ConstraintViolationListInterface;
    
    /**
     * Validates a property of an object against the constraints specified
     * for this property.
     *
     * @param string                                                $propertyName The name of the validated property
     * @param string|GroupSequence|array<string|GroupSequence>|null $groups       The validation groups to validate. If none is given, "Default" is assumed
     *
     * @return ConstraintViolationListInterface A list of constraint violations
     *                                          If the list is empty, validation
     *                                          succeeded
     */
    public function validateProperty(object $object, string $propertyName, string|GroupSequence|array|null $groups = null) : ConstraintViolationListInterface;
    
    /**
     * Validates a value against the constraints specified for an object's
     * property.
     *
     * @param object|string                                         $objectOrClass The object or its class name
     * @param string                                                $propertyName  The name of the property
     * @param mixed                                                 $value         The value to validate against the property's constraints
     * @param string|GroupSequence|array<string|GroupSequence>|null $groups        The validation groups to validate. If none is given, "Default" is assumed
     *
     * @return ConstraintViolationListInterface A list of constraint violations
     *                                          If the list is empty, validation
     *                                          succeeded
     */
    public function validatePropertyValue(object|string $objectOrClass, string $propertyName, mixed $value, string|GroupSequence|array|null $groups = null) : ConstraintViolationListInterface;
    
    /**
     * Starts a new validation context and returns a validator for that context.
     *
     * The returned validator collects all violations generated within its
     * context. You can access these violations with the
     * {@link ContextualValidatorInterface::getViolations()} method.
     */
    public function startContext() : ContextualValidatorInterface;
    
    /**
     * Returns a validator in the given execution context.
     *
     * The returned validator adds all generated violations to the given
     * context.
     */
    public function inContext(ExecutionContextInterface $context) : ContextualValidatorInterface;

}

Members

Title Sort descending Modifiers Object type Summary Overrides
MetadataFactoryInterface::getMetadataFor public function Returns the metadata for the given value. 5
MetadataFactoryInterface::hasMetadataFor public function Returns whether the class is able to return metadata for the given value. 5
ValidatorInterface::inContext public function Returns a validator in the given execution context. 3
ValidatorInterface::startContext public function Starts a new validation context and returns a validator for that context. 3
ValidatorInterface::validate public function Validates a value against a constraint or a list of constraints. 3
ValidatorInterface::validateProperty public function Validates a property of an object against the constraints specified
for this property.
3
ValidatorInterface::validatePropertyValue public function Validates a value against the constraints specified for an object&#039;s
property.
3

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal