typedphp / type-functions
0.3.1
2014-12-15 18:27 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: 4.*
README
示例
use TypedPHP\Functions\TypeFunctions; TypeFunctions\getType(1.5); // number TypeFunctions\isBoolean(false); // true TypeFunctions\isBoolean("false"); // false
函数
isNumber(mixed $variable) → boolisBoolean(mixed $variable) → boolisNull(mixed $variable) → boolisObject(mixed $variable) → boolisFunction(mixed $variable) → boolisExpression(mixed $variable) → boolisString(mixed $variable) → boolisResource(mixed $variable) → boolgetType(mixed $variable) → string
注意事项
isExpression如果isString返回 true,则将返回 false。isFunction如果isObject返回 true,则将返回 false。getType如果参数与任何is*函数不匹配,则将返回 unknown。
安装
❯ composer require "typedphp/type-functions:*"
测试
❯ composer create-project "typedphp/type-functions:*" . ❯ vendor/bin/phpunit