Issue #3436391 by mondrake: Fix return typehinting for Validator related classes
parent
9dbd2a6b46
commit
82df75eb8e
|
@ -42,7 +42,7 @@ class ConfigExistsConstraintValidator extends ConstraintValidator implements Con
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(mixed $name, Constraint $constraint) {
|
||||
public function validate(mixed $name, Constraint $constraint): void {
|
||||
assert($constraint instanceof ConfigExistsConstraint);
|
||||
|
||||
// This constraint may be used to validate nullable (optional) values.
|
||||
|
|
|
@ -48,7 +48,7 @@ class RequiredConfigDependenciesConstraintValidator extends ConstraintValidator
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(mixed $entity, Constraint $constraint) {
|
||||
public function validate(mixed $entity, Constraint $constraint): void {
|
||||
assert($constraint instanceof RequiredConfigDependenciesConstraint);
|
||||
|
||||
// Only config entities can have config dependencies.
|
||||
|
|
|
@ -13,7 +13,7 @@ class EntityChangedConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($entity, Constraint $constraint) {
|
||||
public function validate($entity, Constraint $constraint): void {
|
||||
if (isset($entity)) {
|
||||
/** @var \Drupal\Core\Entity\EntityInterface $entity */
|
||||
if (!$entity->isNew()) {
|
||||
|
|
|
@ -14,7 +14,7 @@ class EntityHasFieldConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($entity, Constraint $constraint) {
|
||||
public function validate($entity, Constraint $constraint): void {
|
||||
if (!isset($entity)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class EntityUntranslatableFieldsConstraintValidator extends ConstraintValidator
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($entity, Constraint $constraint) {
|
||||
public function validate($entity, Constraint $constraint): void {
|
||||
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
|
||||
/** @var \Drupal\Core\Entity\Plugin\Validation\Constraint\EntityUntranslatableFieldsConstraint $constraint */
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class ImmutablePropertiesConstraintValidator extends ConstraintValidator impleme
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(mixed $value, Constraint $constraint) {
|
||||
public function validate(mixed $value, Constraint $constraint): void {
|
||||
assert($constraint instanceof ImmutablePropertiesConstraint);
|
||||
|
||||
if (!$value instanceof ConfigEntityInterface) {
|
||||
|
|
|
@ -13,7 +13,7 @@ class ReferenceAccessConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
/** @var \Drupal\Core\Field\FieldItemInterface $value */
|
||||
if (!isset($value)) {
|
||||
return;
|
||||
|
|
|
@ -55,7 +55,7 @@ class ValidReferenceConstraintValidator extends ConstraintValidator implements C
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
/** @var \Drupal\Core\Field\FieldItemListInterface $value */
|
||||
/** @var ValidReferenceConstraint $constraint */
|
||||
if (!isset($value)) {
|
||||
|
|
|
@ -56,7 +56,7 @@ class ExtensionExistsConstraintValidator extends ConstraintValidator implements
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(mixed $extension_name, Constraint $constraint) {
|
||||
public function validate(mixed $extension_name, Constraint $constraint): void {
|
||||
$variables = ['@name' => $extension_name];
|
||||
|
||||
switch ($constraint->type) {
|
||||
|
|
|
@ -42,7 +42,7 @@ class UniquePathAliasConstraintValidator extends ConstraintValidator implements
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($entity, Constraint $constraint) {
|
||||
public function validate($entity, Constraint $constraint): void {
|
||||
/** @var \Drupal\path_alias\PathAliasInterface $entity */
|
||||
$path = $entity->getPath();
|
||||
$alias = $entity->getAlias();
|
||||
|
|
|
@ -42,7 +42,7 @@ class ValidPathConstraintValidator extends ConstraintValidator implements Contai
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
if (!isset($value)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class PluginExistsConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(mixed $plugin_id, Constraint $constraint) {
|
||||
public function validate(mixed $plugin_id, Constraint $constraint): void {
|
||||
assert($constraint instanceof PluginExistsConstraint);
|
||||
|
||||
if ($plugin_id === NULL) {
|
||||
|
|
|
@ -19,7 +19,7 @@ class ComplexDataConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($data, Constraint $constraint) {
|
||||
public function validate($data, Constraint $constraint): void {
|
||||
|
||||
// If un-wrapped data has been passed, fetch the typed data object first.
|
||||
if (!$data instanceof TypedDataInterface) {
|
||||
|
|
|
@ -37,7 +37,7 @@ class EntityBundleExistsConstraintValidator extends ConstraintValidator implemen
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
assert($constraint instanceof EntityBundleExistsConstraint);
|
||||
|
||||
if (!is_string($value)) {
|
||||
|
|
|
@ -17,7 +17,7 @@ final class FullyValidatableConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(mixed $value, Constraint $constraint) {
|
||||
public function validate(mixed $value, Constraint $constraint): void {
|
||||
// No-op.
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class UniqueFieldValueValidator extends ConstraintValidator implements Container
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($items, Constraint $constraint) {
|
||||
public function validate($items, Constraint $constraint): void {
|
||||
if (!$items->first()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class ValidKeysConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(mixed $value, Constraint $constraint) {
|
||||
public function validate(mixed $value, Constraint $constraint): void {
|
||||
assert($constraint instanceof ValidKeysConstraint);
|
||||
|
||||
if (!is_array($value)) {
|
||||
|
|
|
@ -14,7 +14,7 @@ class BlockContentEntityChangedConstraintValidator extends EntityChangedConstrai
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($entity, Constraint $constraint) {
|
||||
public function validate($entity, Constraint $constraint): void {
|
||||
// This prevents saving an update to the block via a host entity's form if
|
||||
// the host entity has had other changes made via the API instead of the
|
||||
// entity form, such as a revision revert. This is safe, for example, in the
|
||||
|
|
|
@ -42,7 +42,7 @@ class BookOutlineConstraintValidator extends ConstraintValidator implements Cont
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($entity, Constraint $constraint) {
|
||||
public function validate($entity, Constraint $constraint): void {
|
||||
if (isset($entity) && !$entity->isNew() && !$entity->isDefaultRevision()) {
|
||||
/** @var \Drupal\Core\Entity\ContentEntityInterface $original */
|
||||
$original = $this->bookManager->loadBookLink($entity->id(), FALSE) ?: [
|
||||
|
|
|
@ -21,7 +21,7 @@ class CKEditor5ElementConstraintValidator extends ConstraintValidator {
|
|||
* @throws \Symfony\Component\Validator\Exception\UnexpectedTypeException
|
||||
* Thrown when the given constraint is not supported by this validator.
|
||||
*/
|
||||
public function validate($element, $constraint) {
|
||||
public function validate($element, $constraint): void {
|
||||
if (!$constraint instanceof CKEditor5ElementConstraint) {
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\CKEditor5Element');
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ class CKEditor5MediaAndFilterSettingsInSyncConstraintValidator extends Constrain
|
|||
* @throws \Symfony\Component\Validator\Exception\UnexpectedTypeException
|
||||
* Thrown when the given constraint is not supported by this validator.
|
||||
*/
|
||||
public function validate($toolbar_item, Constraint $constraint) {
|
||||
public function validate($toolbar_item, Constraint $constraint): void {
|
||||
if (!$constraint instanceof CKEditor5MediaAndFilterSettingsInSyncConstraint) {
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\CKEditor5MediaAndFilterSettingsInSync');
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class EnabledConfigurablePluginsConstraintValidator extends ConstraintValidator
|
|||
* @throws \Symfony\Component\Validator\Exception\UnexpectedTypeException
|
||||
* Thrown when the given constraint is not supported by this validator.
|
||||
*/
|
||||
public function validate($settings, Constraint $constraint) {
|
||||
public function validate($settings, Constraint $constraint): void {
|
||||
if (!$constraint instanceof EnabledConfigurablePluginsConstraint) {
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\EnabledConfigurablePluginsConstraint');
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class FundamentalCompatibilityConstraintValidator extends ConstraintValidator im
|
|||
* @throws \Symfony\Component\Validator\Exception\UnexpectedTypeException
|
||||
* Thrown when the given constraint is not supported by this validator.
|
||||
*/
|
||||
public function validate($toolbar_item, Constraint $constraint) {
|
||||
public function validate($toolbar_item, Constraint $constraint): void {
|
||||
if (!$constraint instanceof FundamentalCompatibilityConstraint) {
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\FundamentalCompatibility');
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class SourceEditingPreventSelfXssConstraintValidator extends ConstraintValidator
|
|||
* @throws \Symfony\Component\Validator\Exception\UnexpectedTypeException
|
||||
* Thrown when the given constraint is not supported by this validator.
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
if (!$constraint instanceof SourceEditingPreventSelfXssConstraint) {
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\SourceEditingPreventSelfXssConstraint');
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class SourceEditingRedundantTagsConstraintValidator extends ConstraintValidator
|
|||
* @throws \Symfony\Component\Validator\Exception\UnexpectedTypeException
|
||||
* Thrown when the given constraint is not supported by this validator.
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
if (!$constraint instanceof SourceEditingRedundantTagsConstraint) {
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\SourceEditingRedundantTagsConstraint');
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ class StyleSensibleElementConstraintValidator extends ConstraintValidator implem
|
|||
* @throws \Symfony\Component\Validator\Exception\UnexpectedTypeException
|
||||
* Thrown when the given constraint is not supported by this validator.
|
||||
*/
|
||||
public function validate($element, Constraint $constraint) {
|
||||
public function validate($element, Constraint $constraint): void {
|
||||
if (!$constraint instanceof StyleSensibleElementConstraint) {
|
||||
throw new UnexpectedTypeException($constraint, StyleSensibleElementConstraint::class);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class ToolbarItemConditionsMetConstraintValidator extends ConstraintValidator im
|
|||
* @throws \Symfony\Component\Validator\Exception\UnexpectedTypeException
|
||||
* Thrown when the given constraint is not supported by this validator.
|
||||
*/
|
||||
public function validate($toolbar_item, Constraint $constraint) {
|
||||
public function validate($toolbar_item, Constraint $constraint): void {
|
||||
if (!$constraint instanceof ToolbarItemConditionsMetConstraint) {
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\ToolbarItemConditionsMetConstraint');
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class ToolbarItemConstraintValidator extends ConstraintValidator implements Cont
|
|||
* @throws \Symfony\Component\Validator\Exception\UnexpectedTypeException
|
||||
* Thrown when the given constraint is not supported by this validator.
|
||||
*/
|
||||
public function validate($toolbar_item, Constraint $constraint) {
|
||||
public function validate($toolbar_item, Constraint $constraint): void {
|
||||
if (!$constraint instanceof ToolbarItemConstraint) {
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\ToolbarItem');
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class ToolbarItemDependencyConstraintValidator extends ConstraintValidator imple
|
|||
* @throws \Symfony\Component\Validator\Exception\UnexpectedTypeException
|
||||
* Thrown when the given constraint is not supported by this validator.
|
||||
*/
|
||||
public function validate($toolbar_item, Constraint $constraint) {
|
||||
public function validate($toolbar_item, Constraint $constraint): void {
|
||||
if (!$constraint instanceof ToolbarItemDependencyConstraint) {
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\ToolbarItemDependency');
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class UniqueLabelInListConstraintValidator extends ConstraintValidator {
|
|||
* @throws \Symfony\Component\Validator\Exception\UnexpectedTypeException
|
||||
* Thrown when the given constraint is not supported by this validator.
|
||||
*/
|
||||
public function validate($list, Constraint $constraint) {
|
||||
public function validate($list, Constraint $constraint): void {
|
||||
if (!$constraint instanceof UniqueLabelInListConstraint) {
|
||||
throw new UnexpectedTypeException($constraint, UniqueLabelInListConstraint::class);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class CommentNameConstraintValidator extends ConstraintValidator implements Cont
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($entity, Constraint $constraint) {
|
||||
public function validate($entity, Constraint $constraint): void {
|
||||
$author_name = $entity->name->value;
|
||||
$owner_id = (int) $entity->uid->target_id;
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class ModerationStateConstraintValidator extends ConstraintValidator implements
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
|
||||
$entity = $value->getEntity();
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ class ContentTranslationSynchronizedFieldsConstraintValidator extends Constraint
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
/** @var \Drupal\content_translation\Plugin\Validation\Constraint\ContentTranslationSynchronizedFieldsConstraint $constraint */
|
||||
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
|
||||
$entity = $value;
|
||||
|
|
|
@ -16,7 +16,7 @@ class DateTimeFormatConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($item, Constraint $constraint) {
|
||||
public function validate($item, Constraint $constraint): void {
|
||||
/** @var \Drupal\datetime\Plugin\Field\FieldType\DateTimeItem $item */
|
||||
if (isset($item)) {
|
||||
$value = $item->getValue()['value'];
|
||||
|
|
|
@ -34,7 +34,7 @@ class FileValidationConstraintValidator extends ConstraintValidator implements C
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
// Get the file to execute validators.
|
||||
$target = $value->get('entity')->getTarget();
|
||||
if (!$target) {
|
||||
|
|
|
@ -23,7 +23,7 @@ class UploadedFileConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(mixed $value, Constraint $constraint) {
|
||||
public function validate(mixed $value, Constraint $constraint): void {
|
||||
if (!$constraint instanceof UploadedFileConstraint) {
|
||||
throw new UnexpectedTypeException($constraint, UploadedFileConstraint::class);
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ class ForumLeafConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($items, Constraint $constraint) {
|
||||
public function validate($items, Constraint $constraint): void {
|
||||
$item = $items->first();
|
||||
if (!isset($item)) {
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
// Verify that a term has been selected.
|
||||
|
|
|
@ -14,7 +14,7 @@ class LinkTypeConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
if (isset($value)) {
|
||||
$uri_is_valid = TRUE;
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class OEmbedResourceConstraintValidator extends ConstraintValidator implements C
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
/** @var \Drupal\media\MediaInterface $media */
|
||||
$media = $value->getEntity();
|
||||
/** @var \Drupal\media\Plugin\media\Source\OEmbedInterface $source */
|
||||
|
|
|
@ -15,7 +15,7 @@ class MediaTestConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
if ($value instanceof EntityInterface) {
|
||||
$string_to_test = $value->label();
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class MenuTreeHierarchyConstraintValidator extends ConstraintValidator implement
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($entity, Constraint $constraint) {
|
||||
public function validate($entity, Constraint $constraint): void {
|
||||
if ($entity && !$entity->isNew() && !$entity->isDefaultRevision()) {
|
||||
$original = $this->entityTypeManager->getStorage($entity->getEntityTypeId())->loadUnchanged($entity->id());
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ class MenuSettingsConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($entity, Constraint $constraint) {
|
||||
public function validate($entity, Constraint $constraint): void {
|
||||
if (isset($entity) && !$entity->isNew() && !$entity->isDefaultRevision()) {
|
||||
$defaults = menu_ui_get_menu_link_defaults($entity);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class PathAliasConstraintValidator extends ConstraintValidator implements Contai
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
$entity = !empty($value->getParent()) ? $value->getEntity() : NULL;
|
||||
|
||||
if ($entity && !$entity->isNew() && !$entity->isDefaultRevision()) {
|
||||
|
|
|
@ -14,7 +14,7 @@ class RestTestConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
if ($value instanceof FieldItemListInterface) {
|
||||
$value = $value->getValue();
|
||||
if (!empty($value[0]['value']) && $value[0]['value'] === 'ALWAYS_FAIL') {
|
||||
|
|
|
@ -13,7 +13,7 @@ class EntityTestCompositeConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($entity, Constraint $constraint) {
|
||||
public function validate($entity, Constraint $constraint): void {
|
||||
|
||||
if ($entity->name->value === 'test' && $entity->type->value === 'test2') {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
|
|
|
@ -13,7 +13,7 @@ class EntityTestEntityLevelValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
if ($value->name->value === 'entity-level-violation') {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->addViolation();
|
||||
|
|
|
@ -13,7 +13,7 @@ class FieldWidgetConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($field_item, Constraint $constraint) {
|
||||
public function validate($field_item, Constraint $constraint): void {
|
||||
$this->context->addViolation($constraint->message);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ class TestValidatedReferenceConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($items, Constraint $constraint) {
|
||||
public function validate($items, Constraint $constraint): void {
|
||||
if (!isset($items)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class TaxonomyTermHierarchyConstraintValidator extends ConstraintValidator imple
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($entity, Constraint $constraint) {
|
||||
public function validate($entity, Constraint $constraint): void {
|
||||
$term_storage = $this->entityTypeManager->getStorage($entity->getEntityTypeId());
|
||||
assert($term_storage instanceof TermStorageInterface);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class UserNameConstraintValidator extends ConstraintValidator {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($items, Constraint $constraint) {
|
||||
public function validate($items, Constraint $constraint): void {
|
||||
if (!isset($items) || !$items->value) {
|
||||
$this->context->addViolation($constraint->emptyMessage);
|
||||
return;
|
||||
|
|
|
@ -42,7 +42,7 @@ class DeletedWorkspaceConstraintValidator extends ConstraintValidator implements
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
/** @var \Drupal\Core\Field\FieldItemListInterface $value */
|
||||
// This constraint applies only to newly created workspace entities.
|
||||
if (!isset($value) || !$value->getEntity()->isNew()) {
|
||||
|
|
|
@ -59,7 +59,7 @@ class EntityReferenceSupportedNewEntitiesConstraintValidator extends ConstraintV
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($value, Constraint $constraint) {
|
||||
public function validate($value, Constraint $constraint): void {
|
||||
// The validator should run only if we are in a active workspace context.
|
||||
if (!$this->workspaceManager->hasActiveWorkspace()) {
|
||||
return;
|
||||
|
|
|
@ -40,7 +40,7 @@ class EntityWorkspaceConflictConstraintValidator extends ConstraintValidator imp
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate($entity, Constraint $constraint) {
|
||||
public function validate($entity, Constraint $constraint): void {
|
||||
/** @var \Drupal\Core\Entity\EntityInterface $entity */
|
||||
if (isset($entity) && !$entity->isNew()) {
|
||||
$active_workspace = $this->workspaceManager->getActiveWorkspace();
|
||||
|
|
Loading…
Reference in New Issue