Closed bitwombat closed 4 years ago
If you read the README.md you'd see:
getView()
method on\Laminas\View\Helper\AbstractHelper
returns the realRenderer
instance instead of type-hinted interface
So just use $this->getView()
method instead of the view
attribute.
It is always advisable to rely on APIs instead of internals, even for child classes, so I've written this plugin to provide correct return types only for APIs.
Ah, thanks. I've been looking at this too long. I thought ->view
was handled by a plugin or some other magic.
Hi, thanks for taking over this plugin!
I get this PHPStan error:
And it's because of this code.
So I think the problem for PHPStan is that the view is hinted as
RendererInterface
inAbstractHelper
, but at runtime is actually aPhpRenderer
, which haspartial
as a view plugin.So to fix this am I supposed to extend
AbstractHelper
just to define$view
asPhpRenderer
?Thanks.