GSB_AppliMVC

Assert
in package

Efficient assertions to validate the input/output of your methods.

Tags
mixin

Mixin

since
1.0
author

Bernhard Schussek bschussek@gmail.com

Table of Contents

__callStatic()  : mixed
alnum()  : mixed
alpha()  : mixed
boolean()  : mixed
classExists()  : mixed
contains()  : mixed
count()  : mixed
Does not check if $array is countable, this can generate a warning on php versions after 7.2.
countBetween()  : mixed
Does not check if $array is countable, this can generate a warning on php versions after 7.2.
digits()  : mixed
directory()  : mixed
email()  : mixed
endsWith()  : mixed
eq()  : mixed
false()  : mixed
file()  : mixed
fileExists()  : mixed
Will also pass if $value is a directory, use Assert::file() instead if you need to be sure it is a file.
float()  : mixed
greaterThan()  : mixed
greaterThanEq()  : mixed
implementsInterface()  : mixed
inArray()  : mixed
Does strict comparison, so Assert::inArray(3, ['3']) does not pass the assertion.
integer()  : mixed
integerish()  : mixed
interfaceExists()  : mixed
ip()  : mixed
ipv4()  : mixed
ipv6()  : mixed
isAnyOf()  : mixed
isAOf()  : mixed
isArray()  : mixed
isArrayAccessible()  : mixed
isCallable()  : mixed
isCountable()  : mixed
isEmpty()  : mixed
isInstanceOf()  : mixed
isInstanceOfAny()  : mixed
isIterable()  : mixed
isList()  : mixed
isMap()  : mixed
isNonEmptyList()  : mixed
isNonEmptyMap()  : mixed
isNotA()  : mixed
isTraversable()  : mixed
keyExists()  : mixed
keyNotExists()  : mixed
length()  : mixed
lengthBetween()  : mixed
Inclusive , so Assert::lengthBetween('asd', 3, 5); passes the assertion.
lessThan()  : mixed
lessThanEq()  : mixed
lower()  : mixed
maxCount()  : mixed
Does not check if $array is countable, this can generate a warning on php versions after 7.2.
maxLength()  : mixed
Inclusive max.
methodExists()  : mixed
methodNotExists()  : mixed
minCount()  : mixed
Does not check if $array is countable, this can generate a warning on php versions after 7.2.
minLength()  : mixed
Inclusive min.
natural()  : mixed
notContains()  : mixed
notEmpty()  : mixed
notEndsWith()  : mixed
notEq()  : mixed
notFalse()  : mixed
notInstanceOf()  : mixed
notNull()  : mixed
notRegex()  : mixed
notSame()  : mixed
notStartsWith()  : mixed
notWhitespaceOnly()  : mixed
null()  : mixed
numeric()  : mixed
object()  : mixed
oneOf()  : mixed
A more human-readable alias of Assert::inArray().
propertyExists()  : mixed
propertyNotExists()  : mixed
range()  : mixed
Inclusive range, so Assert::(3, 3, 5) passes.
readable()  : mixed
regex()  : mixed
resource()  : mixed
same()  : mixed
scalar()  : mixed
startsWith()  : mixed
startsWithLetter()  : mixed
string()  : mixed
stringNotEmpty()  : mixed
subclassOf()  : mixed
throws()  : mixed
true()  : mixed
unicodeLetters()  : mixed
uniqueValues()  : mixed
Does non strict comparisons on the items, so ['3', 3] will not pass the assertion.
upper()  : mixed
uuid()  : mixed
validArrayKey()  : mixed
Checks if a value is a valid array key (int or string).
writable()  : mixed
reportInvalidArgument()  : mixed
strlen()  : mixed
typeToString()  : string
valueToString()  : string
__construct()  : mixed

Methods

__callStatic()

public static __callStatic(mixed $name, mixed $arguments) : mixed
Parameters
$name : mixed
$arguments : mixed
Tags
throws
BadMethodCallException
Return values
mixed

alnum()

public static alnum(string $value[, string $message = '' ]) : mixed
Parameters
$value : string
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

alpha()

public static alpha(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

boolean()

public static boolean(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

bool $value

throws
InvalidArgumentException
Return values
mixed

classExists()

public static classExists(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-assert

class-string $value

throws
InvalidArgumentException
Return values
mixed

contains()

public static contains(string $value, string $subString[, string $message = '' ]) : mixed
Parameters
$value : string
$subString : string
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

count()

Does not check if $array is countable, this can generate a warning on php versions after 7.2.

public static count(Countable|array<string|int, mixed> $array, int $number[, string $message = '' ]) : mixed
Parameters
$array : Countable|array<string|int, mixed>
$number : int
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

countBetween()

Does not check if $array is countable, this can generate a warning on php versions after 7.2.

public static countBetween(Countable|array<string|int, mixed> $array, int|float $min, int|float $max[, string $message = '' ]) : mixed
Parameters
$array : Countable|array<string|int, mixed>
$min : int|float
$max : int|float
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

digits()

public static digits(string $value[, string $message = '' ]) : mixed
Parameters
$value : string
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

directory()

public static directory(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

email()

public static email(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

endsWith()

public static endsWith(string $value, string $suffix[, string $message = '' ]) : mixed
Parameters
$value : string
$suffix : string
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

eq()

public static eq(mixed $value, mixed $expect[, string $message = '' ]) : mixed
Parameters
$value : mixed
$expect : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

false()

public static false(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

false $value

throws
InvalidArgumentException
Return values
mixed

file()

public static file(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

fileExists()

Will also pass if $value is a directory, use Assert::file() instead if you need to be sure it is a file.

public static fileExists(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

float()

public static float(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

float $value

throws
InvalidArgumentException
Return values
mixed

greaterThan()

public static greaterThan(mixed $value, mixed $limit[, string $message = '' ]) : mixed
Parameters
$value : mixed
$limit : mixed
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

greaterThanEq()

public static greaterThanEq(mixed $value, mixed $limit[, string $message = '' ]) : mixed
Parameters
$value : mixed
$limit : mixed
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

implementsInterface()

public static implementsInterface(mixed $value, mixed $interface[, string $message = '' ]) : mixed
Parameters
$value : mixed
$interface : mixed
$message : string = ''
Tags
psalm-pure
psalm-template

ExpectedType of object

psalm-param

class-string $interface

psalm-assert

class-string $value

throws
InvalidArgumentException
Return values
mixed

inArray()

Does strict comparison, so Assert::inArray(3, ['3']) does not pass the assertion.

public static inArray(mixed $value, array<string|int, mixed> $values[, string $message = '' ]) : mixed
Parameters
$value : mixed
$values : array<string|int, mixed>
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

integer()

public static integer(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

int $value

throws
InvalidArgumentException
Return values
mixed

integerish()

public static integerish(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

numeric $value

throws
InvalidArgumentException
Return values
mixed

interfaceExists()

public static interfaceExists(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-assert

class-string $value

throws
InvalidArgumentException
Return values
mixed

ip()

public static ip(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

ipv4()

public static ipv4(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

ipv6()

public static ipv6(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

isAnyOf()

public static isAnyOf(object|string $value, array<string|int, string> $classes[, string $message = '' ]) : mixed
Parameters
$value : object|string
$classes : array<string|int, string>
$message : string = ''
Tags
psalm-pure
psalm-param

array $classes

throws
InvalidArgumentException
Return values
mixed

isAOf()

public static isAOf(object|string $value, string $class[, string $message = '' ]) : mixed
Parameters
$value : object|string
$class : string
$message : string = ''
Tags
psalm-pure
psalm-template

ExpectedType of object

psalm-param

class-string $class

psalm-assert

ExpectedType|class-string $value

throws
InvalidArgumentException
Return values
mixed

isArray()

public static isArray(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

array $value

throws
InvalidArgumentException
Return values
mixed

isArrayAccessible()

public static isArrayAccessible(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

array|ArrayAccess $value

throws
InvalidArgumentException
Return values
mixed

isCallable()

public static isCallable(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

callable $value

throws
InvalidArgumentException
Return values
mixed

isCountable()

public static isCountable(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

countable $value

throws
InvalidArgumentException
Return values
mixed

isEmpty()

public static isEmpty(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

empty $value

throws
InvalidArgumentException
Return values
mixed

isInstanceOf()

public static isInstanceOf(mixed $value, string|object $class[, string $message = '' ]) : mixed
Parameters
$value : mixed
$class : string|object
$message : string = ''
Tags
psalm-pure
psalm-template

ExpectedType of object

psalm-param

class-string $class

psalm-assert

ExpectedType $value

throws
InvalidArgumentException
Return values
mixed

isInstanceOfAny()

public static isInstanceOfAny(mixed $value, array<string|int, object|string> $classes[, string $message = '' ]) : mixed
Parameters
$value : mixed
$classes : array<string|int, object|string>
$message : string = ''
Tags
psalm-pure
psalm-param

array $classes

throws
InvalidArgumentException
Return values
mixed

isIterable()

public static isIterable(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

iterable $value

throws
InvalidArgumentException
Return values
mixed

isList()

public static isList(mixed $array[, string $message = '' ]) : mixed
Parameters
$array : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

list $array

throws
InvalidArgumentException
Return values
mixed

isMap()

public static isMap(mixed $array[, string $message = '' ]) : mixed
Parameters
$array : mixed
$message : string = ''
Tags
psalm-pure
psalm-template

T

psalm-param

mixed|array $array

psalm-assert

array<string, T> $array

throws
InvalidArgumentException
Return values
mixed

isNonEmptyList()

public static isNonEmptyList(mixed $array[, string $message = '' ]) : mixed
Parameters
$array : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

non-empty-list $array

throws
InvalidArgumentException
Return values
mixed

isNonEmptyMap()

public static isNonEmptyMap(mixed $array[, string $message = '' ]) : mixed
Parameters
$array : mixed
$message : string = ''
Tags
psalm-pure
psalm-template

T

psalm-param

mixed|array $array

psalm-assert

array<string, T> $array

psalm-assert

!empty $array

throws
InvalidArgumentException
Return values
mixed

isNotA()

public static isNotA(object|string $value, string $class[, string $message = '' ]) : mixed
Parameters
$value : object|string
$class : string
$message : string = ''
Tags
psalm-pure
psalm-template

UnexpectedType of object

psalm-param

class-string $class

psalm-assert

!UnexpectedType $value

psalm-assert

!class-string $value

throws
InvalidArgumentException
Return values
mixed

isTraversable()

public static isTraversable(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

iterable $value

deprecated

use "isIterable" or "isInstanceOf" instead

throws
InvalidArgumentException
Return values
mixed

keyExists()

public static keyExists(array<string|int, mixed> $array, string|int $key[, string $message = '' ]) : mixed
Parameters
$array : array<string|int, mixed>
$key : string|int
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

keyNotExists()

public static keyNotExists(array<string|int, mixed> $array, string|int $key[, string $message = '' ]) : mixed
Parameters
$array : array<string|int, mixed>
$key : string|int
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

length()

public static length(string $value, int $length[, string $message = '' ]) : mixed
Parameters
$value : string
$length : int
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

lengthBetween()

Inclusive , so Assert::lengthBetween('asd', 3, 5); passes the assertion.

public static lengthBetween(string $value, int|float $min, int|float $max[, string $message = '' ]) : mixed
Parameters
$value : string
$min : int|float
$max : int|float
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

lessThan()

public static lessThan(mixed $value, mixed $limit[, string $message = '' ]) : mixed
Parameters
$value : mixed
$limit : mixed
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

lessThanEq()

public static lessThanEq(mixed $value, mixed $limit[, string $message = '' ]) : mixed
Parameters
$value : mixed
$limit : mixed
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

lower()

public static lower(string $value[, string $message = '' ]) : mixed
Parameters
$value : string
$message : string = ''
Tags
psalm-pure
psalm-assert

lowercase-string $value

throws
InvalidArgumentException
Return values
mixed

maxCount()

Does not check if $array is countable, this can generate a warning on php versions after 7.2.

public static maxCount(Countable|array<string|int, mixed> $array, int|float $max[, string $message = '' ]) : mixed
Parameters
$array : Countable|array<string|int, mixed>
$max : int|float
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

maxLength()

Inclusive max.

public static maxLength(string $value, int|float $max[, string $message = '' ]) : mixed
Parameters
$value : string
$max : int|float
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

methodExists()

public static methodExists(string|object $classOrObject, mixed $method[, string $message = '' ]) : mixed
Parameters
$classOrObject : string|object
$method : mixed
$message : string = ''
Tags
psalm-pure
psalm-param

class-string|object $classOrObject

throws
InvalidArgumentException
Return values
mixed

methodNotExists()

public static methodNotExists(string|object $classOrObject, mixed $method[, string $message = '' ]) : mixed
Parameters
$classOrObject : string|object
$method : mixed
$message : string = ''
Tags
psalm-pure
psalm-param

class-string|object $classOrObject

throws
InvalidArgumentException
Return values
mixed

minCount()

Does not check if $array is countable, this can generate a warning on php versions after 7.2.

public static minCount(Countable|array<string|int, mixed> $array, int|float $min[, string $message = '' ]) : mixed
Parameters
$array : Countable|array<string|int, mixed>
$min : int|float
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

minLength()

Inclusive min.

public static minLength(string $value, int|float $min[, string $message = '' ]) : mixed
Parameters
$value : string
$min : int|float
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

natural()

public static natural(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

int $value

throws
InvalidArgumentException
Return values
mixed

notContains()

public static notContains(string $value, string $subString[, string $message = '' ]) : mixed
Parameters
$value : string
$subString : string
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

notEmpty()

public static notEmpty(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

!empty $value

throws
InvalidArgumentException
Return values
mixed

notEndsWith()

public static notEndsWith(string $value, string $suffix[, string $message = '' ]) : mixed
Parameters
$value : string
$suffix : string
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

notEq()

public static notEq(mixed $value, mixed $expect[, string $message = '' ]) : mixed
Parameters
$value : mixed
$expect : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

notFalse()

public static notFalse(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

!false $value

throws
InvalidArgumentException
Return values
mixed

notInstanceOf()

public static notInstanceOf(mixed $value, string|object $class[, string $message = '' ]) : mixed
Parameters
$value : mixed
$class : string|object
$message : string = ''
Tags
psalm-pure
psalm-template

ExpectedType of object

psalm-param

class-string $class

psalm-assert

!ExpectedType $value

throws
InvalidArgumentException
Return values
mixed

notNull()

public static notNull(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

!null $value

throws
InvalidArgumentException
Return values
mixed

notRegex()

public static notRegex(string $value, string $pattern[, string $message = '' ]) : mixed
Parameters
$value : string
$pattern : string
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

notSame()

public static notSame(mixed $value, mixed $expect[, string $message = '' ]) : mixed
Parameters
$value : mixed
$expect : mixed
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

notStartsWith()

public static notStartsWith(string $value, string $prefix[, string $message = '' ]) : mixed
Parameters
$value : string
$prefix : string
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

notWhitespaceOnly()

public static notWhitespaceOnly(string $value[, string $message = '' ]) : mixed
Parameters
$value : string
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

null()

public static null(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

null $value

throws
InvalidArgumentException
Return values
mixed

numeric()

public static numeric(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

numeric $value

throws
InvalidArgumentException
Return values
mixed

object()

public static object(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

object $value

throws
InvalidArgumentException
Return values
mixed

oneOf()

A more human-readable alias of Assert::inArray().

public static oneOf(mixed $value, array<string|int, mixed> $values[, string $message = '' ]) : mixed
Parameters
$value : mixed
$values : array<string|int, mixed>
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

propertyExists()

public static propertyExists(string|object $classOrObject, mixed $property[, string $message = '' ]) : mixed
Parameters
$classOrObject : string|object
$property : mixed
$message : string = ''
Tags
psalm-pure
psalm-param

class-string|object $classOrObject

throws
InvalidArgumentException
Return values
mixed

propertyNotExists()

public static propertyNotExists(string|object $classOrObject, mixed $property[, string $message = '' ]) : mixed
Parameters
$classOrObject : string|object
$property : mixed
$message : string = ''
Tags
psalm-pure
psalm-param

class-string|object $classOrObject

throws
InvalidArgumentException
Return values
mixed

range()

Inclusive range, so Assert::(3, 3, 5) passes.

public static range(mixed $value, mixed $min, mixed $max[, string $message = '' ]) : mixed
Parameters
$value : mixed
$min : mixed
$max : mixed
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

readable()

public static readable(string $value[, string $message = '' ]) : mixed
Parameters
$value : string
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

regex()

public static regex(string $value, string $pattern[, string $message = '' ]) : mixed
Parameters
$value : string
$pattern : string
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

resource()

public static resource(mixed $value[, string|null $type = null ][, string $message = '' ]) : mixed
Parameters
$value : mixed
$type : string|null = null

type of resource this should be. @see https://www.php.net/manual/en/function.get-resource-type.php

$message : string = ''
Tags
psalm-pure
psalm-assert

resource $value

throws
InvalidArgumentException
Return values
mixed

same()

public static same(mixed $value, mixed $expect[, string $message = '' ]) : mixed
Parameters
$value : mixed
$expect : mixed
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

scalar()

public static scalar(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

scalar $value

throws
InvalidArgumentException
Return values
mixed

startsWith()

public static startsWith(string $value, string $prefix[, string $message = '' ]) : mixed
Parameters
$value : string
$prefix : string
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

startsWithLetter()

public static startsWithLetter(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

string()

public static string(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

string $value

throws
InvalidArgumentException
Return values
mixed

stringNotEmpty()

public static stringNotEmpty(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

non-empty-string $value

throws
InvalidArgumentException
Return values
mixed

subclassOf()

public static subclassOf(mixed $value, string|object $class[, string $message = '' ]) : mixed
Parameters
$value : mixed
$class : string|object
$message : string = ''
Tags
psalm-pure
psalm-template

ExpectedType of object

psalm-param

class-string $class

psalm-assert

class-string|ExpectedType $value

throws
InvalidArgumentException
Return values
mixed

throws()

public static throws(Closure $expression[, string $class = 'Exception' ][, string $message = '' ]) : mixed
Parameters
$expression : Closure
$class : string = 'Exception'
$message : string = ''
Tags
psalm-param

class-string $class

throws
InvalidArgumentException
Return values
mixed

true()

public static true(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

true $value

throws
InvalidArgumentException
Return values
mixed

unicodeLetters()

public static unicodeLetters(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

uniqueValues()

Does non strict comparisons on the items, so ['3', 3] will not pass the assertion.

public static uniqueValues(array<string|int, mixed> $values[, string $message = '' ]) : mixed
Parameters
$values : array<string|int, mixed>
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

upper()

public static upper(string $value[, string $message = '' ]) : mixed
Parameters
$value : string
$message : string = ''
Tags
psalm-pure
psalm-assert

!lowercase-string $value

throws
InvalidArgumentException
Return values
mixed

uuid()

public static uuid(string $value[, string $message = '' ]) : mixed
Parameters
$value : string
$message : string = ''
Tags
psalm-pure
throws
InvalidArgumentException
Return values
mixed

validArrayKey()

Checks if a value is a valid array key (int or string).

public static validArrayKey(mixed $value[, string $message = '' ]) : mixed
Parameters
$value : mixed
$message : string = ''
Tags
psalm-pure
psalm-assert

array-key $value

throws
InvalidArgumentException
Return values
mixed

writable()

public static writable(string $value[, string $message = '' ]) : mixed
Parameters
$value : string
$message : string = ''
Tags
throws
InvalidArgumentException
Return values
mixed

reportInvalidArgument()

protected static reportInvalidArgument(string $message) : mixed
Parameters
$message : string
Tags
throws
InvalidArgumentException
psalm-pure

this method is not supposed to perform side-effects

Return values
mixed

strlen()

protected static strlen(mixed $value) : mixed
Parameters
$value : mixed
Return values
mixed

typeToString()

protected static typeToString(mixed $value) : string
Parameters
$value : mixed
Return values
string

valueToString()

protected static valueToString(mixed $value) : string
Parameters
$value : mixed
Return values
string

__construct()

private __construct() : mixed
Return values
mixed

Search results