为Request类的几个方法完善注释

在phpstorm2016.2.1中,使用下列语句会提示警告: 

>Method __toString is not implemented for '\think\Request' less... (Ctrl+F1) 
This inspection detects attempts to convert objects without __toString() method implementation to string, since PHP 5.2.0, it would cause E_RECOVERABLE_ERROR. "Check __toString exists for each expression type": if the option is on, the inspection will check all possible types of the expression and report if at least one ot them doesn't contain __toString() method implementation. 
```
$request = Request::instance();
echo "当前模块名称是" . $request->module();// 这句会被IDE提示警告
echo "当前控制器名称是" . $request->controller();// 这句会被IDE提示警告
echo "当前操作名称是" . $request->action();// 这句就不会
```
后来发现是注释引起的问题,注释中有@return string|$this。而action()方法却写成@return string。个人认为应该统一写成@return string|Request 比较合适。学识短浅,仅供参考 
```
/**
     * 设置或者获取当前的模块名
     * @access public
     * @param string $module 模块名
     * @return string|$this
     */
    public function module($module = null)
```
This commit is contained in:
HyperQing
2016-10-21 11:36:55 +08:00
committed by GitHub
parent 3be17ea06b
commit c64a335884

View File

@@ -1370,7 +1370,7 @@ class Request
* 设置或者获取当前的模块名
* @access public
* @param string $module 模块名
* @return string|$this
* @return string|Request
*/
public function module($module = null)
{
@@ -1386,7 +1386,7 @@ class Request
* 设置或者获取当前的控制器名
* @access public
* @param string $controller 控制器名
* @return string|$this
* @return string|Request
*/
public function controller($controller = null)
{
@@ -1402,7 +1402,7 @@ class Request
* 设置或者获取当前的操作名
* @access public
* @param string $action 操作名
* @return string
* @return string|Request
*/
public function action($action = null)
{
@@ -1418,7 +1418,7 @@ class Request
* 设置或者获取当前的语言
* @access public
* @param string $lang 语言名
* @return string
* @return string|Request
*/
public function langset($lang = null)
{