Skip to content

Commit 31f4d1e

Browse files
committed
template model return type
1 parent 8acbbe3 commit 31f4d1e

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/Facade/View.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
use Mvc5\Arg;
99
use Mvc5\Service\Facade;
10+
use Mvc5\Template\TemplateLayout;
11+
use Mvc5\Template\TemplateModel;
1012

1113
trait 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

Comments
 (0)