Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,16 @@ Assert::nullOrString($middleName, 'The middle name must be a string or null. Got
The `Assert` class comes with a few methods, which can be overridden to change the class behaviour. You can also extend it to
add your own assertions.

### Lazy assertion messages

Assertion messages can be provided as callables to avoid unnecessary computation when the assertion passes:

```php
Assert::string($value, fn() => expensiveMessage());
```

The callable will only be executed if the assertion fails.

#### Overriding methods

Overriding the following methods in your assertion class allows you to change the behaviour of the assertions:
Expand Down
Loading
Loading