77
88use Mvc5 \Arg ;
99use Mvc5 \Service \Facade ;
10+ use Mvc5 \Template \TemplateLayout ;
11+ use Mvc5 \Template \TemplateModel ;
1012
1113trait View
1214{
@@ -19,9 +21,10 @@ trait View
1921 * @param array $vars
2022 * @param string|null $template
2123 * @param string $model
22- * @return \Mvc5\Template\TemplateLayout|mixed
24+ * @return TemplateLayout|mixed
25+ * @throws \Throwable
2326 */
24- static function layout (array $ vars = [], string $ template = null , string $ model = Arg::LAYOUT )
27+ static function layout (array $ vars = [], string $ template = null , string $ model = Arg::LAYOUT ) : TemplateLayout
2528 {
2629 return static ::model ($ vars , $ template , $ model );
2730 }
@@ -30,9 +33,10 @@ static function layout(array $vars = [], string $template = null, string $model
3033 * @param array $vars
3134 * @param string|null $template
3235 * @param string $model
33- * @return \Mvc5\Template\TemplateModel|mixed
36+ * @return TemplateModel|mixed
37+ * @throws \Throwable
3438 */
35- static function model (array $ vars = [], string $ template = null , string $ model = Arg::VIEW_MODEL )
39+ static function model (array $ vars = [], string $ template = null , string $ model = Arg::VIEW_MODEL ) : TemplateModel
3640 {
3741 $ template && $ vars [Arg::TEMPLATE_MODEL ] = $ template ;
3842
@@ -43,8 +47,9 @@ static function model(array $vars = [], string $template = null, string $model =
4347 * @param array|string|\Mvc5\Template\TemplateModel $template
4448 * @param array $vars
4549 * @return string
50+ * @throws \Throwable
4651 */
47- static function render ($ template , array $ vars = [])
52+ static function render ($ template , array $ vars = []) : string
4853 {
4954 return static ::call (Arg::RENDER , [$ template , $ vars ]);
5055 }
@@ -53,9 +58,10 @@ static function render($template, array $vars = [])
5358 * @param string|null $template
5459 * @param array $vars
5560 * @param string $model
56- * @return \Mvc5\Template\TemplateModel|mixed
61+ * @return TemplateModel|mixed
62+ * @throws \Throwable
5763 */
58- static function template (string $ template = null , array $ vars = [], string $ model = Arg::VIEW_MODEL )
64+ static function template (string $ template = null , array $ vars = [], string $ model = Arg::VIEW_MODEL ) : TemplateModel
5965 {
6066 return static ::model ($ vars , $ template , $ model );
6167 }
0 commit comments