Skip to content

Commit 2e7f961

Browse files
committed
test impurePoints
1 parent b0b77c0 commit 2e7f961

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tests/PHPStan/Rules/Pure/PureFunctionRuleTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ public function testRule(): void
104104
'Impure output between PHP opening and closing tags in pure function PureFunction\justContainsInlineHtml().',
105105
160,
106106
],
107+
[
108+
'Impure call to function array_push() in pure function PureFunction\bug13288().',
109+
171,
110+
],
107111
]);
108112
}
109113

tests/PHPStan/Rules/Pure/data/pure-function.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,11 @@ function justContainsInlineHtml()
164164
</table>
165165
<?php
166166
}
167+
168+
/** @phpstan-pure */
169+
function bug13288(array $a)
170+
{
171+
array_push($a, function() { // error because by ref arg
172+
exit(); // ok, as array_push() will not invoke the function
173+
});
174+
}

0 commit comments

Comments
 (0)