We're just suggesting to return directly, avoiding the assignment. No
changes to the logic flow.
On 10 May 2014 09:09, "Vitalii Nagara" <notifications@github.com> wrote:

> In library/Zend/View/Resolver/RelativeFallbackResolver.php:
>
> > +     */
> > +    public function resolve($name, Renderer $renderer = null)
> > +    {
> > +        // There should exists view model to get template name
> > +        if (!is_callable(array($renderer, 'plugin'))) {
> > +            return false;
> > +        }
> > +
> > +        // Try to get it from the same name space (folder)
> > +        $helper = $renderer->plugin('view_model');
> > +        $currentTemplate = $helper->getCurrent()->getTemplate();
> > +        $position = strrpos($currentTemplate, self::NS_SEPARATOR);
> > +        if ($position > 0) {
> > +            $absoluteName = substr($currentTemplate, 0, $position) . self::NS_SEPARATOR . $name;
> > +            $resource = $this->resolver->resolve($absoluteName, $renderer);
> > +            return $resource;
>
> @Ocramius <https://github.com/Ocramius> @ojhaujjwal<https://github.com/ojhaujjwal>I disagree with you and try to explain:
> When I wrote the first test for this PHPUnit cast fatal error as there
> were tried access method in null object.
> Extending: if renderer is 'JsonRenderer' It will cast an fatal error too.
> If it uses Resolver standalone it will cast fatal error. To avoid this I
> added this check.
> Why do you so insist on removing this check?
>
> For if ($position > 0) {: why should It run calling a huge function
> instead of simple return? It made for performance and code accuracy.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/zendframework/zf2/pull/6196/files#r12502901>
> .
>