11# TypeGuard - PHP type validation partly inspired by [ Ceylon Union and Intersection types] ( https://ceylon-lang.org/documentation/1.3/tour/types/ )
22
3- [ ![ Build Status] ( https://travis-ci.com/Sevavietl /TypeGuard.svg?branch=master )] ( https://travis-ci.com/Sevavietl /TypeGuard )
4- [ ![ Coverage Status] ( https://coveralls.io/repos/github/Sevavietl /TypeGuard/badge.svg )] ( https://coveralls.io/github/Sevavietl /TypeGuard )
3+ [ ![ Build Status] ( https://travis-ci.com/ThoroughPHP /TypeGuard.svg?branch=master )] ( https://travis-ci.com/ThoroughPHP /TypeGuard )
4+ [ ![ Coverage Status] ( https://coveralls.io/repos/github/ThoroughPHP /TypeGuard/badge.svg )] ( https://coveralls.io/github/ThoroughPHP /TypeGuard )
55[ ![ License: MIT] ( https://img.shields.io/badge/License-MIT-yellow.svg )] ( https://opensource.org/licenses/MIT )
66[ ![ PHPStan] ( https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat )] ( https://github.com/phpstan/phpstan )
77
@@ -12,32 +12,32 @@ TypeGuard can validate:
1212- Scalar types: ` string ` , ` integer ` , etc.:
1313
1414``` php
15- (new \ TypeGuard\Guard ('string'))->match('foo'); // => true
15+ (new TypeGuard('string'))->match('foo'); // => true
1616```
1717
1818- Object types: ` ArrayAccess ` , ` stdClass ` , etc.:
1919
2020``` php
21- (new \ TypeGuard\Guard ('stdClass'))->match(new stdClass()); // => true
21+ (new TypeGuard('stdClass'))->match(new stdClass()); // => true
2222```
2323
2424- Union types: ` string|integer ` :
2525
2626``` php
27- $guard = new \ TypeGuard\Guard ('string|integer');
27+ $guard = new TypeGuard('string|integer');
2828$guard->match('foo'); // => true
2929$guard->match(1); // => true
3030```
3131
3232- Intersection types: ` ArrayAccess&Countable ` :
3333
3434``` php
35- (new \ TypeGuard\Guard ('ArrayAccess&Countable'))->match(new ArrayIterator()); // => true
35+ (new TypeGuard('ArrayAccess&Countable'))->match(new ArrayIterator()); // => true
3636```
3737
3838- Optional types: ` ?string ` :
3939
4040``` php
41- (new \ TypeGuard\Guard ('?string'))->match(null); // => true
41+ (new TypeGuard('?string'))->match(null); // => true
4242```
4343
0 commit comments