Download the PHP package ixnode/php-checker without Composer
On this page you can find all versions of the php package ixnode/php-checker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-checker
PHP Checker
A collection of various PHP types check classes.
Introduction
This package is helpful to validate complex data types like complex arrays and to comply with DocBlock declarations (static code analysis tools like PHPStan or Psalm). Uses and throws exceptions from ixnode/php-exception as a "one-liner". Instead of using the following code:
just use this one:
Installation
Usage
Example 1
Example 2
Example 3
Example 4
Available checkers
Class Ixnode\PhpChecker\Checker
Checks general data type specific properties.
Method | Expected input | Method Parameters | Output value (if passed) | Exception | |||||
---|---|---|---|---|---|---|---|---|---|
checkArray (Alias of CheckerArray::check ) |
array<int\|string, mixed> |
null |
Same as input | TypeInvalidException |
checkBoolean |
bool |
null |
Same as input | TypeInvalidException |
checkClass (Alias of CheckerClass::checkClass ) |
ClassName |
class-string |
Same as input | TypeInvalidException , ClassInvalidException |
|||||
checkFloat |
float |
null |
Same as input | TypeInvalidException |
|||||
checkInteger |
int |
null |
Same as input | TypeInvalidException |
|||||
checkIterable |
iterable |
null |
Same as input | TypeInvalidException |
|||||
checkJson (Alias of CheckerJson::check ) |
json-string |
null |
Same as input | TypeInvalidException |
|||||
checkObject |
object |
null |
Same as input | TypeInvalidException |
|||||
checkStdClass (Alias of CheckerClass::checkStdClass ) |
stdClass |
null |
Same as input | TypeInvalidException |
|||||
checkString |
string |
null |
Same as input | TypeInvalidException |
|||||
checkStringOrNull |
string\|null |
null |
Same as input | TypeInvalidException |
Class Ixnode\PhpChecker\CheckerArray
Checks array specific properties.
Method | Expected input | Method Parameters | Output value (if passed) | Exception |
---|---|---|---|---|
check |
array<int\|string, mixed> |
null |
Same as input | TypeInvalidException |
checkArray |
array<int\|tring, array<string, mixed>> |
null or array<int, string> |
array<int, array<string, mixed>> |
TypeInvalidException |
checkAssoziative |
array<string, mixed> |
null |
Same as input | TypeInvalidException |
checkClass |
array<int\|string, ClassName> |
class-string |
Same as input | TypeInvalidException |
checkFlat |
array<int\|string, bool\|float\|int\|string\|null> |
null |
Same as input | TypeInvalidException |
checkSequential |
array<int, mixed> |
null |
Same as input | TypeInvalidException |
checkString |
array<int\|string, string> |
null |
Same as input | TypeInvalidException |
checkStringOrNull |
array<int\|string, string\|null> |
null |
Same as input | TypeInvalidException |
checkIndex |
array<int\|;string, mixed> |
string |
mixed (index of given) |
TypeInvalidException , ArrayKeyNotFoundException |
checkIndexArray |
array<int\|string, array<int\|string, mixed>> |
string |
array<int\|string, mixed> (index of given) |
TypeInvalidException , ArrayKeyNotFoundException |
checkIndexArrayArray |
array<int\|string, array<int\|string, array<string, mixed>>> |
string , null or array<int, string> |
array<int, array<string, mixed>> (index of given) |
TypeInvalidException , ArrayKeyNotFoundException |
checkIndexArrayAssoziative |
array<int\|string, array<string, mixed>> |
string |
array<string, mixed> (index of given) |
TypeInvalidException , ArrayKeyNotFoundException |
checkIndexArrayClass |
array<int\|string, array<int\|string, ClassName>> |
string |
array<int\|string, ClassName> (index of given) |
TypeInvalidException , ArrayKeyNotFoundException |
checkIndexArrayFlat |
array<int\|string, array<int\|string, bool\|float\|int\|string\|null>> |
string |
array<int\|string, bool\|float\|int\|string\|null> (index of given) |
TypeInvalidException , ArrayKeyNotFoundException |
checkIndexArraySequential |
array<int\|string, array<int, mixed>> |
string |
array<int, string> (index of given) |
TypeInvalidException , ArrayKeyNotFoundException |
checkIndexArrayString |
array<int\|string, array<int\|string, string>> |
string |
array<int\|string, string> (index of given) |
TypeInvalidException , ArrayKeyNotFoundException |
checkIndexArrayStringOrNull |
array<int\|string, array<int\|string, string\|null>> |
string |
array<int\|string, string\|null> (index of given) |
TypeInvalidException , ArrayKeyNotFoundException |
checkIndexInteger |
array<int\|string, int> |
string |
int (index of given) |
TypeInvalidException , ArrayKeyNotFoundException |
checkIndexString |
array<int\|string, string> |
string |
string (index of given) |
TypeInvalidException , ArrayKeyNotFoundException |
checkIndexStringOrNull |
array<int\|string, string\|null> |
string |
string\|null (index of given) |
TypeInvalidException , ArrayKeyNotFoundException |
Class Ixnode\PhpChecker\CheckerClass
Checks class specific properties.
Method | Expected input | Method Parameters | Output value (if passed) | Exception |
---|---|---|---|---|
checkClass |
ClassName |
class-string |
Same as input | TypeInvalidException , ClassInvalidException |
checkStdClass |
stdClass |
null |
Same as input | TypeInvalidException |
Class Ixnode\PhpChecker\CheckerJson
Checks JSON specific properties.
Method | Expected input | Method Parameters | Output value (if passed) | Exception |
---|---|---|---|---|
check |
json-string |
null |
Same as input | TypeInvalidException |
isJson |
json-string |
null |
bool |
null |
Development
License
This tool is licensed under the MIT License - see the LICENSE file for details