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
45630c7c34
commit
4d57608359
|
@ -9,6 +9,7 @@ use Drupal\Core\TypedData\TypedDataInterface;
|
|||
use Drupal\Core\TypedData\TypedDataManagerInterface;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
|
||||
use Symfony\Component\Validator\ConstraintViolationListInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface;
|
||||
use Symfony\Component\Validator\Util\PropertyPath;
|
||||
|
@ -73,7 +74,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function atPath($path) {
|
||||
public function atPath($path): static {
|
||||
// @todo This method is not used at the moment, see
|
||||
// https://www.drupal.org/node/2482527
|
||||
return $this;
|
||||
|
@ -200,14 +201,14 @@ class RecursiveContextualValidator implements ContextualValidatorInterface {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getViolations() {
|
||||
public function getViolations(): ConstraintViolationListInterface {
|
||||
return $this->context->getViolations();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validateProperty($object, $propertyName, $groups = NULL) {
|
||||
public function validateProperty($object, $propertyName, $groups = NULL): static {
|
||||
if (isset($groups)) {
|
||||
throw new \LogicException('Passing custom groups is not supported.');
|
||||
}
|
||||
|
@ -226,7 +227,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validatePropertyValue($object, $property_name, $value, $groups = NULL) {
|
||||
public function validatePropertyValue($object, $property_name, $value, $groups = NULL): static {
|
||||
if (!is_object($object)) {
|
||||
throw new \InvalidArgumentException('Passing class name is not supported.');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue