I've got following code:
<?php
/**
* @template T
*/
abstract class A {
/**
* @return T
*/
public function read() {
// return statement
}
}
class C {}
/**
* @extends A<C>
*/
class B extends A {}
$b = new B();
$b->read();
Inside VSCode, when i hover over read method, i would like it to return C class back from method, currently comes @return T - it ignores @extends A<C> value.
I know there's a way to achieve this with @method, but It also makes doubled hints about a function if i declare it below @template T, and method declaration needs to be changed at 2 places if something changes.
Is it possible to achieve it somehow?
As i realized right now, it works well. It didn't worked in my Code, because of declared class-string annotation, which seemed to override
Tvalue from@extends.After defining it as normal
stringproperty, just for use case in class, method returns right object.