I have some method with generic:
/**
* @param class-string<T> $class
* @return T
* @throws ClientException
*
* @template T
*/
private function doSomething(string $content, string $class): object
{
$response = $this->service->acme($content, $class, null);
//...
return $response;
}
In other class ($this->service) I have method with generic to
interface MyService
{
/**
* @param class-string<Type> $type
* @return Type
* @template Type
*/
public function acme(mixed $data, string $type, ?string $format): object;
}
But phpStorm and PhpStan cannot correctly recognize the type.
This is the type that phpstorm sees