typedphp/type-functions

0.3.1 2014-12-15 18:27 UTC

This package is auto-updated.

Last update: 2024-09-19 01:33:08 UTC


README

Build Status Code Quality Code Coverage Version License

示例

use TypedPHP\Functions\TypeFunctions;

TypeFunctions\getType(1.5); // number

TypeFunctions\isBoolean(false);   // true
TypeFunctions\isBoolean("false"); // false

函数

  • 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

注意事项

  • 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