PHP Class Assert\Assertion

Author: Benjamin Eberlei ([email protected])
Afficher le fichier Open project: beberlei/assert Class Usage Examples

Protected Properties

Свойство Type Description
$exceptionClass string Exception to throw when an assertion failed.

Méthodes publiques

Méthode Description
__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

Méthodes protégées

Méthode Description
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.

Method Details

__callStatic() public static méthode

static call handler to implement: - "null or assertion" delegation - "all" delegation
public static __callStatic ( string $method, array $args ) : boolean | mixed
$method string
$args array
Résultat boolean | mixed

alnum() public static méthode

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
Résultat boolean

between() public static méthode

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
Résultat boolean

betweenExclusive() public static méthode

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
Résultat boolean

betweenLength() public static méthode

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
Résultat boolean

boolean() public static méthode

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
Résultat boolean

choice() public static méthode

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
Résultat boolean

choicesNotEmpty() public static méthode

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
Résultat boolean

classExists() public static méthode

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
Résultat boolean

contains() public static méthode

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
Résultat boolean

count() public static méthode

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
Résultat boolean

createException() protected static méthode

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
Résultat mixed

date() public static méthode

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
Résultat boolean

digit() public static méthode

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
Résultat boolean

directory() public static méthode

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
Résultat boolean

e164() public static méthode

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
Résultat boolean

email() public static méthode

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
Résultat boolean

endsWith() public static méthode

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
Résultat boolean

eq() public static méthode

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
Résultat boolean

false() public static méthode

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
Résultat boolean

file() public static méthode

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
Résultat boolean

float() public static méthode

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
Résultat boolean

greaterOrEqualThan() public static méthode

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
Résultat boolean

greaterThan() public static méthode

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
Résultat boolean

implementsInterface() public static méthode

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
Résultat boolean

inArray() public static méthode

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
Résultat boolean

integer() public static méthode

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
Résultat boolean

integerish() public static méthode

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
Résultat boolean

interfaceExists() public static méthode

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
Résultat boolean

ip() public static méthode

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
Résultat boolean

ipv4() public static méthode

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
Résultat boolean

ipv6() public static méthode

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
Résultat boolean

isArray() public static méthode

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
Résultat boolean

isArrayAccessible() public static méthode

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
Résultat boolean

isCallable() public static méthode

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
Résultat boolean

isInstanceOf() public static méthode

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
Résultat boolean

isJsonString() public static méthode

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
Résultat boolean

isObject() public static méthode

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
Résultat boolean

isTraversable() public static méthode

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
Résultat boolean

keyExists() public static méthode

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
Résultat boolean

keyIsset() public static méthode

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
Résultat boolean

keyNotExists() public static méthode

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
Résultat boolean

length() public static méthode

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
Résultat boolean

lessOrEqualThan() public static méthode

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
Résultat boolean

lessThan() public static méthode

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
Résultat boolean

max() public static méthode

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
Résultat boolean

maxLength() public static méthode

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
Résultat boolean

methodExists() public static méthode

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
Résultat boolean

min() public static méthode

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
Résultat boolean

minLength() public static méthode

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
Résultat boolean

noContent() public static méthode

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
Résultat boolean

notBlank() public static méthode

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
Résultat boolean

notEmpty() public static méthode

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
Résultat boolean

notEmptyKey() public static méthode

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
Résultat boolean

notEq() public static méthode

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
Résultat boolean

notInArray() public static méthode

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
Résultat boolean

notIsInstanceOf() public static méthode

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
Résultat boolean

notNull() public static méthode

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
Résultat boolean

notSame() public static méthode

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
Résultat boolean

null() public static méthode

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
Résultat boolean

numeric() public static méthode

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
Résultat boolean

range() public static méthode

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
Résultat boolean

readable() public static méthode

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
Résultat boolean

regex() public static méthode

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
Résultat boolean

same() public static méthode

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
Résultat boolean

satisfy() public static méthode

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
Résultat boolean

scalar() public static méthode

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
Résultat boolean

startsWith() public static méthode

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
Résultat boolean

string() public static méthode

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
Résultat boolean

stringify() protected static méthode

Make a string version of a value.
protected static stringify ( mixed $value ) : string
$value mixed
Résultat string

subclassOf() public static méthode

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
Résultat boolean

true() public static méthode

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
Résultat boolean

url() public static méthode

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
Résultat boolean

uuid() public static méthode

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
Résultat boolean

writeable() public static méthode

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
Résultat boolean

Property Details

$exceptionClass protected_oe static_oe property

Exception to throw when an assertion failed.
protected static string $exceptionClass
Résultat string