Skip to content

Commit

Permalink
fix: 改进视图的类型声明
Browse files Browse the repository at this point in the history
  • Loading branch information
NHZEX authored and liu21st committed Jun 26, 2024
1 parent 7706e37 commit 9bd16e7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/think/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace think;

use think\contract\TemplateHandlerInterface;
use think\helper\Arr;

/**
Expand Down Expand Up @@ -39,7 +40,7 @@ class View extends Manager
* 获取模板引擎
* @access public
* @param string $type 模板引擎类型
* @return $this
* @return TemplateHandlerInterface
*/
public function engine(string $type = null)
{
Expand Down
7 changes: 1 addition & 6 deletions src/think/contract/TemplateHandlerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ interface TemplateHandlerInterface
{
/**
* 检测是否存在模板文件
* @access public
* @param string $template 模板文件或者模板规则
* @return bool
*/
public function exists(string $template): bool;

/**
* 渲染模板文件
* @access public
* @param string $template 模板文件
* @param array $data 模板变量
* @return void
Expand All @@ -36,7 +34,6 @@ public function fetch(string $template, array $data = []): void;

/**
* 渲染模板内容
* @access public
* @param string $content 模板内容
* @param array $data 模板变量
* @return void
Expand All @@ -45,17 +42,15 @@ public function display(string $content, array $data = []): void;

/**
* 配置模板引擎
* @access private
* @param array $config 参数
* @return void
*/
public function config(array $config): void;

/**
* 获取模板引擎配置
* @access public
* @param string $name 参数名
* @return void
* @return mixed
*/
public function getConfig(string $name);
}
6 changes: 0 additions & 6 deletions src/think/view/driver/Php.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public function __construct(App $app, array $config = [])

/**
* 检测是否存在模板文件
* @access public
* @param string $template 模板文件或者模板规则
* @return bool
*/
Expand All @@ -64,7 +63,6 @@ public function exists(string $template): bool

/**
* 渲染模板文件
* @access public
* @param string $template 模板文件
* @param array $data 模板变量
* @return void
Expand All @@ -90,7 +88,6 @@ public function fetch(string $template, array $data = []): void

/**
* 渲染模板内容
* @access public
* @param string $content 模板内容
* @param array $data 模板变量
* @return void
Expand All @@ -105,7 +102,6 @@ public function display(string $content, array $data = []): void

/**
* 自动定位模板文件
* @access private
* @param string $template 模板文件规则
* @return string
*/
Expand Down Expand Up @@ -169,7 +165,6 @@ private function parseTemplate(string $template): string

/**
* 配置模板引擎
* @access private
* @param array $config 参数
* @return void
*/
Expand All @@ -180,7 +175,6 @@ public function config(array $config): void

/**
* 获取模板引擎配置
* @access public
* @param string $name 参数名
* @return mixed
*/
Expand Down
7 changes: 1 addition & 6 deletions tests/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class TestTemplate implements TemplateHandlerInterface

/**
* 检测是否存在模板文件
* @access public
* @param string $template 模板文件或者模板规则
* @return bool
*/
Expand All @@ -81,7 +80,6 @@ public function exists(string $template): bool

/**
* 渲染模板文件
* @access public
* @param string $template 模板文件
* @param array $data 模板变量
* @return void
Expand All @@ -93,7 +91,6 @@ public function fetch(string $template, array $data = []): void

/**
* 渲染模板内容
* @access public
* @param string $content 模板内容
* @param array $data 模板变量
* @return void
Expand All @@ -105,7 +102,6 @@ public function display(string $content, array $data = []): void

/**
* 配置模板引擎
* @access private
* @param array $config 参数
* @return void
*/
Expand All @@ -116,9 +112,8 @@ public function config(array $config): void

/**
* 获取模板引擎配置
* @access public
* @param string $name 参数名
* @return void
* @return mixed
*/
public function getConfig(string $name)
{
Expand Down

0 comments on commit 9bd16e7

Please sign in to comment.