Closed InvisibleSmiley closed 5 months ago
PhpRenderer @method for method layout() is incomplete. The method actually returns ModelInterface|Layout, cf. Layout::__invoke. Actually the annotation there is wrong, too, since it never returns null.
PhpRenderer
@method
layout()
ModelInterface|Layout
Layout::__invoke
null
https://github.com/laminas/laminas-view/blob/3.0.x/src/Renderer/PhpRenderer.php#L72 https://github.com/laminas/laminas-view/blob/3.0.x/src/Helper/Layout.php#L38
https://github.com/laminas/laminas-view/blob/2.35.x/src/Renderer/PhpRenderer.php#L76 https://github.com/laminas/laminas-view/blob/2.35.x/src/Helper/Layout.php#L38
Static analysis of code calling PhpRenderer::layout() and passing the result to PhpRenderer::render() fails
PhpRenderer::layout()
PhpRenderer::render()
<?php $renderer = new \Laminas\View\Renderer\PhpRenderer(); $renderer->render($renderer->layout());
Static analysis reports no error with the example code
A patch would be most welcome 👍
Bug Report
Summary
PhpRenderer
@method
for methodlayout()
is incomplete. The method actually returnsModelInterface|Layout
, cf.Layout::__invoke
. Actually the annotation there is wrong, too, since it never returnsnull
.https://github.com/laminas/laminas-view/blob/3.0.x/src/Renderer/PhpRenderer.php#L72 https://github.com/laminas/laminas-view/blob/3.0.x/src/Helper/Layout.php#L38
https://github.com/laminas/laminas-view/blob/2.35.x/src/Renderer/PhpRenderer.php#L76 https://github.com/laminas/laminas-view/blob/2.35.x/src/Helper/Layout.php#L38
Current behavior
Static analysis of code calling
PhpRenderer::layout()
and passing the result toPhpRenderer::render()
failsHow to reproduce
Expected behavior
Static analysis reports no error with the example code