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:
parent
6c58d98d67
commit
0621ca6e70
@ -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'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user