Loading core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/ConfigExistsConstraint.php +14 −12 Original line number Diff line number Diff line Loading @@ -18,25 +18,27 @@ class ConfigExistsConstraint extends SymfonyConstraint { /** * Optional prefix, to be specified when this contains a config entity ID. * Constructs a ConfigExistsConstraint object. * * @param string $prefix * Optional prefix, to be specified when this contains a config entity ID. * Every config entity type can have multiple instances, all with unique IDs * but the same config prefix. When config refers to a config entity, * typically only the ID is stored, not the prefix. * * @var string * @param string $message * The error message if the config does not exist. * @param array|null $groups * The groups that the constraint belongs to. * @param mixed|null $payload * Domain-specific data attached to a constraint. */ public string $prefix = ''; public function __construct( mixed $options = NULL, ?string $prefix = NULL, public string $prefix = '', public string $message = "The '@name' config does not exist.", ?array $groups = NULL, mixed $payload = NULL, ) { parent::__construct($options, $groups, $payload); $this->prefix = $prefix ?? $this->prefix; parent::__construct(groups: $groups, payload: $payload); } } core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/LangcodeRequiredIfTranslatableValuesConstraint.php +1 −2 Original line number Diff line number Diff line Loading @@ -19,13 +19,12 @@ class LangcodeRequiredIfTranslatableValuesConstraint extends SymfonyConstraint { public function __construct( mixed $options = NULL, public string $missingMessage = "The @name config object must specify a language code, because it contains translatable values.", public string $superfluousMessage = "The @name config object does not contain any translatable values, so it should not specify a language code.", ?array $groups = NULL, mixed $payload = NULL, ) { parent::__construct($options, $groups, $payload); parent::__construct(groups: $groups, payload: $payload); } } core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/RequiredConfigDependenciesConstraint.php +13 −25 Original line number Diff line number Diff line Loading @@ -18,38 +18,26 @@ class RequiredConfigDependenciesConstraint extends SymfonyConstraint { /** * The IDs of entity types that need to exist in config dependencies. * Constructs a RequiredConfigDependenciesConstraint object. * * For example, if an entity requires a filter format in its config * @param array $entityTypes * The IDs of entity types that need to exist in config dependencies. For * example, if an entity requires a filter format in its config * dependencies, this should contain `filter_format`. * * @var string[] * @param string $message * The error message. * @param array|null $groups * The groups that the constraint belongs to. * @param mixed|null $payload * Domain-specific data attached to a constraint. */ public array $entityTypes = []; public function __construct( mixed $options = NULL, ?array $entityTypes = NULL, public array $entityTypes = [], public string $message = 'This @entity_type requires a @dependency_type.', ?array $groups = NULL, mixed $payload = NULL, ) { parent::__construct($options, $groups, $payload); $this->entityTypes = $entityTypes ?? $this->entityTypes; } /** * {@inheritdoc} */ public function getRequiredOptions(): array { return ['entityTypes']; } /** * {@inheritdoc} */ public function getDefaultOption(): ?string { return 'entityTypes'; parent::__construct(groups: $groups, payload: $payload); } } core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/BundleConstraint.php +2 −25 Original line number Diff line number Diff line Loading @@ -19,22 +19,13 @@ )] class BundleConstraint extends SymfonyConstraint { /** * The bundle option. * * @var string|array */ public $bundle; public function __construct( mixed $options = NULL, string|array|null $bundle = NULL, public string|array $bundle, public $message = 'The entity must be of bundle %bundle.', ?array $groups = NULL, mixed $payload = NULL, ) { parent::__construct($options, $groups, $payload); $this->bundle = $bundle ?? $this->bundle; parent::__construct(groups: $groups, payload: $payload); } /** Loading @@ -51,18 +42,4 @@ public function getBundleOption() { return $this->bundle; } /** * {@inheritdoc} */ public function getDefaultOption(): ?string { return 'bundle'; } /** * {@inheritdoc} */ public function getRequiredOptions(): array { return ['bundle']; } } core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityChangedConstraint.php +1 −2 Original line number Diff line number Diff line Loading @@ -17,12 +17,11 @@ class EntityChangedConstraint extends SymfonyConstraint { public function __construct( mixed $options = NULL, public $message = 'The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.', ?array $groups = NULL, mixed $payload = NULL, ) { parent::__construct($options, $groups, $payload); parent::__construct(groups: $groups, payload: $payload); } } Loading
core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/ConfigExistsConstraint.php +14 −12 Original line number Diff line number Diff line Loading @@ -18,25 +18,27 @@ class ConfigExistsConstraint extends SymfonyConstraint { /** * Optional prefix, to be specified when this contains a config entity ID. * Constructs a ConfigExistsConstraint object. * * @param string $prefix * Optional prefix, to be specified when this contains a config entity ID. * Every config entity type can have multiple instances, all with unique IDs * but the same config prefix. When config refers to a config entity, * typically only the ID is stored, not the prefix. * * @var string * @param string $message * The error message if the config does not exist. * @param array|null $groups * The groups that the constraint belongs to. * @param mixed|null $payload * Domain-specific data attached to a constraint. */ public string $prefix = ''; public function __construct( mixed $options = NULL, ?string $prefix = NULL, public string $prefix = '', public string $message = "The '@name' config does not exist.", ?array $groups = NULL, mixed $payload = NULL, ) { parent::__construct($options, $groups, $payload); $this->prefix = $prefix ?? $this->prefix; parent::__construct(groups: $groups, payload: $payload); } }
core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/LangcodeRequiredIfTranslatableValuesConstraint.php +1 −2 Original line number Diff line number Diff line Loading @@ -19,13 +19,12 @@ class LangcodeRequiredIfTranslatableValuesConstraint extends SymfonyConstraint { public function __construct( mixed $options = NULL, public string $missingMessage = "The @name config object must specify a language code, because it contains translatable values.", public string $superfluousMessage = "The @name config object does not contain any translatable values, so it should not specify a language code.", ?array $groups = NULL, mixed $payload = NULL, ) { parent::__construct($options, $groups, $payload); parent::__construct(groups: $groups, payload: $payload); } }
core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/RequiredConfigDependenciesConstraint.php +13 −25 Original line number Diff line number Diff line Loading @@ -18,38 +18,26 @@ class RequiredConfigDependenciesConstraint extends SymfonyConstraint { /** * The IDs of entity types that need to exist in config dependencies. * Constructs a RequiredConfigDependenciesConstraint object. * * For example, if an entity requires a filter format in its config * @param array $entityTypes * The IDs of entity types that need to exist in config dependencies. For * example, if an entity requires a filter format in its config * dependencies, this should contain `filter_format`. * * @var string[] * @param string $message * The error message. * @param array|null $groups * The groups that the constraint belongs to. * @param mixed|null $payload * Domain-specific data attached to a constraint. */ public array $entityTypes = []; public function __construct( mixed $options = NULL, ?array $entityTypes = NULL, public array $entityTypes = [], public string $message = 'This @entity_type requires a @dependency_type.', ?array $groups = NULL, mixed $payload = NULL, ) { parent::__construct($options, $groups, $payload); $this->entityTypes = $entityTypes ?? $this->entityTypes; } /** * {@inheritdoc} */ public function getRequiredOptions(): array { return ['entityTypes']; } /** * {@inheritdoc} */ public function getDefaultOption(): ?string { return 'entityTypes'; parent::__construct(groups: $groups, payload: $payload); } }
core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/BundleConstraint.php +2 −25 Original line number Diff line number Diff line Loading @@ -19,22 +19,13 @@ )] class BundleConstraint extends SymfonyConstraint { /** * The bundle option. * * @var string|array */ public $bundle; public function __construct( mixed $options = NULL, string|array|null $bundle = NULL, public string|array $bundle, public $message = 'The entity must be of bundle %bundle.', ?array $groups = NULL, mixed $payload = NULL, ) { parent::__construct($options, $groups, $payload); $this->bundle = $bundle ?? $this->bundle; parent::__construct(groups: $groups, payload: $payload); } /** Loading @@ -51,18 +42,4 @@ public function getBundleOption() { return $this->bundle; } /** * {@inheritdoc} */ public function getDefaultOption(): ?string { return 'bundle'; } /** * {@inheritdoc} */ public function getRequiredOptions(): array { return ['bundle']; } }
core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityChangedConstraint.php +1 −2 Original line number Diff line number Diff line Loading @@ -17,12 +17,11 @@ class EntityChangedConstraint extends SymfonyConstraint { public function __construct( mixed $options = NULL, public $message = 'The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.', ?array $groups = NULL, mixed $payload = NULL, ) { parent::__construct($options, $groups, $payload); parent::__construct(groups: $groups, payload: $payload); } }