Skip to content

Commit 1409717

Browse files
committed
Regression test
Closes phpstan/phpstan#5867
1 parent 4ea59a8 commit 1409717

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

tests/PHPStan/Rules/Functions/CallCallablesRuleTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,9 @@ public function testStaticCallInFunctions(): void
262262
$this->analyse([__DIR__ . '/data/static-call-in-functions.php'], []);
263263
}
264264

265+
public function testBug5867(): void
266+
{
267+
$this->analyse([__DIR__ . '/data/bug-5867.php'], []);
268+
}
269+
265270
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Bug5867;
4+
5+
class HelloWorld
6+
{
7+
/**
8+
* @param class-string $factory
9+
*/
10+
public function sayHello(string $factory): void
11+
{
12+
if (class_exists($factory) && method_exists($factory, '__invoke')) {
13+
(new $factory())();
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)