function Assert::validArrayKey
Checks if a value is a valid array key (int or string).
@psalm-pure @psalm-assert array-key $value
Parameters
mixed $value:
string $message:
Throws
File
-
vendor/
webmozart/ assert/ src/ Assert.php, line 1718
Class
- Assert
- Efficient assertions to validate the input/output of your methods.
Namespace
Webmozart\AssertCode
public static function validArrayKey($value, $message = '') {
if (!(\is_int($value) || \is_string($value))) {
static::reportInvalidArgument(\sprintf($message ?: 'Expected string or integer. Got: %s', static::typeToString($value)));
}
}