1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

qa: add additional test for class-string<callable-object>

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
This commit is contained in:
Maximilian Bösing 2023-04-04 17:43:35 +02:00
parent 6c58d98d67
commit 0621ca6e70
No known key found for this signature in database
GPG Key ID: 9A8988C93CEC81A3

View File

@ -115,6 +115,28 @@ final class IntersectionTypeTest extends TestCase
'assertions' => [],
'ignored_issues' => ['UnsafeInstantiation', 'MixedMethodCall'],
],
'classStringOfCallableObjectEqualsObjectWithCallableIntersection' => [
'code' => '<?php
/**
* @param class-string<callable-object> $className
*/
function takesCallableObject(string $className): void {
$object = new $className();
$object();
}
class Foo
{
public function __invoke(): void
{
}
}
takesCallableObject(Foo::class);
',
'assertions' => [],
'ignored_issues' => ['UnsafeInstantiation', 'MixedMethodCall'],
],
];
}