Skip to content

Commit c18bc87

Browse files
phpstan-botclaude
andcommitted
Add supported assertions list to README
The README only showed a single example but did not document which Assert methods the extension actually supports. Add a concise categorized list of all supported assertions derived from the source code, including the nullOr*, all*, allNullOr*, and allNot* prefixes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2b84b9d commit c18bc87

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,40 @@ function demo(?int $a) {
2626
}
2727
```
2828

29+
## Supported assertions
30+
31+
This extension understands the following `Assert::*` methods and narrows types accordingly.
32+
33+
All assertions also work with the `nullOr*()`, `all*()`, and `allNullOr*()` prefixes (e.g. `Assert::nullOrString()`, `Assert::allInteger()`, `Assert::allNullOrNotEmpty()`).
34+
35+
### Type checks
36+
37+
`integer`, `positiveInteger`, `natural`, `float`, `numeric`, `integerish`, `boolean`, `scalar`, `string`, `stringNotEmpty`, `object`, `resource`, `isCallable`, `isArray`, `isIterable`, `isTraversable`, `isList`, `isNonEmptyList`, `isMap`, `isNonEmptyMap`, `isCountable`, `isArrayAccessible`
38+
39+
### Instance and class checks
40+
41+
`isInstanceOf`, `isInstanceOfAny`, `notInstanceOf`, `isAOf`, `isAnyOf`, `isNotA`, `subclassOf`, `implementsInterface`, `classExists`, `interfaceExists`
42+
43+
### Comparison
44+
45+
`same`, `notSame`, `eq`, `notEq`, `greaterThan`, `greaterThanEq`, `lessThan`, `lessThanEq`, `range`, `true`, `false`, `null`, `notNull`, `notFalse`, `inArray`, `oneOf`
46+
47+
### String assertions
48+
49+
`contains`, `startsWith`, `endsWith`, `startsWithLetter`, `unicodeLetters`, `alpha`, `digits`, `alnum`, `lower`, `upper`, `uuid`, `ip`, `ipv4`, `ipv6`, `email`, `notWhitespaceOnly`, `length`, `minLength`, `maxLength`, `lengthBetween`
50+
51+
### Count assertions
52+
53+
`count`, `minCount`, `maxCount`, `countBetween`
54+
55+
### Object and array
56+
57+
`keyExists`, `keyNotExists`, `validArrayKey`, `methodExists`, `propertyExists`
58+
59+
### Negative `all*` assertions
60+
61+
`allNotNull`, `allNotInstanceOf`, `allNotSame`
62+
2963
## Installation
3064

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

0 commit comments

Comments
 (0)