StringEqualsConcatenatedValuesConstraint.php

Same filename and directory in other branches
  1. 11.x core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/StringEqualsConcatenatedValuesConstraint.php

Namespace

Drupal\Core\Validation\Plugin\Validation\Constraint

File

core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/StringEqualsConcatenatedValuesConstraint.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Core\Validation\Plugin\Validation\Constraint;

use Drupal\Core\Validation\Attribute\Constraint;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Symfony\Component\Validator\Constraint as SymfonyConstraint;

/**
 * Checks a string consists of specific values found in the mapping.
 */
class StringEqualsConcatenatedValuesConstraint extends SymfonyConstraint {
  
  /**
   * Constructs a StringEqualsConcatenatedValuesConstraint object.
   *
   * @param string $separator
   *   The separator separating the values.
   * @param array $values
   *   The mappings to values to concatenate together.
   * @param array|null $reservedCharacters
   *   Reserved characters — if any — that are to be substituted in each value.
   * @param string|null $reservedCharactersSubstitute
   *   Any reserved characters that will be substituted by this character.
   * @param string $message
   *   The error message if the string does not match.
   * @param array|null $groups
   *   An array of validation groups.
   * @param mixed|null $payload
   *   Domain-specific data attached to a constraint.
   */
  public function __construct(public string $separator, public array $values, public ?array $reservedCharacters = [], public ?string $reservedCharactersSubstitute = NULL, public string $message = "Expected '@expected_string', not '@value'. Format: '@expected_format'.", ?array $groups = NULL, mixed $payload = NULL) {
    parent::__construct(groups: $groups, payload: $payload);
  }

}

Classes

Title Deprecated Summary
StringEqualsConcatenatedValuesConstraint Checks a string consists of specific values found in the mapping.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.