1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// test: method-level @template return combined with class-level @extends resolves both
// feature: completion
// Adapted from phpactor generics patterns combining method and class templates
// expect: itemMethod(
---
<?php
class Item {
public function itemMethod(): void {}
}
/**
* @template TItem
*/
class Repository
{
/**
* @return TItem
*/
public function find(int $id) {}
/**
* @template T
* @param T $entity
* @return T
*/
public function save($entity) {}
}
/**
* @extends Repository<Item>
*/
class ItemRepository extends Repository {}
$repo = new ItemRepository();
$result = $repo->find(1);
$result-><>