function Assert::string
@psalm-pure @psalm-assert string $value
Parameters
mixed $value:
string $message:
Throws
16 calls to Assert::string()
- Assert::alpha in vendor/
webmozart/ assert/ src/ Assert.php - @psalm-pure
- Assert::fileExists in vendor/
webmozart/ assert/ src/ Assert.php - Will also pass if $value is a directory, use Assert::file() instead if you need to be sure it is a file.
- Assert::isAnyOf in vendor/
webmozart/ assert/ src/ Assert.php - @psalm-pure @psalm-param array<class-string> $classes
- Assert::isAOf in vendor/
webmozart/ assert/ src/ Assert.php - @psalm-pure @psalm-template ExpectedType of object @psalm-param class-string<ExpectedType> $class @psalm-assert ExpectedType|class-string<ExpectedType> $value
- Assert::isNotA in vendor/
webmozart/ assert/ src/ Assert.php - @psalm-pure @psalm-template UnexpectedType of object @psalm-param class-string<UnexpectedType> $class @psalm-assert !UnexpectedType $value @psalm-assert !class-string<UnexpectedType> $value
File
-
vendor/
webmozart/ assert/ src/ Assert.php, line 46
Class
- Assert
- Efficient assertions to validate the input/output of your methods.
Namespace
Webmozart\AssertCode
public static function string($value, $message = '') {
if (!\is_string($value)) {
static::reportInvalidArgument(\sprintf($message ?: 'Expected a string. Got: %s', static::typeToString($value)));
}
}