添加方法参数变量约束

This commit is contained in:
thinkphp
2016-01-21 12:21:04 +08:00
parent 680aa8cd66
commit 4f511dc3e9
6 changed files with 35 additions and 36 deletions

View File

@@ -29,7 +29,7 @@ class Cache
* @param array $options 配置数组 * @param array $options 配置数组
* @return object * @return object
*/ */
public static function connect($options = []) public static function connect(array $options = [])
{ {
$type = !empty($options['type']) ? $options['type'] : 'File'; $type = !empty($options['type']) ? $options['type'] : 'File';
$class = (!empty($options['namespace']) ? $options['namespace'] : '\\think\\cache\\driver\\') . ucwords($type); $class = (!empty($options['namespace']) ? $options['namespace'] : '\\think\\cache\\driver\\') . ucwords($type);

View File

@@ -34,7 +34,7 @@ class Cookie
* @param array $config * @param array $config
* @return void * @return void
*/ */
public static function init($config = []) public static function init(array $config = [])
{ {
self::$config = array_merge(self::$config, array_change_key_case($config)); self::$config = array_merge(self::$config, array_change_key_case($config));
if (!empty(self::$config['httponly'])) { if (!empty(self::$config['httponly'])) {

View File

@@ -235,7 +235,7 @@ class Loader
* @param array $options 模型参数 * @param array $options 模型参数
* @return Model * @return Model
*/ */
public static function table($name = '', $options = []) public static function table($name = '', array $options = [])
{ {
static $_model = []; static $_model = [];
if (strpos($name, ':')) { if (strpos($name, ':')) {

View File

@@ -30,7 +30,7 @@ class Log
protected static $alarm = null; protected static $alarm = null;
// 日志初始化 // 日志初始化
public static function init($config = []) public static function init(array $config = [])
{ {
$type = isset($config['type']) ? $config['type'] : 'File'; $type = isset($config['type']) ? $config['type'] : 'File';
$class = (!empty($config['namespace']) ? $config['namespace'] : '\\think\\log\\driver\\') . ucwords($type); $class = (!empty($config['namespace']) ? $config['namespace'] : '\\think\\log\\driver\\') . ucwords($type);
@@ -39,7 +39,7 @@ class Log
} }
// 通知初始化 // 通知初始化
public static function alarm($config = []) public static function alarm(array $config = [])
{ {
$type = isset($config['type']) ? $config['type'] : 'Email'; $type = isset($config['type']) ? $config['type'] : 'Email';
$class = (!empty($config['namespace']) ? $config['namespace'] : '\\think\\log\\alarm\\') . ucwords($type); $class = (!empty($config['namespace']) ? $config['namespace'] : '\\think\\log\\alarm\\') . ucwords($type);

View File

@@ -57,7 +57,7 @@ class Model
* @param string $name 模型名称 * @param string $name 模型名称
* @param array $config 模型配置 * @param array $config 模型配置
*/ */
public function __construct($name = '', $config = []) public function __construct($name = '', array $config = [])
{ {
// 模型初始化 // 模型初始化
$this->_initialize(); $this->_initialize();
@@ -740,10 +740,9 @@ class Model
/** /**
* 生成查询SQL 可用于子查询 * 生成查询SQL 可用于子查询
* @access public * @access public
* @param array $options 表达式参数
* @return string * @return string
*/ */
public function buildSql($options = []) public function buildSql()
{ {
return '( ' . $this->fetchSql(true)->select() . ' )'; return '( ' . $this->fetchSql(true)->select() . ' )';
} }

View File

@@ -23,7 +23,7 @@ class Session
*/ */
public static function prefix($prefix = '') public static function prefix($prefix = '')
{ {
if (empty($prefix) && $prefix !== null) { if (empty($prefix) && null !== $prefix) {
return self::$prefix; return self::$prefix;
} else { } else {
self::$prefix = $prefix; self::$prefix = $prefix;
@@ -36,7 +36,7 @@ class Session
* @param array $config * @param array $config
* @return void * @return void
*/ */
public static function init($config = []) public static function init(array $config = [])
{ {
$isDoStart = false; $isDoStart = false;
if (isset($config['use_trans_sid'])) { if (isset($config['use_trans_sid'])) {