This repository was archived by the owner on Jan 21, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 11<?php
22/**
33 * @see https://github.com/zendframework/zend-expressive-zendviewrenderer for the canonical source repository
4- * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (https://www.zend.com)
4+ * @copyright Copyright (c) 2015-2019 Zend Technologies USA Inc. (https://www.zend.com)
55 * @license https://github.com/zendframework/zend-expressive-zendviewrenderer/blob/master/LICENSE.md New BSD License
66 */
77
@@ -44,7 +44,7 @@ class ZendViewRenderer implements TemplateRendererInterface
4444 use DefaultParamsTrait;
4545
4646 /**
47- * @var ViewModel
47+ * @var null|ModelInterface
4848 */
4949 private $ layout ;
5050
@@ -207,6 +207,7 @@ private function renderModel(
207207 $ root = $ model ;
208208 }
209209
210+ /** @var ModelInterface $child */
210211 foreach ($ model as $ child ) {
211212 if ($ child ->terminate ()) {
212213 throw new Exception \RenderingException ('Cannot render; encountered a child marked terminal ' );
@@ -219,7 +220,8 @@ private function renderModel(
219220
220221 $ child = $ this ->mergeViewModel ($ child ->getTemplate (), $ child );
221222
222- if ($ child !== $ root ) {
223+ if ($ renderer instanceof PhpRenderer && $ child !== $ root ) {
224+ /** @var Helper\ViewModel $viewModelHelper */
223225 $ viewModelHelper = $ renderer ->plugin (Helper \ViewModel::class);
224226 $ viewModelHelper ->setRoot ($ root );
225227 }
You can’t perform that action at this time.
0 commit comments