Skip to content

Commit e128925

Browse files
committed
Mention callable result in README.md
1 parent 83e7219 commit e128925

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@ MockerState::addCondition(
112112
);
113113
```
114114

115+
You may also use a callback to set the result of the function:
116+
117+
```php
118+
MockerState::addCondition(
119+
'', // namespace
120+
'headers_sent', // function name
121+
[null, null], // both arguments are references and they are not initialized yet on the function call
122+
fn (&$file, &$line) => $file = $line = 123, // callback result
123+
);
124+
```
125+
115126
So your test case will look like the following:
116127

117128
```php

0 commit comments

Comments
 (0)