1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix docs example for impurity

This commit is contained in:
Brown 2019-08-07 15:39:51 -04:00
parent 955899ade0
commit 04c12a36fe

View File

@ -337,9 +337,20 @@ takesString(new A);
Emitted when calling an impure function from a function or method marked as pure. Emitted when calling an impure function from a function or method marked as pure.
```php ```php
function impure(array $a) : array {
/** @var int */
static $i = 0;
++$i;
$a[$i] = 1;
return $a;
}
/** @psalm-pure */ /** @psalm-pure */
function filterOdd(array $a) : void { function filterOdd(array $a) : void {
extract($a); impure($a);
} }
``` ```