function BaseFileConstraintValidator::assertValueIsFile
Same name in other branches
- 11.x 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.
6 calls to BaseFileConstraintValidator::assertValueIsFile()
- 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 - FileNameLengthConstraintValidator::validate in core/
modules/ file/ src/ Plugin/ Validation/ Constraint/ FileNameLengthConstraintValidator.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.