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
Loading
Loading
Loading
Loading
+5 −4
Changes for core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php: 5 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
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 @@ public function __construct(ExecutionContextInterface $context, MetadataFactoryI
  /**
   * {@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 @@ protected function validateConstraints($value, $cache_key, $constraints) {
  /**
   * {@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 @@ public function validateProperty($object, $propertyName, $groups = NULL) {
  /**
   * {@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.');
    }