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:
parent
955899ade0
commit
04c12a36fe
@ -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);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user