Skip to content

Commit

Permalink
Remove list of supported methods, fix typo in PHPStan :)
Browse files Browse the repository at this point in the history
  • Loading branch information
herndlm authored and ondrejmirtes committed Mar 29, 2024
1 parent e52c0e5 commit b335d5e
Showing 1 changed file with 2 additions and 35 deletions.
37 changes: 2 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## Description

The main scope of this extension is to help phpstan to detect the type of object after the `Assert\Assertion` validation.
The main scope of this extension is to help PHPStan to detect the type of object after the `Assert\Assertion` validation.

```php
<?php declare(strict_types = 1);
Expand All @@ -19,45 +19,12 @@ function demo(?int $a) {
// ...

Assertion::integer($a);
// phpstan is now aware that $a can no longer be `null` at this point
// PHPStan is now aware that $a can no longer be `null` at this point

return ($a === 10);
}
```

This extension specifies types of values passed to:

* `Assertion::integer`
* `Assertion::integerish`
* `Assertion::string`
* `Assertion::float`
* `Assertion::numeric`
* `Assertion::boolean`
* `Assertion::scalar`
* `Assertion::objectOrClass`
* `Assertion::isResource`
* `Assertion::isCallable`
* `Assertion::isArray`
* `Assertion::isInstanceOf`
* `Assertion::notIsInstanceOf`
* `Assertion::subclassOf`
* `Assertion::true`
* `Assertion::false`
* `Assertion::null`
* `Assertion::notNull`
* `Assertion::same`
* `Assertion::notSame`
* `Assertion::isJsonString`
* `Assertion::keyExists`
* `Assertion::keyNotExists`
* `Assertion::notBlank`
* `nullOr*` and `all*` variants of the above methods

`Assert::that`, `Assert::thatNullOr` and `Assert::thatAll` chaining methods are also supported.

`Assert\that`, `Assert\thatNullOr` and `Assert\thatAll` functions are supported too.


## Installation

To use this extension, require it in [Composer](https://getcomposer.org/):
Expand Down

0 comments on commit b335d5e

Please sign in to comment.