Skip to content

Commit 58e9c41

Browse files
committed
add test for a default template in generic ancestors
1 parent 0b15a01 commit 58e9c41

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/PHPStan/Analyser/data/template-default.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,34 @@ function () {
103103
assertType('TemplateDefault\\FormData', $form->mapValues(new FormData));
104104
assertType('stdClass', $form->mapValues());
105105
};
106+
107+
/**
108+
* @template T
109+
* @template U = string
110+
*/
111+
interface Foo
112+
{
113+
/**
114+
* @return U
115+
*/
116+
public function get(): mixed;
117+
}
118+
119+
/**
120+
* @extends Foo<int>
121+
*/
122+
interface Bar extends Foo
123+
{
124+
}
125+
126+
/**
127+
* @extends Foo<int, bool>
128+
*/
129+
interface Baz extends Foo
130+
{
131+
}
132+
133+
function (Bar $bar, Baz $baz) {
134+
assertType('string', $bar->get());
135+
assertType('bool', $baz->get());
136+
};

0 commit comments

Comments
 (0)