PHP Класс Assert\Assertion

Автор: Benjamin Eberlei ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$exceptionClass string Exception to throw when an assertion failed.

Открытые методы

Метод Описание
__callStatic ( string $method, array $args ) : boolean | mixed static call handler to implement: - "null or assertion" delegation - "all" delegation
alnum ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is alphanumeric.
between ( mixed $value, mixed $lowerLimit, mixed $upperLimit, string $message = null, string $propertyPath = null ) : boolean Assert that a value is greater or equal than a lower limit, and less than or equal to an upper limit.
betweenExclusive ( mixed $value, mixed $lowerLimit, mixed $upperLimit, string $message = null, string $propertyPath = null ) : boolean Assert that a value is greater than a lower limit, and less than an upper limit.
betweenLength ( mixed $value, integer $minLength, integer $maxLength, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean Assert that string length is between min,max lengths.
boolean ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is php boolean
choice ( mixed $value, array $choices, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is in array of choices.
choicesNotEmpty ( array $values, array $choices, null $message = null, null $propertyPath = null ) : boolean Determines if the values array has every choice as key and that this choice has content.
classExists ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that the class exists.
contains ( mixed $string, string $needle, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean Assert that string contains a sequence of chars.
count ( array | Countable $countable, integer $count, string $message = null, string $propertyPath = null ) : boolean Assert that the count of countable is equal to count.
date ( string $value, string $format, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that date is valid and corresponds to the given format.
digit ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Validates if an integer or integerish is a digit.
directory ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that a directory exists
e164 ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that the given string is a valid E164 Phone Number
email ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is an email adress (using input_filter/FILTER_VALIDATE_EMAIL).
endsWith ( mixed $string, string $needle, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean Assert that string ends with a sequence of chars.
eq ( mixed $value, mixed $value2, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that two values are equal (using == ).
false ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that the value is boolean False.
file ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that a file exists
float ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is a php float.
greaterOrEqualThan ( mixed $value, mixed $limit, null $message = null, null $propertyPath = null ) : boolean Determines if the value is greater or equal than given limit.
greaterThan ( mixed $value, mixed $limit, null $message = null, null $propertyPath = null ) : boolean Determines if the value is greater than given limit.
implementsInterface ( mixed $class, string $interfaceName, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that the class implements the interface
inArray ( mixed $value, array $choices, string | null $message = null, string | null $propertyPath = null ) : boolean Alias of {@see choice()}
integer ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is a php integer.
integerish ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is a php integer'ish.
interfaceExists ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that the interface exists.
ip ( string $value, null | integer $flag = null, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is an IPv4 or IPv6 address (using input_filter/FILTER_VALIDATE_IP).
ipv4 ( string $value, null | integer $flag = null, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is an IPv4 address (using input_filter/FILTER_VALIDATE_IP).
ipv6 ( string $value, null | integer $flag = null, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is an IPv6 address (using input_filter/FILTER_VALIDATE_IP).
isArray ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is an array.
isArrayAccessible ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is an array or an array-accessible object.
isCallable ( mixed $value, null $message = null, null $propertyPath = null ) : boolean Determines that the provided value is callable.
isInstanceOf ( mixed $value, string $className, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is instance of given class-name.
isJsonString ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that the given string is a valid json string.
isObject ( mixed $value, null $message = null, null $propertyPath = null ) : boolean Determines that the provided value is an object.
isTraversable ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is an array or a traversable object.
keyExists ( mixed $value, string | integer $key, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that key exists in an array
keyIsset ( mixed $value, string | integer $key, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that key exists in an array/array-accessible object using isset()
keyNotExists ( mixed $value, string | integer $key, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that key does not exist in an array
length ( mixed $value, integer $length, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean Assert that string has a given length.
lessOrEqualThan ( mixed $value, mixed $limit, null $message = null, null $propertyPath = null ) : boolean Determines if the value is less or than given limit.
lessThan ( mixed $value, mixed $limit, null $message = null, null $propertyPath = null ) : boolean Determines if the value is less than given limit.
max ( mixed $value, mixed $maxValue, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that a number is smaller as a given limit
maxLength ( mixed $value, integer $maxLength, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean Assert that string value is not longer than $maxLength chars.
methodExists ( string $value, mixed $object, null $message = null, null $propertyPath = null ) : boolean Determines that the named method is defined in the provided object.
min ( mixed $value, mixed $minValue, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that a value is at least as big as a given limit
minLength ( mixed $value, integer $minLength, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean Assert that a string is at least $minLength chars long.
noContent ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is empty
notBlank ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is not blank
notEmpty ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is not empty
notEmptyKey ( mixed $value, string | integer $key, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that key exists in an array/array-accessible object and it's value is not empty.
notEq ( mixed $value1, mixed $value2, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that two values are not equal (using == ).
notInArray ( mixed $value, array $choices, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is not in array of choices.
notIsInstanceOf ( mixed $value, string $className, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is not instance of given class-name.
notNull ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is not null
notSame ( mixed $value1, mixed $value2, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that two values are not the same (using === ).
null ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is null
numeric ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is numeric.
range ( mixed $value, integer $minValue, integer $maxValue, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is in range of numbers.
readable ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that the value is something readable
regex ( mixed $value, string $pattern, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value matches a regex
same ( mixed $value, mixed $value2, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that two values are the same (using ===).
satisfy ( mixed $value, callable $callback, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that the provided value is valid according to a callback.
scalar ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is a PHP scalar
startsWith ( mixed $string, string $needle, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean Assert that string starts with a sequence of chars.
string ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is a string
subclassOf ( mixed $value, string $className, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is subclass of given class-name.
true ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that the value is boolean True.
url ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that value is an URL.
uuid ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that the given string is a valid UUID
writeable ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean Assert that the value is something writeable

Защищенные методы

Метод Описание
createException ( mixed $value, string $message, integer $code, string | null $propertyPath, array $constraints = [] ) : mixed Helper method that handles building the assertion failure exceptions.
stringify ( mixed $value ) : string Make a string version of a value.

Описание методов

__callStatic() публичный статический метод

static call handler to implement: - "null or assertion" delegation - "all" delegation
public static __callStatic ( string $method, array $args ) : boolean | mixed
$method string
$args array
Результат boolean | mixed

alnum() публичный статический метод

Assert that value is alphanumeric.
public static alnum ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

between() публичный статический метод

Assert that a value is greater or equal than a lower limit, and less than or equal to an upper limit.
public static between ( mixed $value, mixed $lowerLimit, mixed $upperLimit, string $message = null, string $propertyPath = null ) : boolean
$value mixed
$lowerLimit mixed
$upperLimit mixed
$message string
$propertyPath string
Результат boolean

betweenExclusive() публичный статический метод

Assert that a value is greater than a lower limit, and less than an upper limit.
public static betweenExclusive ( mixed $value, mixed $lowerLimit, mixed $upperLimit, string $message = null, string $propertyPath = null ) : boolean
$value mixed
$lowerLimit mixed
$upperLimit mixed
$message string
$propertyPath string
Результат boolean

betweenLength() публичный статический метод

Assert that string length is between min,max lengths.
public static betweenLength ( mixed $value, integer $minLength, integer $maxLength, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean
$value mixed
$minLength integer
$maxLength integer
$message string | null
$propertyPath string | null
$encoding string
Результат boolean

boolean() публичный статический метод

Assert that value is php boolean
public static boolean ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

choice() публичный статический метод

Assert that value is in array of choices.
public static choice ( mixed $value, array $choices, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$choices array
$message string | null
$propertyPath string | null
Результат boolean

choicesNotEmpty() публичный статический метод

Determines if the values array has every choice as key and that this choice has content.
public static choicesNotEmpty ( array $values, array $choices, null $message = null, null $propertyPath = null ) : boolean
$values array
$choices array
$message null
$propertyPath null
Результат boolean

classExists() публичный статический метод

Assert that the class exists.
public static classExists ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

contains() публичный статический метод

Assert that string contains a sequence of chars.
public static contains ( mixed $string, string $needle, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean
$string mixed
$needle string
$message string | null
$propertyPath string | null
$encoding string
Результат boolean

count() публичный статический метод

Assert that the count of countable is equal to count.
public static count ( array | Countable $countable, integer $count, string $message = null, string $propertyPath = null ) : boolean
$countable array | Countable
$count integer
$message string
$propertyPath string
Результат boolean

createException() защищенный статический метод

They are returned from this method so that the stack trace still shows the assertions method.
protected static createException ( mixed $value, string $message, integer $code, string | null $propertyPath, array $constraints = [] ) : mixed
$value mixed
$message string
$code integer
$propertyPath string | null
$constraints array
Результат mixed

date() публичный статический метод

Assert that date is valid and corresponds to the given format.
public static date ( string $value, string $format, string | null $message = null, string | null $propertyPath = null ) : boolean
$value string
$format string supports all of the options date(), except for the following: N, w, W, t, L, o, B, a, A, g, h, I, O, P, Z, c, r.
$message string | null
$propertyPath string | null
Результат boolean

digit() публичный статический метод

Validates if an integer or integerish is a digit.
public static digit ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

directory() публичный статический метод

Assert that a directory exists
public static directory ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value string
$message string | null
$propertyPath string | null
Результат boolean

e164() публичный статический метод

Assert that the given string is a valid E164 Phone Number
public static e164 ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value string
$message string | null
$propertyPath string | null
Результат boolean

email() публичный статический метод

Assert that value is an email adress (using input_filter/FILTER_VALIDATE_EMAIL).
public static email ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

endsWith() публичный статический метод

Assert that string ends with a sequence of chars.
public static endsWith ( mixed $string, string $needle, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean
$string mixed
$needle string
$message string | null
$propertyPath string | null
$encoding string
Результат boolean

eq() публичный статический метод

Assert that two values are equal (using == ).
public static eq ( mixed $value, mixed $value2, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$value2 mixed
$message string | null
$propertyPath string | null
Результат boolean

false() публичный статический метод

Assert that the value is boolean False.
public static false ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

file() публичный статический метод

Assert that a file exists
public static file ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value string
$message string | null
$propertyPath string | null
Результат boolean

float() публичный статический метод

Assert that value is a php float.
public static float ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

greaterOrEqualThan() публичный статический метод

Determines if the value is greater or equal than given limit.
public static greaterOrEqualThan ( mixed $value, mixed $limit, null $message = null, null $propertyPath = null ) : boolean
$value mixed
$limit mixed
$message null
$propertyPath null
Результат boolean

greaterThan() публичный статический метод

Determines if the value is greater than given limit.
public static greaterThan ( mixed $value, mixed $limit, null $message = null, null $propertyPath = null ) : boolean
$value mixed
$limit mixed
$message null
$propertyPath null
Результат boolean

implementsInterface() публичный статический метод

Assert that the class implements the interface
public static implementsInterface ( mixed $class, string $interfaceName, string | null $message = null, string | null $propertyPath = null ) : boolean
$class mixed
$interfaceName string
$message string | null
$propertyPath string | null
Результат boolean

inArray() публичный статический метод

Alias of {@see choice()}
public static inArray ( mixed $value, array $choices, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$choices array
$message string | null
$propertyPath string | null
Результат boolean

integer() публичный статический метод

Assert that value is a php integer.
public static integer ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

integerish() публичный статический метод

Assert that value is a php integer'ish.
public static integerish ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

interfaceExists() публичный статический метод

Assert that the interface exists.
public static interfaceExists ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

ip() публичный статический метод

Assert that value is an IPv4 or IPv6 address (using input_filter/FILTER_VALIDATE_IP).
public static ip ( string $value, null | integer $flag = null, string | null $message = null, string | null $propertyPath = null ) : boolean
$value string
$flag null | integer
$message string | null
$propertyPath string | null
Результат boolean

ipv4() публичный статический метод

Assert that value is an IPv4 address (using input_filter/FILTER_VALIDATE_IP).
public static ipv4 ( string $value, null | integer $flag = null, string | null $message = null, string | null $propertyPath = null ) : boolean
$value string
$flag null | integer
$message string | null
$propertyPath string | null
Результат boolean

ipv6() публичный статический метод

Assert that value is an IPv6 address (using input_filter/FILTER_VALIDATE_IP).
public static ipv6 ( string $value, null | integer $flag = null, string | null $message = null, string | null $propertyPath = null ) : boolean
$value string
$flag null | integer
$message string | null
$propertyPath string | null
Результат boolean

isArray() публичный статический метод

Assert that value is an array.
public static isArray ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

isArrayAccessible() публичный статический метод

Assert that value is an array or an array-accessible object.
public static isArrayAccessible ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

isCallable() публичный статический метод

Determines that the provided value is callable.
public static isCallable ( mixed $value, null $message = null, null $propertyPath = null ) : boolean
$value mixed
$message null
$propertyPath null
Результат boolean

isInstanceOf() публичный статический метод

Assert that value is instance of given class-name.
public static isInstanceOf ( mixed $value, string $className, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$className string
$message string | null
$propertyPath string | null
Результат boolean

isJsonString() публичный статический метод

NOTICE: Since this does a json_decode to determine its validity you probably should consider, when using the variable content afterwards, just to decode and check for yourself instead of using this assertion.
public static isJsonString ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

isObject() публичный статический метод

Determines that the provided value is an object.
public static isObject ( mixed $value, null $message = null, null $propertyPath = null ) : boolean
$value mixed
$message null
$propertyPath null
Результат boolean

isTraversable() публичный статический метод

Assert that value is an array or a traversable object.
public static isTraversable ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

keyExists() публичный статический метод

Assert that key exists in an array
public static keyExists ( mixed $value, string | integer $key, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$key string | integer
$message string | null
$propertyPath string | null
Результат boolean

keyIsset() публичный статический метод

Assert that key exists in an array/array-accessible object using isset()
public static keyIsset ( mixed $value, string | integer $key, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$key string | integer
$message string | null
$propertyPath string | null
Результат boolean

keyNotExists() публичный статический метод

Assert that key does not exist in an array
public static keyNotExists ( mixed $value, string | integer $key, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$key string | integer
$message string | null
$propertyPath string | null
Результат boolean

length() публичный статический метод

Assert that string has a given length.
public static length ( mixed $value, integer $length, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean
$value mixed
$length integer
$message string | null
$propertyPath string | null
$encoding string
Результат boolean

lessOrEqualThan() публичный статический метод

Determines if the value is less or than given limit.
public static lessOrEqualThan ( mixed $value, mixed $limit, null $message = null, null $propertyPath = null ) : boolean
$value mixed
$limit mixed
$message null
$propertyPath null
Результат boolean

lessThan() публичный статический метод

Determines if the value is less than given limit.
public static lessThan ( mixed $value, mixed $limit, null $message = null, null $propertyPath = null ) : boolean
$value mixed
$limit mixed
$message null
$propertyPath null
Результат boolean

max() публичный статический метод

Assert that a number is smaller as a given limit
public static max ( mixed $value, mixed $maxValue, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$maxValue mixed
$message string | null
$propertyPath string | null
Результат boolean

maxLength() публичный статический метод

Assert that string value is not longer than $maxLength chars.
public static maxLength ( mixed $value, integer $maxLength, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean
$value mixed
$maxLength integer
$message string | null
$propertyPath string | null
$encoding string
Результат boolean

methodExists() публичный статический метод

Determines that the named method is defined in the provided object.
public static methodExists ( string $value, mixed $object, null $message = null, null $propertyPath = null ) : boolean
$value string
$object mixed
$message null
$propertyPath null
Результат boolean

min() публичный статический метод

Assert that a value is at least as big as a given limit
public static min ( mixed $value, mixed $minValue, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$minValue mixed
$message string | null
$propertyPath string | null
Результат boolean

minLength() публичный статический метод

Assert that a string is at least $minLength chars long.
public static minLength ( mixed $value, integer $minLength, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean
$value mixed
$minLength integer
$message string | null
$propertyPath string | null
$encoding string
Результат boolean

noContent() публичный статический метод

Assert that value is empty
public static noContent ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

notBlank() публичный статический метод

Assert that value is not blank
public static notBlank ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

notEmpty() публичный статический метод

Assert that value is not empty
public static notEmpty ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

notEmptyKey() публичный статический метод

Assert that key exists in an array/array-accessible object and it's value is not empty.
public static notEmptyKey ( mixed $value, string | integer $key, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$key string | integer
$message string | null
$propertyPath string | null
Результат boolean

notEq() публичный статический метод

Assert that two values are not equal (using == ).
public static notEq ( mixed $value1, mixed $value2, string | null $message = null, string | null $propertyPath = null ) : boolean
$value1 mixed
$value2 mixed
$message string | null
$propertyPath string | null
Результат boolean

notInArray() публичный статический метод

Assert that value is not in array of choices.
public static notInArray ( mixed $value, array $choices, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$choices array
$message string | null
$propertyPath string | null
Результат boolean

notIsInstanceOf() публичный статический метод

Assert that value is not instance of given class-name.
public static notIsInstanceOf ( mixed $value, string $className, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$className string
$message string | null
$propertyPath string | null
Результат boolean

notNull() публичный статический метод

Assert that value is not null
public static notNull ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

notSame() публичный статический метод

Assert that two values are not the same (using === ).
public static notSame ( mixed $value1, mixed $value2, string | null $message = null, string | null $propertyPath = null ) : boolean
$value1 mixed
$value2 mixed
$message string | null
$propertyPath string | null
Результат boolean

null() публичный статический метод

Assert that value is null
public static null ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

numeric() публичный статический метод

Assert that value is numeric.
public static numeric ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

range() публичный статический метод

Assert that value is in range of numbers.
public static range ( mixed $value, integer $minValue, integer $maxValue, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$minValue integer
$maxValue integer
$message string | null
$propertyPath string | null
Результат boolean

readable() публичный статический метод

Assert that the value is something readable
public static readable ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value string
$message string | null
$propertyPath string | null
Результат boolean

regex() публичный статический метод

Assert that value matches a regex
public static regex ( mixed $value, string $pattern, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$pattern string
$message string | null
$propertyPath string | null
Результат boolean

same() публичный статический метод

Assert that two values are the same (using ===).
public static same ( mixed $value, mixed $value2, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$value2 mixed
$message string | null
$propertyPath string | null
Результат boolean

satisfy() публичный статический метод

If the callback returns false the assertion will fail.
public static satisfy ( mixed $value, callable $callback, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$callback callable
$message string | null
$propertyPath string | null
Результат boolean

scalar() публичный статический метод

Assert that value is a PHP scalar
public static scalar ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

startsWith() публичный статический метод

Assert that string starts with a sequence of chars.
public static startsWith ( mixed $string, string $needle, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean
$string mixed
$needle string
$message string | null
$propertyPath string | null
$encoding string
Результат boolean

string() публичный статический метод

Assert that value is a string
public static string ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

stringify() защищенный статический метод

Make a string version of a value.
protected static stringify ( mixed $value ) : string
$value mixed
Результат string

subclassOf() публичный статический метод

Assert that value is subclass of given class-name.
public static subclassOf ( mixed $value, string $className, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$className string
$message string | null
$propertyPath string | null
Результат boolean

true() публичный статический метод

Assert that the value is boolean True.
public static true ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

url() публичный статический метод

This code snipped was taken from the Symfony project and modified to the special demands of this method.
public static url ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean

uuid() публичный статический метод

Uses code from {@link https://github.com/ramsey/uuid} that is MIT licensed.
public static uuid ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value string
$message string | null
$propertyPath string | null
Результат boolean

writeable() публичный статический метод

Assert that the value is something writeable
public static writeable ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value string
$message string | null
$propertyPath string | null
Результат boolean

Описание свойств

$exceptionClass защищенное статическое свойство

Exception to throw when an assertion failed.
protected static string $exceptionClass
Результат string