Skip to content

Commit

Permalink
template model return type
Browse files Browse the repository at this point in the history
  • Loading branch information
devosc committed Apr 9, 2018
1 parent 6000092 commit 9c5258c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Plugins/View.php
Expand Up @@ -6,16 +6,18 @@
namespace Mvc5\Plugins;

use Mvc5\Arg;
use Mvc5\Template\TemplateLayout;
use Mvc5\Template\TemplateModel;

trait View
{
/**
* @param array $vars
* @param string|null $template
* @param string $model
* @return \Mvc5\Template\TemplateLayout|mixed
* @return TemplateLayout|mixed
*/
protected function layout(array $vars = [], string $template = null, string $model = Arg::LAYOUT)
protected function layout(array $vars = [], string $template = null, string $model = Arg::LAYOUT) : TemplateLayout
{
return $this->model($vars, $template, $model);
}
Expand All @@ -24,9 +26,9 @@ protected function layout(array $vars = [], string $template = null, string $mod
* @param array $vars
* @param string|null $template
* @param string|null $model
* @return \Mvc5\Template\TemplateModel|\Mvc5\Template\TemplateLayout|mixed
* @return TemplateModel|mixed
*/
protected function model(array $vars = [], string $template = null, string $model = null)
protected function model(array $vars = [], string $template = null, string $model = null) : TemplateModel
{
!$model && $model = defined('static::VIEW_MODEL') ? constant('static::VIEW_MODEL') : Arg::VIEW_MODEL;

Expand All @@ -48,9 +50,9 @@ protected abstract function plugin($plugin, array $args = [], callable $callback
/**
* @param string|null $template
* @param array $vars
* @return \Mvc5\Template\TemplateModel|mixed
* @return TemplateModel|mixed
*/
protected function view(string $template = null, array $vars = [])
protected function view(string $template = null, array $vars = []) : TemplateModel
{
return $this->model($vars, $template);
}
Expand Down

0 comments on commit 9c5258c

Please sign in to comment.