Skip to content
Snippets Groups Projects
Commit 4d576083 authored by catch's avatar catch
Browse files

Issue #3233474 by daffie: [Symfony 6] Add the type hints to the methods...

Issue #3233474 by daffie: [Symfony 6] Add the type hints to the methods overriding Symfony\Component\Validator\Validator\ContextualValidatorInterface::atPath(), ::getViolations(), ::validateProperty() and ::validatePropertyValue()
parent 45630c7c
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
use Drupal\Core\TypedData\TypedDataManagerInterface; use Drupal\Core\TypedData\TypedDataManagerInterface;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
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;
use Symfony\Component\Validator\Util\PropertyPath; use Symfony\Component\Validator\Util\PropertyPath;
...@@ -73,7 +74,7 @@ public function __construct(ExecutionContextInterface $context, MetadataFactoryI ...@@ -73,7 +74,7 @@ public function __construct(ExecutionContextInterface $context, MetadataFactoryI
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function atPath($path) { public function atPath($path): static {
// @todo This method is not used at the moment, see // @todo This method is not used at the moment, see
// https://www.drupal.org/node/2482527 // https://www.drupal.org/node/2482527
return $this; return $this;
...@@ -200,14 +201,14 @@ protected function validateConstraints($value, $cache_key, $constraints) { ...@@ -200,14 +201,14 @@ protected function validateConstraints($value, $cache_key, $constraints) {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getViolations() { public function getViolations(): ConstraintViolationListInterface {
return $this->context->getViolations(); return $this->context->getViolations();
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function validateProperty($object, $propertyName, $groups = NULL) { public function validateProperty($object, $propertyName, $groups = NULL): static {
if (isset($groups)) { if (isset($groups)) {
throw new \LogicException('Passing custom groups is not supported.'); throw new \LogicException('Passing custom groups is not supported.');
} }
...@@ -226,7 +227,7 @@ public function validateProperty($object, $propertyName, $groups = NULL) { ...@@ -226,7 +227,7 @@ public function validateProperty($object, $propertyName, $groups = NULL) {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function validatePropertyValue($object, $property_name, $value, $groups = NULL) { public function validatePropertyValue($object, $property_name, $value, $groups = NULL): static {
if (!is_object($object)) { if (!is_object($object)) {
throw new \InvalidArgumentException('Passing class name is not supported.'); throw new \InvalidArgumentException('Passing class name is not supported.');
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment