Skip to content

Commit 978a497

Browse files
committed
test pure/impure methods
1 parent 3bb9cdb commit 978a497

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/PHPStan/Rules/Arrays/data/bug-14390.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,21 @@ public function countMinus1Static(): void
129129
}
130130
}
131131
}
132+
133+
function doWithMethods(WithMethods $withMethods) {
134+
echo $withMethods->pureMethod()[array_key_first($withMethods->pureMethod())];
135+
echo $withMethods->impureMethod()[array_key_first($withMethods->impureMethod())];
136+
}
137+
138+
class WithMethods {
139+
/**
140+
* @phpstan-pure
141+
* @return non-empty-array
142+
*/
143+
public function pureMethod():array {}
144+
/**
145+
* @phpstan-impure
146+
* @return non-empty-array
147+
*/
148+
public function impureMethod():array {}
149+
}

0 commit comments

Comments
 (0)