function BaseFileConstraintValidator::assertValueIsFile
Same name in other branches
- 10 core/modules/file/src/Plugin/Validation/Constraint/BaseFileConstraintValidator.php \Drupal\file\Plugin\Validation\Constraint\BaseFileConstraintValidator::assertValueIsFile()
Checks the value is of type FileInterface.
@throw Symfony\Component\Validator\Exception\UnexpectedTypeException Thrown if the value is not a FileInterface.
Parameters
mixed $value: The value to check.
Return value
\Drupal\file\FileInterface The file.
7 calls to BaseFileConstraintValidator::assertValueIsFile()
- FileEncodingConstraintValidator::validate in core/
modules/ file/ src/ Plugin/ Validation/ Constraint/ FileEncodingConstraintValidator.php - FileExtensionConstraintValidator::validate in core/
modules/ file/ src/ Plugin/ Validation/ Constraint/ FileExtensionConstraintValidator.php - FileExtensionSecureConstraintValidator::validate in core/
modules/ file/ src/ Plugin/ Validation/ Constraint/ FileExtensionSecureConstraintValidator.php - FileImageDimensionsConstraintValidator::validate in core/
modules/ file/ src/ Plugin/ Validation/ Constraint/ FileImageDimensionsConstraintValidator.php - FileIsImageConstraintValidator::validate in core/
modules/ file/ src/ Plugin/ Validation/ Constraint/ FileIsImageConstraintValidator.php
File
-
core/
modules/ file/ src/ Plugin/ Validation/ Constraint/ BaseFileConstraintValidator.php, line 28
Class
- BaseFileConstraintValidator
- Provides a base class for file constraint validators.
Namespace
Drupal\file\Plugin\Validation\ConstraintCode
protected function assertValueIsFile(mixed $value) : FileInterface {
if (!$value instanceof FileInterface) {
throw new UnexpectedTypeException($value, FileInterface::class);
}
return $value;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.