typedphp / type-functions
0.3.1
2014-12-15 18:27 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: 4.*
README
Example
use TypedPHP\Functions\TypeFunctions; TypeFunctions\getType(1.5); // number TypeFunctions\isBoolean(false); // true TypeFunctions\isBoolean("false"); // false
Functions:
isNumber(mixed $variable) → bool
isBoolean(mixed $variable) → bool
isNull(mixed $variable) → bool
isObject(mixed $variable) → bool
isFunction(mixed $variable) → bool
isExpression(mixed $variable) → bool
isString(mixed $variable) → bool
isResource(mixed $variable) → bool
getType(mixed $variable) → string
Caveats:
isExpression
will return false ifisString
returns true.isFunction
will return false ifisObject
returns true.getType
will return unknown if the argument is not matched by any of theis*
functions.
Installation
❯ composer require "typedphp/type-functions:*"
Testing
❯ composer create-project "typedphp/type-functions:*" . ❯ vendor/bin/phpunit