Issue #3425150 by godotislate, longwave: Symfony deprecations in Constraint plugins
parent
c703f7ba4e
commit
6663e6489c
|
@ -37,14 +37,14 @@ class RequiredConfigDependenciesConstraint extends SymfonyConstraint {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRequiredOptions() {
|
||||
public function getRequiredOptions(): array {
|
||||
return ['entityTypes'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefaultOption() {
|
||||
public function getDefaultOption(): ?string {
|
||||
return 'entityTypes';
|
||||
}
|
||||
|
||||
|
|
|
@ -39,27 +39,15 @@ class EntityHasFieldConstraint extends SymfonyConstraint {
|
|||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return ?string
|
||||
* Name of the default option.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function getDefaultOption() {
|
||||
public function getDefaultOption(): ?string {
|
||||
return 'field_name';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return array
|
||||
* The names of the required options.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function getRequiredOptions() {
|
||||
public function getRequiredOptions(): array {
|
||||
return (array) $this->getDefaultOption();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,27 +34,15 @@ class ImmutablePropertiesConstraint extends SymfonyConstraint {
|
|||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return ?string
|
||||
* Name of the default option.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function getDefaultOption() {
|
||||
public function getDefaultOption(): ?string {
|
||||
return 'properties';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return array
|
||||
* The names of the required options.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function getRequiredOptions() {
|
||||
public function getRequiredOptions(): array {
|
||||
return ['properties'];
|
||||
}
|
||||
|
||||
|
|
|
@ -41,14 +41,14 @@ class ExtensionExistsConstraint extends SymfonyConstraint {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRequiredOptions() {
|
||||
public function getRequiredOptions(): array {
|
||||
return ['type'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefaultOption() {
|
||||
public function getDefaultOption(): ?string {
|
||||
return 'type';
|
||||
}
|
||||
|
||||
|
|
|
@ -47,27 +47,15 @@ class ComplexDataConstraint extends SymfonyConstraint {
|
|||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return ?string
|
||||
* Name of the default option.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function getDefaultOption() {
|
||||
public function getDefaultOption(): ?string {
|
||||
return 'properties';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return array
|
||||
* The names of the required options.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function getRequiredOptions() {
|
||||
public function getRequiredOptions(): array {
|
||||
return ['properties'];
|
||||
}
|
||||
|
||||
|
|
|
@ -24,14 +24,8 @@ class CountConstraint extends Count {
|
|||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return string
|
||||
* The name of the class that validates this constraint.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function validatedBy() {
|
||||
public function validatedBy(): string {
|
||||
return '\Symfony\Component\Validator\Constraints\CountValidator';
|
||||
}
|
||||
|
||||
|
|
|
@ -27,14 +27,8 @@ class EmailConstraint extends Email {
|
|||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return string
|
||||
* The name of the class that validates this constraint.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function validatedBy() {
|
||||
public function validatedBy(): string {
|
||||
return EmailValidator::class;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,27 +41,15 @@ class EntityBundleExistsConstraint extends SymfonyConstraint {
|
|||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return ?string
|
||||
* Name of the default option.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function getDefaultOption() {
|
||||
public function getDefaultOption(): ?string {
|
||||
return 'entityTypeId';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return array
|
||||
* The names of the required options.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function getRequiredOptions() {
|
||||
public function getRequiredOptions(): array {
|
||||
return ['entityTypeId'];
|
||||
}
|
||||
|
||||
|
|
|
@ -26,14 +26,8 @@ class LengthConstraint extends Length {
|
|||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return string
|
||||
* The name of the class that validates this constraint.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function validatedBy() {
|
||||
public function validatedBy(): string {
|
||||
return '\Symfony\Component\Validator\Constraints\LengthValidator';
|
||||
}
|
||||
|
||||
|
|
|
@ -21,14 +21,8 @@ class RegexConstraint extends Regex {
|
|||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return string
|
||||
* The name of the class that validates this constraint.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function validatedBy() {
|
||||
public function validatedBy(): string {
|
||||
return '\Symfony\Component\Validator\Constraints\RegexValidator';
|
||||
}
|
||||
|
||||
|
|
|
@ -18,11 +18,9 @@ class UniqueFieldConstraint extends SymfonyConstraint {
|
|||
public $message = 'A @entity_type with @field_name %value already exists.';
|
||||
|
||||
/**
|
||||
* Returns the name of the class that validates this constraint.
|
||||
*
|
||||
* @return string
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validatedBy() {
|
||||
public function validatedBy(): string {
|
||||
return '\Drupal\Core\Validation\Plugin\Validation\Constraint\UniqueFieldValueValidator';
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,8 @@ class UuidConstraint extends Uuid {
|
|||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return string
|
||||
* The name of the class that validates this constraint.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function validatedBy() {
|
||||
public function validatedBy(): string {
|
||||
return UuidValidator::class;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,27 +65,15 @@ class ValidKeysConstraint extends SymfonyConstraint {
|
|||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return ?string
|
||||
* Name of the default option.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function getDefaultOption() {
|
||||
public function getDefaultOption(): ?string {
|
||||
return 'allowedKeys';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return array
|
||||
* The names of the required options.
|
||||
*
|
||||
* @todo Add method return type declaration.
|
||||
* @see https://www.drupal.org/project/drupal/issues/3425150
|
||||
*/
|
||||
public function getRequiredOptions() {
|
||||
public function getRequiredOptions(): array {
|
||||
return ['allowedKeys'];
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class ToolbarItemDependencyConstraint extends SymfonyConstraint {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRequiredOptions() {
|
||||
public function getRequiredOptions(): array {
|
||||
return ['toolbarItem'];
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class UniqueLabelInListConstraint extends SymfonyConstraint {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRequiredOptions() {
|
||||
public function getRequiredOptions(): array {
|
||||
return ['labelKey'];
|
||||
}
|
||||
|
||||
|
|
|
@ -19,14 +19,14 @@ class TestFieldConstraint extends NotEqualTo {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRequiredOptions() {
|
||||
public function getRequiredOptions(): array {
|
||||
return ['value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validatedBy() {
|
||||
public function validatedBy(): string {
|
||||
return '\Symfony\Component\Validator\Constraints\NotEqualToValidator';
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class FileExtensionConstraint extends SymfonyConstraint {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefaultOption(): string {
|
||||
public function getDefaultOption(): ?string {
|
||||
return 'extensions';
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class FileUriUnique extends SymfonyConstraint {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validatedBy() {
|
||||
public function validatedBy(): string {
|
||||
return '\Drupal\Core\Validation\Plugin\Validation\Constraint\UniqueFieldValueValidator';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue