Skip to content

Commit 4f4e72d

Browse files
committed
Test generics in @param-closure-this
1 parent 8ec4036 commit 4f4e72d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/PHPStan/Analyser/data/param-closure-this.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ public function paramClosureConditional(int $i, callable $cb)
5858

5959
}
6060

61+
/**
62+
* @template T of object
63+
* @param class-string<T> $class
64+
* @param-closure-this T $cb
65+
*/
66+
public function paramClosureGenerics(string $class, callable $cb): void
67+
{
68+
69+
}
70+
6171
public function voidMethod(): void
6272
{
6373

@@ -84,6 +94,9 @@ public function doFoo(): void
8494
$this->paramClosureConditional(2, function () {
8595
assertType(Some::class, $this);
8696
});
97+
$this->paramClosureGenerics(\stdClass::class, function () {
98+
assertType(\stdClass::class, $this);
99+
});
87100
}
88101

89102
public function doFoo2(): void

0 commit comments

Comments
 (0)