Skip to content

Commit 1ba7ef1

Browse files
staabmondrejmirtes
authored andcommitted
Added a more detailed description into the README
1 parent d638635 commit 1ba7ef1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,24 @@
77
* [PHPStan](https://github.com/phpstan/phpstan)
88
* [beberlei/assert](https://github.com/beberlei/assert)
99

10+
## Description
11+
12+
The main scope of this extension is to help phpstan to detect the type of object after the `Assert\Assertion` validation.
13+
14+
```php
15+
<?php declare(strict_types = 1);
16+
use Assert\Assertion;
17+
18+
function demo(?int $a) {
19+
// ...
20+
21+
Assertion::integer($a);
22+
// phpstan is now aware that $a can no longer be `null` at this point
23+
24+
return ($a === 10);
25+
}
26+
```
27+
1028
This extension specifies types of values passed to:
1129

1230
* `Assertion::integer`

0 commit comments

Comments
 (0)