Skip to content

Commit 6acc0e5

Browse files
staabmondrejmirtes
authored andcommitted
Added a more detailed description into the README
1 parent 723d2fa commit 6acc0e5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@
77
* [PHPStan](https://github.com/phpstan/phpstan)
88
* [webmozart/assert](https://github.com/webmozart/assert)
99

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

1231
* `Assert::integer`

0 commit comments

Comments
 (0)