thorough-php/type-guard
Composer 安装命令:
composer require thorough-php/type-guard
包简介
PHP type validator
README 文档
README
Features
TypeGuard can validate:
- Scalar types:
string,integer, etc.:
(new TypeGuard('string'))->match('foo'); // => true
- Object types:
ArrayAccess,stdClass, etc.:
(new TypeGuard('stdClass'))->match(new stdClass()); // => true
- Union types:
string|integer:
$guard = new TypeGuard('string|integer'); $guard->match('foo'); // => true $guard->match(1); // => true
- Intersection types:
ArrayAccess&Countable:
(new TypeGuard('ArrayAccess&Countable'))->match(new ArrayIterator()); // => true
- Optional types:
?string:
(new TypeGuard('?string'))->match(null); // => true
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-09