1)修改了一些注释的错误参数类型和返回类型

2)修改了一些无意义的变量名
3)本次 commit 没有逻辑上的变动
This commit is contained in:
Jinchun Yang
2016-01-29 22:28:01 +08:00
parent 58cbc8e31a
commit f6a708e1f8
29 changed files with 104 additions and 88 deletions

View File

@@ -319,7 +319,7 @@ class App
}
// 分析 PATH_INFO
private static function parsePathinfo($config)
private static function parsePathinfo(array $config)
{
if (isset($_GET[$config['var_pathinfo']])) {
// 判断URL里面是否有兼容模式参数
@@ -347,10 +347,10 @@ class App
/**
* URL路由检测根据PATH_INFO)
* @access public
* @param $config
* @param array $config
* @throws Exception
*/
public static function route($config)
public static function route(array $config)
{
// 解析PATH_INFO
self::parsePathinfo($config);

View File

@@ -158,7 +158,7 @@ class Config
*/
public static function reset($range = '')
{
$range = $range ?: self::$range;
$range = $range ?: self::$range;
true === $range ? self::$config = [] : self::$config[$range] = [];
}
}

View File

@@ -21,7 +21,7 @@ class Controller
/**
* 前置操作方法列表
* @var beforeActionList
* @var array $beforeActionList
* @access protected
*/
protected $beforeActionList = [];

View File

@@ -60,7 +60,7 @@ class Cookie
*
* @param string $name cookie名称
* @param mixed $value cookie值
* @param null $option
* @param mixed $option 可选参数 可能会是 null|integer|string
*
* @return mixed
* @internal param mixed $options cookie参数

View File

@@ -132,7 +132,7 @@ class Debug
/**
* 获取文件加载信息
* @param bool $detail 是否显示详细
* @return void
* @return integer|array
*/
public static function getFile($detail = false)
{

View File

@@ -36,18 +36,18 @@ class Error
/**
* 自定义错误处理
* @access public
* @param int $errno 错误类型
* @param string $errstr 错误信息
* @param string $errfile 错误文件
* @param int $errline 错误行数
* @param int $error_number 错误类型
* @param string $error_string 错误信息
* @param string $error_file 错误文件
* @param int $error_line 错误行数
* @return void
*/
public static function appError($errno, $errstr, $errfile, $errline)
public static function appError($error_number, $error_string, $error_file, $error_line)
{
$errorStr = "[{$errno}] {$errstr} {$errfile}{$errline} 行.";
switch ($errno) {
$errorStr = "[{$error_number}] {$error_string} {$error_file}{$error_line} 行.";
switch ($error_number) {
case E_USER_ERROR:
self::halt($errorStr, $errno);
self::halt($errorStr, $error_number);
break;
case E_STRICT:
case E_USER_WARNING:

View File

@@ -43,7 +43,7 @@ class Hook
* @param boolean $recursive 是否递归合并
* @return void
*/
public static function import($tags, $recursive = true)
public static function import(array $tags, $recursive = true)
{
if (!$recursive) {
// 覆盖导入
@@ -117,7 +117,7 @@ class Hook
* @param string $class 行为类名称
* @param string $tag 方法名(标签名)
* @param Mixed $params 传人的参数
* @return void
* @return mixed
*/
public static function exec($class, $tag = '', &$params = null)
{

View File

@@ -150,6 +150,7 @@ class Model
* @param string $method 方法名称
* @param array $args 调用参数
* @return mixed
* @throws \think\Exception
*/
public function __call($method, $args)
{
@@ -185,6 +186,7 @@ class Model
* @param mixed $data 要操作的数据
* @param string $type insert 或者 update
* @return array
* @throws \think\Exception
*/
protected function _write_data($data, $type)
{
@@ -255,6 +257,7 @@ class Model
* @param mixed $data 数据
* @param boolean $replace 是否replace
* @return mixed
* @throws \think\Exception
*/
public function add($data = '', $replace = false)
{
@@ -332,6 +335,7 @@ class Model
* @access public
* @param mixed $data 数据
* @return boolean
* @throws \think\Exception
*/
public function save($data = '')
{
@@ -406,6 +410,7 @@ class Model
* @access public
* @param mixed $options 表达式
* @return mixed
* @throws \think\Exception
*/
public function delete($options = [])
{
@@ -476,6 +481,7 @@ class Model
* @access public
* @param mixed $options 表达式参数
* @return mixed
* @throws \think\Exception
*/
public function select($options = [])
{
@@ -532,7 +538,7 @@ class Model
}
// 数据列表读取后的处理
$resultSet = $this->_read_datalist($resultSet, $options);
$resultSet = $this->_read_data_list($resultSet, $options);
// 回调
$this->_after_select($resultSet, $options);
if (isset($options['index'])) {
@@ -559,10 +565,10 @@ class Model
/**
* 数据列表读取后的处理
* @access protected
* @param array $data 当前数据
* @param array $resultSet 当前数据
* @return array
*/
protected function _read_datalist($resultSet, $options)
protected function _read_data_list($resultSet, $options)
{
$resultSet = array_map([$this, '_read_data'], $resultSet);
return $resultSet;
@@ -574,9 +580,9 @@ class Model
/**
* 获取一条记录的某个字段值
* @access public
* @param string $field 字段名
* @param string $spea 字段数据间隔符号 NULL返回数组
* @return mixed
* @param string $field 字段名
* @param null $sepa 字段数据间隔符号 NULL返回数组
* @return array|mixed|null
*/
public function getField($field, $sepa = null)
{
@@ -677,6 +683,7 @@ class Model
* @param integer $step 增长值
* @param integer $lazyTime 延时时间(s)
* @return boolean
* @throws \think\Exception
*/
public function setInc($field, $step = 1, $lazyTime = 0)
{
@@ -705,6 +712,7 @@ class Model
* @param integer $step 减少值
* @param integer $lazyTime 延时时间(s)
* @return boolean
* @throws \think\Exception
*/
public function setDec($field, $step = 1, $lazyTime = 0)
{
@@ -835,6 +843,7 @@ class Model
* @access public
* @param mixed $options 表达式参数
* @return mixed
* @throws \think\Exception
*/
public function find($options = [])
{
@@ -930,6 +939,7 @@ class Model
* @param mixed $data 创建数据
* @param string $type 状态
* @return mixed
* @throws \think\Exception
*/
public function create($data = '', $type = '')
{
@@ -1198,6 +1208,7 @@ class Model
* @access public
* @param mixed $data 数据
* @return Model
* @throws \think\Exception
*/
public function data($data = '')
{
@@ -1308,6 +1319,7 @@ class Model
* @param mixed $union
* @param boolean $all
* @return Model
* @throws \think\Exception
*/
public function union($union, $all = false)
{

View File

@@ -28,7 +28,7 @@ class Response
* @param mixed $data 要返回的数据
* @param String $type 返回数据格式
* @param bool $return 是否返回数据
* @return void
* @return mixed
*/
public static function send($data = '', $type = '', $return = false)
{
@@ -95,7 +95,7 @@ class Response
* 输出类型设置
* @access public
* @param string $type 输出内容的格式类型
* @return void
* @return mixed
*/
public static function type($type = null)
{
@@ -120,7 +120,7 @@ class Response
* 输出是否exit设置
* @access public
* @param bool $exit 是否退出
* @return void
* @return mixed
*/
public static function isExit($exit = null)
{
@@ -137,7 +137,7 @@ class Response
* @param integer $code 返回的code
* @param mixed $msg 提示信息
* @param string $type 返回数据格式
* @return void
* @return mixed
*/
public static function result($data, $code = 0, $msg = '', $type = '')
{
@@ -161,7 +161,7 @@ class Response
* @param mixed $data 返回的数据
* @param mixed $url 跳转的URL地址
* @param mixed $wait 跳转等待时间
* @return void
* @return mixed
*/
public static function success($msg = '', $data = '', $url = '', $wait = 3)
{
@@ -194,7 +194,7 @@ class Response
* @param mixed $data 返回的数据
* @param mixed $url 跳转的URL地址
* @param mixed $wait 跳转等待时间
* @return void
* @return mixed
*/
public static function error($msg = '', $data = '', $url = '', $wait = 3)
{

View File

@@ -32,9 +32,9 @@ class Session
/**
* session初始化
*
* @param array $config
* @return void
* @throws \think\Exception
*/
public static function init(array $config = [])
{
@@ -99,12 +99,9 @@ class Session
/**
* session设置
*
* @param string $name
* session名称
* @param mixed $value
* session值
* @param string $prefix
* 作用域(前缀)
* @param string $name session名称
* @param mixed $value session
* @param string $prefix 作用域(前缀)
* @return void
*/
public static function set($name, $value = '', $prefix = '')
@@ -128,10 +125,8 @@ class Session
/**
* session获取
*
* @param string $name
* session名称
* @param string $prefix
* 作用域(前缀)
* @param string $name session名称
* @param string $prefix 作用域(前缀)
* @return mixed
*/
public static function get($name = '', $prefix = '')
@@ -162,10 +157,8 @@ class Session
/**
* 删除session数据
*
* @param string $name
* session名称
* @param string $prefix
* 作用域(前缀)
* @param string $name session名称
* @param string $prefix 作用域(前缀)
* @return void
*/
public static function delete($name, $prefix = '')
@@ -190,8 +183,7 @@ class Session
/**
* 清空session数据
*
* @param string $prefix
* 作用域(前缀)
* @param string $prefix 作用域(前缀)
* @return void
*/
public static function clear($prefix = '')
@@ -207,8 +199,7 @@ class Session
/**
* 判断session数据
*
* @param string $name
* session名称
* @param string $name session名称
* @param string $prefix
*
* @return bool

View File

@@ -321,6 +321,7 @@ class Template
* @access private
* @param string $content 要解析的模板内容
* @return void
* @throws \think\Exception
*/
private function parsePhp(&$content)
{

View File

@@ -20,7 +20,7 @@ class Url
* @控制器/操作?参数1=值1&参数2=值2...
* \\命名空间类\\方法?参数1=值1&参数2=值2...
* @param string|array $vars 传入的参数,支持数组和字符串
* @param string $suffix 伪静态后缀默认为true表示获取配置值
* @param string|bool $suffix 伪静态后缀默认为true表示获取配置值
* @param boolean|string $domain 是否显示域名 或者直接传入域名
* @return string
*/

View File

@@ -47,6 +47,7 @@ class View
* 初始化视图
* @access public
* @param array $config 配置参数
* @return object
*/
public static function instance(array $config = [])
{
@@ -61,6 +62,7 @@ class View
* @access public
* @param mixed $name 变量名
* @param mixed $value 变量值
* @return View
*/
public function assign($name, $value = '')
{

View File

@@ -87,7 +87,7 @@ class Db
* @param string $name 缓存变量名
* @param mixed $value 存储数据
* @param integer $expire 有效时间(秒)
* @return boolen
* @return boolean
*/
public function set($name, $value, $expire = null)
{
@@ -144,7 +144,7 @@ class Db
* 删除缓存
* @access public
* @param string $name 缓存变量名
* @return boolen
* @return boolean
*/
public function rm($name)
{
@@ -155,7 +155,7 @@ class Db
/**
* 清除缓存
* @access public
* @return boolen
* @return boolean
*/
public function clear()
{

View File

@@ -48,7 +48,7 @@ class File
/**
* 初始化检查
* @access private
* @return boolen
* @return boolean
*/
private function init()
{
@@ -125,7 +125,7 @@ class File
* @param string $name 缓存变量名
* @param mixed $value 存储数据
* @param int $expire 有效时间 0为永久
* @return boolen
* @return boolean
*/
public function set($name, $value, $expire = null)
{
@@ -172,7 +172,7 @@ class File
* 删除缓存
* @access public
* @param string $name 缓存变量名
* @return boolen
* @return boolean
*/
public function rm($name)
{
@@ -183,7 +183,7 @@ class File
* 清除缓存
* @access public
* @param string $name 缓存变量名
* @return boolen
* @return boolean
*/
public function clear()
{

View File

@@ -30,6 +30,7 @@ class Memcache
* 架构函数
* @param array $options 缓存参数
* @access public
* @throws Exception
*/
public function __construct($options = [])
{

View File

@@ -225,7 +225,7 @@ class SecacheClient
public function fetch($key, &$return)
{
$locked = false;
if ($this->lock(false)) {
$locked = true;
}
@@ -275,7 +275,7 @@ class SecacheClient
*
* @param mixed $is_block 是否阻塞
* @access public
* @return void
* @return bool
*/
public function lock($is_block, $whatever = false)
{
@@ -287,7 +287,7 @@ class SecacheClient
* 如果flock不管用请继承本类并重载此方法
*
* @access public
* @return void
* @return bool
*/
public function unlock()
{
@@ -400,7 +400,7 @@ class SecacheClient
*
* @param mixed $key
* @access public
* @return void
* @return mixed
*/
public function search($key, &$pos)
{

View File

@@ -108,6 +108,8 @@ abstract class Driver
/**
* 连接数据库方法
* @access public
* @return resource
* @throws \think\Exception
*/
public function connect($config = '', $linkNum = 0, $autoConnection = false)
{
@@ -160,7 +162,8 @@ abstract class Driver
* @param array $bind 参数绑定
* @param boolean $fetch 不执行只是获取SQL
* @param boolean $master 是否在主服务器读操作
* @return mixed
* @return array|bool|string
* @throws \think\Exception
*/
public function query($sql, $bind = [], $fetch = false, $master = false)
{
@@ -205,6 +208,7 @@ abstract class Driver
* @param array $bind 参数绑定
* @param boolean $fetch 不执行只是获取SQL
* @return integer
* @throws \think\Exception
*/
public function execute($sql, $bind = [], $fetch = false)
{
@@ -275,6 +279,7 @@ abstract class Driver
* @access public
* @param array $bind 要绑定的参数列表
* @return void
* @throws \think\Exception
*/
protected function bindValue(array $bind = [])
{
@@ -295,7 +300,7 @@ abstract class Driver
/**
* 启动事务
* @access public
* @return void
* @return void|false
*/
public function startTrans()
{
@@ -315,13 +320,14 @@ abstract class Driver
/**
* 用于非自动提交状态下面的查询提交
* @access public
* @return boolen
* @return boolean
* @throws \think\Exception
*/
public function commit()
{
if ($this->transTimes > 0) {
try {
$result = $this->linkID->commit();
$this->linkID->commit();
$this->transTimes = 0;
} catch (\PDOException $e) {
throw new Exception($e->getMessage());
@@ -333,13 +339,14 @@ abstract class Driver
/**
* 事务回滚
* @access public
* @return boolen
* @return boolean
* @throws \think\Exception
*/
public function rollback()
{
if ($this->transTimes > 0) {
try {
$result = $this->linkID->rollback();
$this->linkID->rollback();
$this->transTimes = 0;
} catch (\PDOException $e) {
throw new Exception($e->getMessage());
@@ -394,6 +401,7 @@ abstract class Driver
/**
* 设置锁机制
* @access protected
* @param bool $lock
* @return string
*/
protected function parseLock($lock = false)
@@ -957,7 +965,7 @@ abstract class Driver
* @access public
* @param string $fields 要插入的数据表字段名
* @param string $table 要插入的数据表名
* @param array $option 查询数据参数
* @param array $options 查询数据参数
* @return false | integer
*/
public function selectInsert($fields, $table, $options = [])
@@ -1208,7 +1216,7 @@ abstract class Driver
* 连接分布式服务器
* @access protected
* @param boolean $master 主服务器
* @return void
* @return resource
*/
protected function multiConnect($master = false)
{

View File

@@ -46,6 +46,8 @@ class Oracle extends Driver
* @param array $bind 参数绑定
* @param boolean $fetch 不执行只是获取SQL
* @return integer
* @throws \Exception
* @throws \think\Exception
*/
public function execute($sql, $bind = [], $fetch = false)
{
@@ -84,7 +86,7 @@ class Oracle extends Driver
}
return $this->numRows;
} catch (\PDOException $e) {
throw new Exception($this->getError());
throw new \Exception($this->getError());
}
}

View File

@@ -77,7 +77,7 @@ class Pgsql extends Driver
/**
* limit分析
* @access protected
* @param mixed $lmit
* @param mixed $limit
* @return string
*/
public function parseLimit($limit)

View File

@@ -29,7 +29,7 @@ class Email
/**
* 通知发送接口
* @access public
* @param string $log 日志信息
* @param string $msg 日志信息
* @return void
*/
public function send($msg = '')

View File

@@ -34,7 +34,7 @@ class Socket
/**
* 架构函数
* @param array $options 缓存参数
* @param array $config 缓存参数
* @access public
*/
public function __construct($config = [])
@@ -211,8 +211,7 @@ class Socket
"Content-Type: application/json;charset=UTF-8",
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); //设置header
$txt = curl_exec($ch);
return true;
return curl_exec($ch);
}
}

View File

@@ -39,21 +39,21 @@ class TagLib
/**
* 标签库标签列表
* @var string
* @var array
* @access protected
*/
protected $tagList = [];
/**
* 标签库分析数组
* @var string
* @var array
* @access protected
*/
protected $parse = [];
/**
* 标签库是否有效
* @var string
* @var bool
* @access protected
*/
protected $valid = false;
@@ -70,7 +70,7 @@ class TagLib
/**
* 架构函数
* @access public
* @param class $template 模板引擎对象
* @param \stdClass $template 模板引擎对象
*/
public function __construct($template)
{

View File

@@ -25,7 +25,7 @@ trait Jump
* @param mixed $data 返回的数据
* @param mixed $url 跳转的URL地址
* @param mixed $wait 跳转等待时间
* @return void
* @return mixed
*/
public function error($msg = '', $data = '', $url = '', $wait = 3)
{
@@ -39,7 +39,7 @@ trait Jump
* @param mixed $data 返回的数据
* @param mixed $url 跳转的URL地址
* @param mixed $wait 跳转等待时间
* @return void
* @return mixed
*/
public function success($msg = '', $data = '', $url = '', $wait = 3)
{
@@ -55,7 +55,7 @@ trait Jump
*/
public function redirect($url, $params = [])
{
return Response::redirect($url, $params);
Response::redirect($url, $params);
}
}

View File

@@ -123,7 +123,7 @@ trait Adv
/**
* 检查乐观锁
* @access protected
* @param inteter $id 当前主键
* @param integer $id 当前主键
* @param array $data 当前数据
* @return mixed
*/
@@ -217,6 +217,7 @@ trait Adv
* @param array $data 数据
* @param string $type 返回类型 默认为数组
* @return mixed
* @throws \think\Exception
*/
public function returnResult($data, $type = 'array')
{
@@ -240,7 +241,7 @@ trait Adv
* @access protected
* @param array $resultSet 数据
* @param string $type 返回类型 默认为数组
* @return void
* @return array
*/
protected function returnResultSet(&$resultSet, $type = '')
{

View File

@@ -469,7 +469,7 @@ trait Auto
* 指定自动完成
* @access public
* @param array $auto 自动完成设置
* @return Model
* @return Auto
*/
public function auto($auto)
{
@@ -481,7 +481,7 @@ trait Auto
* 指定自动验证
* @access public
* @param array $validate 自动验证设置
* @return Model
* @return Auto
*/
public function validate($validate)
{

View File

@@ -50,7 +50,6 @@ class debugTest extends \PHPUnit_Framework_TestCase
public function testRemark()
{
$name = "testremarkkey";
$value = "testremarkval";
\think\Debug::remark($name);
}

View File

@@ -21,7 +21,7 @@ class responseTest extends \PHPUnit_Framework_TestCase
/**
*
* @var Response
* @var \think\Response
*/
protected $object;

View File

@@ -21,7 +21,7 @@ class sessionTest extends \PHPUnit_Framework_TestCase
/**
*
* @var Session
* @var \think\Session
*/
protected $object;