diff --git a/src/Symfony/Bridge/Doctrine/Validator/DoctrineInitializer.php b/src/Symfony/Bridge/Doctrine/Validator/DoctrineInitializer.php index 010c051581..3b482565a8 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/DoctrineInitializer.php +++ b/src/Symfony/Bridge/Doctrine/Validator/DoctrineInitializer.php @@ -28,7 +28,7 @@ class DoctrineInitializer implements ObjectInitializerInterface $this->registry = $registry; } - public function initialize($object) + public function initialize(object $object) { $manager = $this->registry->getManagerForClass(\get_class($object)); if (null !== $manager) { diff --git a/src/Symfony/Component/Validator/ConstraintViolationList.php b/src/Symfony/Component/Validator/ConstraintViolationList.php index c30ee57cb2..d5bedd21e2 100644 --- a/src/Symfony/Component/Validator/ConstraintViolationList.php +++ b/src/Symfony/Component/Validator/ConstraintViolationList.php @@ -72,7 +72,7 @@ class ConstraintViolationList implements \IteratorAggregate, ConstraintViolation /** * {@inheritdoc} */ - public function get($offset) + public function get(int $offset) { if (!isset($this->violations[$offset])) { throw new \OutOfBoundsException(sprintf('The offset "%s" does not exist.', $offset)); @@ -84,7 +84,7 @@ class ConstraintViolationList implements \IteratorAggregate, ConstraintViolation /** * {@inheritdoc} */ - public function has($offset) + public function has(int $offset) { return isset($this->violations[$offset]); } @@ -92,7 +92,7 @@ class ConstraintViolationList implements \IteratorAggregate, ConstraintViolation /** * {@inheritdoc} */ - public function set($offset, ConstraintViolationInterface $violation) + public function set(int $offset, ConstraintViolationInterface $violation) { $this->violations[$offset] = $violation; } @@ -100,7 +100,7 @@ class ConstraintViolationList implements \IteratorAggregate, ConstraintViolation /** * {@inheritdoc} */ - public function remove($offset) + public function remove(int $offset) { unset($this->violations[$offset]); } diff --git a/src/Symfony/Component/Validator/ConstraintViolationListInterface.php b/src/Symfony/Component/Validator/ConstraintViolationListInterface.php index 47e986f51e..d253f688d3 100644 --- a/src/Symfony/Component/Validator/ConstraintViolationListInterface.php +++ b/src/Symfony/Component/Validator/ConstraintViolationListInterface.php @@ -37,7 +37,7 @@ interface ConstraintViolationListInterface extends \Traversable, \Countable, \Ar * * @throws \OutOfBoundsException if the offset does not exist */ - public function get($offset); + public function get(int $offset); /** * Returns whether the given offset exists. @@ -46,7 +46,7 @@ interface ConstraintViolationListInterface extends \Traversable, \Countable, \Ar * * @return bool Whether the offset exists */ - public function has($offset); + public function has(int $offset); /** * Sets a violation at a given offset. @@ -54,12 +54,12 @@ interface ConstraintViolationListInterface extends \Traversable, \Countable, \Ar * @param int $offset The violation offset * @param ConstraintViolationInterface $violation The violation */ - public function set($offset, ConstraintViolationInterface $violation); + public function set(int $offset, ConstraintViolationInterface $violation); /** * Removes a violation at a given offset. * * @param int $offset The offset to remove */ - public function remove($offset); + public function remove(int $offset); } diff --git a/src/Symfony/Component/Validator/Context/ExecutionContext.php b/src/Symfony/Component/Validator/Context/ExecutionContext.php index bfb767a0d4..56c38d160e 100644 --- a/src/Symfony/Component/Validator/Context/ExecutionContext.php +++ b/src/Symfony/Component/Validator/Context/ExecutionContext.php @@ -143,7 +143,7 @@ class ExecutionContext implements ExecutionContextInterface /** * {@inheritdoc} */ - public function setNode($value, $object, MetadataInterface $metadata = null, $propertyPath) + public function setNode($value, ?object $object, MetadataInterface $metadata = null, string $propertyPath) { $this->value = $value; $this->object = $object; @@ -154,7 +154,7 @@ class ExecutionContext implements ExecutionContextInterface /** * {@inheritdoc} */ - public function setGroup($group) + public function setGroup(?string $group) { $this->group = $group; } @@ -170,7 +170,7 @@ class ExecutionContext implements ExecutionContextInterface /** * {@inheritdoc} */ - public function addViolation($message, array $parameters = []) + public function addViolation(string $message, array $parameters = []) { $this->violations->add(new ConstraintViolation( $this->translator->trans($message, $parameters, $this->translationDomain), @@ -188,7 +188,7 @@ class ExecutionContext implements ExecutionContextInterface /** * {@inheritdoc} */ - public function buildViolation($message, array $parameters = []) + public function buildViolation(string $message, array $parameters = []) { return new ConstraintViolationBuilder( $this->violations, @@ -283,7 +283,7 @@ class ExecutionContext implements ExecutionContextInterface /** * {@inheritdoc} */ - public function getPropertyPath($subPath = '') + public function getPropertyPath(string $subPath = '') { return PropertyPath::append($this->propertyPath, $subPath); } @@ -291,7 +291,7 @@ class ExecutionContext implements ExecutionContextInterface /** * {@inheritdoc} */ - public function markGroupAsValidated($cacheKey, $groupHash) + public function markGroupAsValidated(string $cacheKey, string $groupHash) { if (!isset($this->validatedObjects[$cacheKey])) { $this->validatedObjects[$cacheKey] = []; @@ -303,7 +303,7 @@ class ExecutionContext implements ExecutionContextInterface /** * {@inheritdoc} */ - public function isGroupValidated($cacheKey, $groupHash) + public function isGroupValidated(string $cacheKey, string $groupHash) { return isset($this->validatedObjects[$cacheKey][$groupHash]); } @@ -311,7 +311,7 @@ class ExecutionContext implements ExecutionContextInterface /** * {@inheritdoc} */ - public function markConstraintAsValidated($cacheKey, $constraintHash) + public function markConstraintAsValidated(string $cacheKey, string $constraintHash) { $this->validatedConstraints[$cacheKey.':'.$constraintHash] = true; } @@ -319,7 +319,7 @@ class ExecutionContext implements ExecutionContextInterface /** * {@inheritdoc} */ - public function isConstraintValidated($cacheKey, $constraintHash) + public function isConstraintValidated(string $cacheKey, string $constraintHash) { return isset($this->validatedConstraints[$cacheKey.':'.$constraintHash]); } @@ -327,7 +327,7 @@ class ExecutionContext implements ExecutionContextInterface /** * {@inheritdoc} */ - public function markObjectAsInitialized($cacheKey) + public function markObjectAsInitialized(string $cacheKey) { $this->initializedObjects[$cacheKey] = true; } @@ -335,7 +335,7 @@ class ExecutionContext implements ExecutionContextInterface /** * {@inheritdoc} */ - public function isObjectInitialized($cacheKey) + public function isObjectInitialized(string $cacheKey) { return isset($this->initializedObjects[$cacheKey]); } diff --git a/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php b/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php index 2ab625b156..0f02e1f694 100644 --- a/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php +++ b/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php @@ -67,7 +67,7 @@ interface ExecutionContextInterface * @param string $message The error message * @param array $params The parameters substituted in the error message */ - public function addViolation($message, array $params = []); + public function addViolation(string $message, array $params = []); /** * Returns a builder for adding a violation with extended information. @@ -86,7 +86,7 @@ interface ExecutionContextInterface * * @return ConstraintViolationBuilderInterface The violation builder */ - public function buildViolation($message, array $parameters = []); + public function buildViolation(string $message, array $parameters = []); /** * Returns the validator. @@ -133,7 +133,7 @@ interface ExecutionContextInterface * @internal Used by the validator engine. Should not be called by user * code. */ - public function setNode($value, $object, MetadataInterface $metadata = null, $propertyPath); + public function setNode($value, ?object $object, MetadataInterface $metadata = null, string $propertyPath); /** * Sets the currently validated group. @@ -143,7 +143,7 @@ interface ExecutionContextInterface * @internal Used by the validator engine. Should not be called by user * code. */ - public function setGroup($group); + public function setGroup(?string $group); /** * Sets the currently validated constraint. @@ -165,7 +165,7 @@ interface ExecutionContextInterface * @internal Used by the validator engine. Should not be called by user * code. */ - public function markGroupAsValidated($cacheKey, $groupHash); + public function markGroupAsValidated(string $cacheKey, string $groupHash); /** * Returns whether an object was validated in a specific validation group. @@ -180,7 +180,7 @@ interface ExecutionContextInterface * @internal Used by the validator engine. Should not be called by user * code. */ - public function isGroupValidated($cacheKey, $groupHash); + public function isGroupValidated(string $cacheKey, string $groupHash); /** * Marks a constraint as validated for an object. @@ -191,7 +191,7 @@ interface ExecutionContextInterface * @internal Used by the validator engine. Should not be called by user * code. */ - public function markConstraintAsValidated($cacheKey, $constraintHash); + public function markConstraintAsValidated(string $cacheKey, string $constraintHash); /** * Returns whether a constraint was validated for an object. @@ -204,7 +204,7 @@ interface ExecutionContextInterface * @internal Used by the validator engine. Should not be called by user * code. */ - public function isConstraintValidated($cacheKey, $constraintHash); + public function isConstraintValidated(string $cacheKey, string $constraintHash); /** * Marks that an object was initialized. @@ -216,7 +216,7 @@ interface ExecutionContextInterface * * @see ObjectInitializerInterface */ - public function markObjectAsInitialized($cacheKey); + public function markObjectAsInitialized(string $cacheKey); /** * Returns whether an object was initialized. @@ -230,7 +230,7 @@ interface ExecutionContextInterface * * @see ObjectInitializerInterface */ - public function isObjectInitialized($cacheKey); + public function isObjectInitialized(string $cacheKey); /** * Returns the violations generated by the validator so far. @@ -340,5 +340,5 @@ interface ExecutionContextInterface * string if the validator is currently validating the * root value of the validation graph. */ - public function getPropertyPath($subPath = ''); + public function getPropertyPath(string $subPath = ''); } diff --git a/src/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php b/src/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php index f770f46154..cf2541deb3 100644 --- a/src/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php +++ b/src/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php @@ -25,7 +25,7 @@ interface CacheInterface * * @param string $class */ - public function has($class); + public function has(string $class); /** * Returns the metadata for the given class from the cache. @@ -34,7 +34,7 @@ interface CacheInterface * * @return ClassMetadata|false A ClassMetadata instance or false on miss */ - public function read($class); + public function read(string $class); /** * Stores a class metadata in the cache. diff --git a/src/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php b/src/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php index 2f54019328..17b46e9823 100644 --- a/src/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php +++ b/src/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php @@ -36,7 +36,7 @@ final class DoctrineCache implements CacheInterface /** * {@inheritdoc} */ - public function has($class): bool + public function has(string $class): bool { return $this->cache->contains($class); } @@ -44,7 +44,7 @@ final class DoctrineCache implements CacheInterface /** * {@inheritdoc} */ - public function read($class) + public function read(string $class) { return $this->cache->fetch($class); } diff --git a/src/Symfony/Component/Validator/Mapping/Cache/Psr6Cache.php b/src/Symfony/Component/Validator/Mapping/Cache/Psr6Cache.php index 7d1cdd8003..e913e280e6 100644 --- a/src/Symfony/Component/Validator/Mapping/Cache/Psr6Cache.php +++ b/src/Symfony/Component/Validator/Mapping/Cache/Psr6Cache.php @@ -31,7 +31,7 @@ class Psr6Cache implements CacheInterface /** * {@inheritdoc} */ - public function has($class) + public function has(string $class) { return $this->cacheItemPool->hasItem($this->escapeClassName($class)); } @@ -39,7 +39,7 @@ class Psr6Cache implements CacheInterface /** * {@inheritdoc} */ - public function read($class) + public function read(string $class) { $item = $this->cacheItemPool->getItem($this->escapeClassName($class)); diff --git a/src/Symfony/Component/Validator/Mapping/ClassMetadata.php b/src/Symfony/Component/Validator/Mapping/ClassMetadata.php index 6e0256c290..d1ee1212ba 100644 --- a/src/Symfony/Component/Validator/Mapping/ClassMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/ClassMetadata.php @@ -364,7 +364,7 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface /** * {@inheritdoc} */ - public function hasPropertyMetadata($property) + public function hasPropertyMetadata(string $property) { return \array_key_exists($property, $this->members); } @@ -372,7 +372,7 @@ class ClassMetadata extends GenericMetadata implements ClassMetadataInterface /** * {@inheritdoc} */ - public function getPropertyMetadata($property) + public function getPropertyMetadata(string $property) { if (!isset($this->members[$property])) { return []; diff --git a/src/Symfony/Component/Validator/Mapping/ClassMetadataInterface.php b/src/Symfony/Component/Validator/Mapping/ClassMetadataInterface.php index 1b6f07ac8e..b25fc018bb 100644 --- a/src/Symfony/Component/Validator/Mapping/ClassMetadataInterface.php +++ b/src/Symfony/Component/Validator/Mapping/ClassMetadataInterface.php @@ -81,7 +81,7 @@ interface ClassMetadataInterface extends MetadataInterface * * @return bool */ - public function hasPropertyMetadata($property); + public function hasPropertyMetadata(string $property); /** * Returns all metadata instances for the given named property. @@ -94,7 +94,7 @@ interface ClassMetadataInterface extends MetadataInterface * @return PropertyMetadataInterface[] A list of metadata instances. Empty if * no metadata exists for the property. */ - public function getPropertyMetadata($property); + public function getPropertyMetadata(string $property); /** * Returns the name of the backing PHP class. diff --git a/src/Symfony/Component/Validator/Mapping/GenericMetadata.php b/src/Symfony/Component/Validator/Mapping/GenericMetadata.php index 139d252fc0..9a2a2d6db7 100644 --- a/src/Symfony/Component/Validator/Mapping/GenericMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/GenericMetadata.php @@ -185,7 +185,7 @@ class GenericMetadata implements MetadataInterface * * Aware of the global group (* group). */ - public function findConstraints($group) + public function findConstraints(string $group) { return isset($this->constraintsByGroup[$group]) ? $this->constraintsByGroup[$group] diff --git a/src/Symfony/Component/Validator/Mapping/MetadataInterface.php b/src/Symfony/Component/Validator/Mapping/MetadataInterface.php index 514beb9492..f46af2fcce 100644 --- a/src/Symfony/Component/Validator/Mapping/MetadataInterface.php +++ b/src/Symfony/Component/Validator/Mapping/MetadataInterface.php @@ -62,5 +62,5 @@ interface MetadataInterface * * @return Constraint[] A list of constraint instances */ - public function findConstraints($group); + public function findConstraints(string $group); } diff --git a/src/Symfony/Component/Validator/ObjectInitializerInterface.php b/src/Symfony/Component/Validator/ObjectInitializerInterface.php index 1bd55f0cda..8d0688cece 100644 --- a/src/Symfony/Component/Validator/ObjectInitializerInterface.php +++ b/src/Symfony/Component/Validator/ObjectInitializerInterface.php @@ -27,5 +27,5 @@ interface ObjectInitializerInterface * * @param object $object The object to validate */ - public function initialize($object); + public function initialize(object $object); } diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php b/src/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php index 39f5477779..e5e200a5ba 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/FakeClassMetadata.php @@ -15,7 +15,7 @@ use Symfony\Component\Validator\Mapping\ClassMetadata; class FakeClassMetadata extends ClassMetadata { - public function addCustomPropertyMetadata($propertyName, $metadata) + public function addCustomPropertyMetadata(string $propertyName, $metadata) { if (!isset($this->members[$propertyName])) { $this->members[$propertyName] = []; diff --git a/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php b/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php index c8b545b54b..68cd36eac9 100644 --- a/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php +++ b/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php @@ -32,7 +32,7 @@ interface ContextualValidatorInterface * * @return $this */ - public function atPath($path); + public function atPath(string $path); /** * Validates a value against a constraint or a list of constraints. @@ -58,7 +58,7 @@ interface ContextualValidatorInterface * * @return $this */ - public function validateProperty($object, $propertyName, $groups = null); + public function validateProperty($object, string $propertyName, $groups = null); /** * Validates a value against the constraints specified for an object's @@ -71,7 +71,7 @@ interface ContextualValidatorInterface * * @return $this */ - public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null); + public function validatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null); /** * Returns the violations that have been generated so far in the context diff --git a/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php b/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php index 33e207af47..cad3acc154 100644 --- a/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php +++ b/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php @@ -71,7 +71,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface /** * {@inheritdoc} */ - public function atPath($path) + public function atPath(string $path) { $this->defaultPropertyPath = $this->context->getPropertyPath($path); @@ -169,7 +169,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface /** * {@inheritdoc} */ - public function validateProperty($object, $propertyName, $groups = null) + public function validateProperty($object, string $propertyName, $groups = null) { $classMetadata = $this->metadataFactory->getMetadataFor($object); @@ -213,7 +213,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface /** * {@inheritdoc} */ - public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) + public function validatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null) { $classMetadata = $this->metadataFactory->getMetadataFor($objectOrClass); @@ -295,7 +295,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface * traversal, the object will be iterated and each nested object will be * validated instead. * - * @param object $object The object to cascade + * @param object|int|float|string $object The object to cascade * @param string $propertyPath The current property path * @param (string|GroupSequence)[] $groups The validated groups * @param int $traversalStrategy The strategy for traversing the @@ -437,7 +437,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface * * @see TraversalStrategy */ - private function validateClassNode($object, $cacheKey, ClassMetadataInterface $metadata = null, $propertyPath, array $groups, $cascadedGroups, $traversalStrategy, ExecutionContextInterface $context) + private function validateClassNode(object $object, $cacheKey, ClassMetadataInterface $metadata = null, $propertyPath, array $groups, $cascadedGroups, $traversalStrategy, ExecutionContextInterface $context) { $context->setNode($object, $object, $metadata, $propertyPath); @@ -616,7 +616,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface * * @see TraversalStrategy */ - private function validateGenericNode($value, $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, array $groups, $cascadedGroups, $traversalStrategy, ExecutionContextInterface $context) + private function validateGenericNode($value, ?object $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, array $groups, $cascadedGroups, $traversalStrategy, ExecutionContextInterface $context) { $context->setNode($value, $object, $metadata, $propertyPath); @@ -724,7 +724,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface * the group sequence * @param ExecutionContextInterface $context The execution context */ - private function stepThroughGroupSequence($value, $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, $traversalStrategy, GroupSequence $groupSequence, $cascadedGroup, ExecutionContextInterface $context) + private function stepThroughGroupSequence($value, ?object $object, $cacheKey, MetadataInterface $metadata = null, $propertyPath, $traversalStrategy, GroupSequence $groupSequence, $cascadedGroup, ExecutionContextInterface $context) { $violationCount = \count($context->getViolations()); $cascadedGroups = $cascadedGroup ? [$cascadedGroup] : null; diff --git a/src/Symfony/Component/Validator/Validator/RecursiveValidator.php b/src/Symfony/Component/Validator/Validator/RecursiveValidator.php index a258fd4a77..8a04e1d197 100644 --- a/src/Symfony/Component/Validator/Validator/RecursiveValidator.php +++ b/src/Symfony/Component/Validator/Validator/RecursiveValidator.php @@ -104,7 +104,7 @@ class RecursiveValidator implements ValidatorInterface /** * {@inheritdoc} */ - public function validateProperty($object, $propertyName, $groups = null) + public function validateProperty($object, string $propertyName, $groups = null) { return $this->startContext($object) ->validateProperty($object, $propertyName, $groups) @@ -114,7 +114,7 @@ class RecursiveValidator implements ValidatorInterface /** * {@inheritdoc} */ - public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) + public function validatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null) { // If a class name is passed, take $value as root return $this->startContext(\is_object($objectOrClass) ? $objectOrClass : $value) diff --git a/src/Symfony/Component/Validator/Validator/TraceableValidator.php b/src/Symfony/Component/Validator/Validator/TraceableValidator.php index c08910d8de..be7daf48c8 100644 --- a/src/Symfony/Component/Validator/Validator/TraceableValidator.php +++ b/src/Symfony/Component/Validator/Validator/TraceableValidator.php @@ -105,7 +105,7 @@ class TraceableValidator implements ValidatorInterface, ResetInterface /** * {@inheritdoc} */ - public function validateProperty($object, $propertyName, $groups = null) + public function validateProperty($object, string $propertyName, $groups = null) { return $this->validator->validateProperty($object, $propertyName, $groups); } @@ -113,7 +113,7 @@ class TraceableValidator implements ValidatorInterface, ResetInterface /** * {@inheritdoc} */ - public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) + public function validatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null) { return $this->validator->validatePropertyValue($objectOrClass, $propertyName, $value, $groups); } diff --git a/src/Symfony/Component/Validator/Validator/ValidatorInterface.php b/src/Symfony/Component/Validator/Validator/ValidatorInterface.php index 78157465ab..23356638be 100644 --- a/src/Symfony/Component/Validator/Validator/ValidatorInterface.php +++ b/src/Symfony/Component/Validator/Validator/ValidatorInterface.php @@ -52,7 +52,7 @@ interface ValidatorInterface extends MetadataFactoryInterface * If the list is empty, validation * succeeded */ - public function validateProperty($object, $propertyName, $groups = null); + public function validateProperty($object, string $propertyName, $groups = null); /** * Validates a value against the constraints specified for an object's @@ -67,7 +67,7 @@ interface ValidatorInterface extends MetadataFactoryInterface * If the list is empty, validation * succeeded */ - public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null); + public function validatePropertyValue($objectOrClass, string $propertyName, $value, $groups = null); /** * Starts a new validation context and returns a validator for that context. diff --git a/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php b/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php index 151a815815..2291132050 100644 --- a/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php +++ b/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php @@ -59,7 +59,7 @@ class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface /** * {@inheritdoc} */ - public function atPath($path) + public function atPath(string $path) { $this->propertyPath = PropertyPath::append($this->propertyPath, $path); @@ -69,7 +69,7 @@ class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface /** * {@inheritdoc} */ - public function setParameter($key, $value) + public function setParameter(string $key, string $value) { $this->parameters[$key] = $value; @@ -89,7 +89,7 @@ class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface /** * {@inheritdoc} */ - public function setTranslationDomain($translationDomain) + public function setTranslationDomain(string $translationDomain) { $this->translationDomain = $translationDomain; @@ -109,7 +109,7 @@ class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface /** * {@inheritdoc} */ - public function setPlural($number) + public function setPlural(int $number) { $this->plural = $number; @@ -119,7 +119,7 @@ class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface /** * {@inheritdoc} */ - public function setCode($code) + public function setCode(?string $code) { $this->code = $code; diff --git a/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilderInterface.php b/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilderInterface.php index cb007b6e65..9ac1b8b4c4 100644 --- a/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilderInterface.php +++ b/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilderInterface.php @@ -33,7 +33,7 @@ interface ConstraintViolationBuilderInterface * * @return $this */ - public function atPath($path); + public function atPath(string $path); /** * Sets a parameter to be inserted into the violation message. @@ -43,7 +43,7 @@ interface ConstraintViolationBuilderInterface * * @return $this */ - public function setParameter($key, $value); + public function setParameter(string $key, string $value); /** * Sets all parameters to be inserted into the violation message. @@ -66,7 +66,7 @@ interface ConstraintViolationBuilderInterface * * @see \Symfony\Contracts\Translation\TranslatorInterface */ - public function setTranslationDomain($translationDomain); + public function setTranslationDomain(string $translationDomain); /** * Sets the invalid value that caused this violation. @@ -87,7 +87,7 @@ interface ConstraintViolationBuilderInterface * * @see \Symfony\Contracts\Translation\TranslatorInterface::trans() */ - public function setPlural($number); + public function setPlural(int $number); /** * Sets the violation code. @@ -96,7 +96,7 @@ interface ConstraintViolationBuilderInterface * * @return $this */ - public function setCode($code); + public function setCode(?string $code); /** * Sets the cause of the violation.