Namespace
Drupal\file\Plugin\Validation\Constraint
File
core/modules/file/src/Plugin/Validation/Constraint/BaseFileConstraintValidator.php
View source
<?php
declare (strict_types=1);
namespace Drupal\file\Plugin\Validation\Constraint;
use Drupal\file\FileInterface;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
abstract class BaseFileConstraintValidator extends ConstraintValidator {
protected function assertValueIsFile(mixed $value) : FileInterface {
if (!$value instanceof FileInterface) {
throw new UnexpectedTypeException($value, FileInterface::class);
}
return $value;
}
}
Classes