Skip to content

Commit 6414dc5

Browse files
committed
Added regression test
1 parent 588f78c commit 6414dc5

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/PHPStan/Rules/Pure/PureFunctionRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,9 @@ public function testBug13201(): void
204204
$this->analyse([__DIR__ . '/data/bug-13201.php'], []);
205205
}
206206

207+
public function testBug12119(): void
208+
{
209+
$this->analyse([__DIR__ . '/data/bug-12119.php'], []);
210+
}
211+
207212
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Bug12119;
4+
5+
/** @phpstan-pure */
6+
function testFunction(string $s): string { return ''; }
7+
8+
class HelloWorld
9+
{
10+
/** @phpstan-pure */
11+
public function testMethod(string $s): string { return ''; }
12+
13+
/** @phpstan-pure */
14+
public function sayHello(string $s): string
15+
{
16+
$a = $this->testMethod('random_int');
17+
$b = testFunction('random_int');
18+
19+
return $a . $b;
20+
}
21+
}

0 commit comments

Comments
 (0)