Hi,
When we use generics, the template name is displayed in the tooltip instead of the right type.
H
must be Helpers
Test:
<?php
namespace devsense;
final class Test {}
/**
* @property-read \devsense\Test $test
*/
final class Plugins {}
abstract class AbstractHelpers {}
/**
* @property-read \devsense\Plugins $plugins
*/
final class Helpers extends AbstractHelpers {}
/**
* @template H of AbstractHelpers
*/
abstract class AbstractHelper
{
/**
* @var H
*/
protected AbstractHelpers $helpers;
public function __construct(AbstractHelpers $helpers) {
$this->helpers = $helpers;
}
/**
* @return H
*/
public function getHelpers(): AbstractHelpers {
return $this->helpers;
}
}
/**
* @extends AbstractHelper<Helpers>
*/
abstract class Helper extends AbstractHelper {}
final class MyHelper extends Helper
{
public function test()
{
// Check helpers tooltip here
$this->helpers->plugins;
}
}
Thank you.