邹景立 7 лет назад
Родитель
Сommit
edf9413277
27 измененных файлов с 255 добавлено и 693 удалено
  1. 2 2
      thinkphp/library/think/App.php
  2. 7 0
      thinkphp/library/think/Db.php
  3. 25 0
      thinkphp/library/think/Model.php
  4. 9 1
      thinkphp/library/think/Paginator.php
  5. 14 3
      thinkphp/library/think/Request.php
  6. 2 0
      thinkphp/library/think/Route.php
  7. 19 9
      thinkphp/library/think/Url.php
  8. 5 1
      thinkphp/library/think/db/Builder.php
  9. 37 21
      thinkphp/library/think/db/Connection.php
  10. 30 5
      thinkphp/library/think/db/Query.php
  11. 12 0
      thinkphp/library/think/model/Collection.php
  12. 0 74
      thinkphp/library/think/paginator/Collection.php
  13. 6 10
      thinkphp/library/think/template/driver/File.php
  14. 11 20
      thinkphp/library/think/view/driver/Php.php
  15. 1 1
      vendor/autoload.php
  16. 3 2
      vendor/composer/autoload_classmap.php
  17. 7 7
      vendor/composer/autoload_real.php
  18. 7 6
      vendor/composer/autoload_static.php
  19. 14 14
      vendor/composer/installed.json
  20. 2 8
      vendor/symfony/options-resolver/CHANGELOG.md
  21. 0 102
      vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php
  22. 0 26
      vendor/symfony/options-resolver/Exception/NoConfigurationException.php
  23. 1 1
      vendor/symfony/options-resolver/LICENSE
  24. 33 75
      vendor/symfony/options-resolver/OptionsResolver.php
  25. 0 203
      vendor/symfony/options-resolver/Tests/Debug/OptionsResolverIntrospectorTest.php
  26. 6 100
      vendor/symfony/options-resolver/Tests/OptionsResolverTest.php
  27. 2 2
      vendor/symfony/options-resolver/composer.json

+ 2 - 2
thinkphp/library/think/App.php

@@ -20,7 +20,7 @@ use think\route\Dispatch;
  */
 class App implements \ArrayAccess
 {
-    const VERSION = '5.1.11';
+    const VERSION = '5.1.12';
 
     /**
      * 当前模块路径
@@ -891,7 +891,7 @@ class App implements \ArrayAccess
 
     public function __unset($name)
     {
-        $this->container->__unset($name);
+        $this->container->delete($name);
     }
 
     public function offsetExists($key)

+ 7 - 0
thinkphp/library/think/Db.php

@@ -18,12 +18,19 @@ namespace think;
  * @method \think\db\Query master() static 从主服务器读取数据
  * @method \think\db\Query table(string $table) static 指定数据表(含前缀)
  * @method \think\db\Query name(string $name) static 指定数据表(不含前缀)
+ * @method \think\db\Expression raw(string $value) static 使用表达式设置数据
  * @method \think\db\Query where(mixed $field, string $op = null, mixed $condition = null) static 查询条件
+ * @method \think\db\Query whereRaw(string $where, array $bind = []) static 表达式查询
+ * @method \think\db\Query whereExp(string $field, string $condition, array $bind = []) static 字段表达式查询
+ * @method \think\db\Query when(mixed $condition, mixed $query, mixed $otherwise = null) static 条件查询
  * @method \think\db\Query join(mixed $join, mixed $condition = null, string $type = 'INNER') static JOIN查询
  * @method \think\db\Query view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') static 视图查询
+ * @method \think\db\Query field(mixed $field, boolean $except = false) static 指定查询字段
+ * @method \think\db\Query fieldRaw(string $field, array $bind = []) static 指定查询字段
  * @method \think\db\Query union(mixed $union, boolean $all = false) static UNION查询
  * @method \think\db\Query limit(mixed $offset, integer $length = null) static 查询LIMIT
  * @method \think\db\Query order(mixed $field, string $order = null) static 查询ORDER
+ * @method \think\db\Query orderRaw(string $field, array $bind = []) static 查询ORDER
  * @method \think\db\Query cache(mixed $key = null , integer $expire = null) static 设置查询缓存
  * @method mixed value(string $field) static 获取某个字段的值
  * @method array column(string $field, string $key = '') static 获取某个列的值

+ 25 - 0
thinkphp/library/think/Model.php

@@ -93,6 +93,12 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
     protected static $initialized = [];
 
     /**
+     * 是否从主库读取(主从分布式有效)
+     * @var array
+     */
+    protected static $readMaster;
+
+    /**
      * 查询对象实例
      * @var Query
      */
@@ -186,6 +192,21 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
     }
 
     /**
+     * 是否从主库读取数据(主从分布有效)
+     * @access public
+     * @param  bool     $all 是否所有模型有效
+     * @return $this
+     */
+    public function readMaster($all = false)
+    {
+        $model = $all ? '*' : static::class;
+
+        static::$readMaster[$model] = true;
+
+        return $this;
+    }
+
+    /**
      * 创建新的模型实例
      * @access public
      * @param  array|object $data 数据
@@ -212,6 +233,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
             ->json($this->json)
             ->setJsonFieldType($this->jsonType);
 
+        if (isset(static::$readMaster['*']) || isset(static::$readMaster[static::class])) {
+            $query->master(true);
+        }
+
         // 设置当前数据表和模型名
         if (!empty($this->table)) {
             $query->table($this->table);

+ 9 - 1
thinkphp/library/think/Paginator.php

@@ -431,7 +431,15 @@ abstract class Paginator implements ArrayAccess, Countable, IteratorAggregate, J
 
     public function __call($name, $arguments)
     {
-        return call_user_func_array([$this->getCollection(), $name], $arguments);
+        $collection = $this->getCollection();
+
+        $result = call_user_func_array([$collection, $name], $arguments);
+
+        if ($result === $collection) {
+            return $this;
+        }
+
+        return $result;
     }
 
 }

+ 14 - 3
thinkphp/library/think/Request.php

@@ -1593,11 +1593,11 @@ class Request
 
         // IP地址合法验证
         if (filter_var($ip, FILTER_VALIDATE_IP) !== $ip) {
-            $ip = ($ip_mode === 'ipv4') ? '0.0.0.0' : '::';
+            $ip = ('ipv4' === $ip_mode) ? '0.0.0.0' : '::';
         }
 
         // 如果是ipv4地址,则直接使用ip2long返回int类型ip;如果是ipv6地址,暂时不支持,直接返回0
-        $long_ip = ($ip_mode === 'ipv4') ? sprintf("%u", ip2long($ip)) : 0;
+        $long_ip = ('ipv4' === $ip_mode) ? sprintf("%u", ip2long($ip)) : 0;
 
         $ip = [$ip, $long_ip];
 
@@ -1953,9 +1953,20 @@ class Request
     }
 
     /**
+     * 设置请求数据
+     * @access public
+     * @param  string    $name  参数名
+     * @param  mixed     $value 值
+     */
+    public function __set($name, $value)
+    {
+        return $this->param[$name] = $value;
+    }
+
+    /**
      * 获取请求数据的值
      * @access public
-     * @param  string $name 名称
+     * @param  string $name 参数
      * @return mixed
      */
     public function __get($name)

+ 2 - 0
thinkphp/library/think/Route.php

@@ -313,6 +313,8 @@ class Route
     {
         if (is_null($domain)) {
             $domain = $this->domain;
+        } elseif (true === $domain) {
+            return $this->bind;
         } elseif (!strpos($domain, '.')) {
             $domain .= '.' . $this->request->rootDomain();
         }

+ 19 - 9
thinkphp/library/think/Url.php

@@ -134,6 +134,25 @@ class Url
                 }
             }
 
+            // 检测URL绑定
+            if (!$this->bindCheck) {
+                $bind = $this->app['route']->getBind($domain && is_string($domain) ? $domain : null);
+
+                if ($bind && 0 === strpos($url, $bind)) {
+                    $url = substr($url, strlen($bind) + 1);
+                } else {
+                    $binds = $this->app['route']->getBind(true);
+
+                    foreach ($binds as $key => $val) {
+                        if (is_string($val) && 0 === strpos($url, $val) && substr_count($val, '/') > 1) {
+                            $url    = substr($url, strlen($val) + 1);
+                            $domain = $key;
+                            break;
+                        }
+                    }
+                }
+            }
+
             if (!$matchAlias) {
                 // 路由标识不存在 直接解析
                 $url = $this->parseUrl($url);
@@ -146,15 +165,6 @@ class Url
             }
         }
 
-        // 检测URL绑定
-        if (!$this->bindCheck) {
-            $bind = $this->app['route']->getBind($domain ?: null);
-
-            if ($bind && 0 === strpos($url, $bind)) {
-                $url = substr($url, strlen($bind) + 1);
-            }
-
-        }
         // 还原URL分隔符
         $depr = $this->app['config']->get('pathinfo_depr');
         $url  = str_replace('/', $depr, $url);

+ 5 - 1
thinkphp/library/think/db/Builder.php

@@ -871,7 +871,7 @@ abstract class Builder
     }
 
     /**
-     * group分析
+     * orderField分析
      * @access protected
      * @param  Query     $query        查询对象
      * @param  mixed     $key
@@ -945,6 +945,10 @@ abstract class Builder
      */
     protected function parseComment(Query $query, $comment)
     {
+        if (false !== strpos($comment, '*/')) {
+            $comment = strstr($coment, '*/', true);
+        }
+
         return !empty($comment) ? ' /* ' . $comment . ' */' : '';
     }
 

+ 37 - 21
thinkphp/library/think/db/Connection.php

@@ -90,6 +90,8 @@ abstract class Connection
         'master_num'      => 1,
         // 指定从服务器序号
         'slave_no'        => '',
+        // 模型写入后自动读取主服务器
+        'read_master'     => false,
         // 是否严格检查字段是否存在
         'fields_strict'   => true,
         // 数据集返回类型
@@ -614,7 +616,7 @@ abstract class Connection
         $this->PDOStatement->execute();
 
         // 调试结束
-        $this->debug(false);
+        $this->debug(false, '', $master);
 
         // 返回结果集
         while ($result = $this->PDOStatement->fetch($this->fetchType)) {
@@ -688,7 +690,7 @@ abstract class Connection
             $this->PDOStatement->execute();
 
             // 调试结束
-            $this->debug(false);
+            $this->debug(false, '', $master);
 
             // 返回结果集
             return $this->getResult($pdo, $procedure);
@@ -718,13 +720,14 @@ abstract class Connection
      * @access public
      * @param  string        $sql sql指令
      * @param  array         $bind 参数绑定
+     * @param  Query         $query 查询对象
      * @return int
      * @throws BindParamException
      * @throws \PDOException
      * @throws \Exception
      * @throws \Throwable
      */
-    public function execute($sql, $bind = [])
+    public function execute($sql, $bind = [], Query $query = null)
     {
         $this->initConnect(true);
 
@@ -766,26 +769,30 @@ abstract class Connection
             $this->PDOStatement->execute();
 
             // 调试结束
-            $this->debug(false);
+            $this->debug(false, '', true);
+
+            if ($query && !empty($this->config['deploy']) && !empty($this->config['read_master'])) {
+                $query->readMaster();
+            }
 
             $this->numRows = $this->PDOStatement->rowCount();
 
             return $this->numRows;
         } catch (\PDOException $e) {
             if ($this->isBreak($e)) {
-                return $this->close()->execute($sql, $bind);
+                return $this->close()->execute($sql, $bind, $query);
             }
 
             throw new PDOException($e, $this->config, $this->getLastsql());
         } catch (\Throwable $e) {
             if ($this->isBreak($e)) {
-                return $this->close()->execute($sql, $bind);
+                return $this->close()->execute($sql, $bind, $query);
             }
 
             throw $e;
         } catch (\Exception $e) {
             if ($this->isBreak($e)) {
-                return $this->close()->execute($sql, $bind);
+                return $this->close()->execute($sql, $bind, $query);
             }
 
             throw $e;
@@ -976,7 +983,7 @@ abstract class Connection
         }
 
         // 执行操作
-        $result = $this->execute($sql, $bind);
+        $result = $this->execute($sql, $bind, $query);
 
         if ($result) {
             $sequence  = $sequence ?: (isset($options['sequence']) ? $options['sequence'] : null);
@@ -1037,7 +1044,7 @@ abstract class Connection
                     if (!empty($options['fetch_sql'])) {
                         $fetchSql[] = $this->getRealSql($sql, $bind);
                     } else {
-                        $count += $this->execute($sql, $bind);
+                        $count += $this->execute($sql, $bind, $query);
                     }
                 }
 
@@ -1061,7 +1068,7 @@ abstract class Connection
             return $this->getRealSql($sql, $bind);
         }
 
-        return $this->execute($sql, $bind);
+        return $this->execute($sql, $bind, $query);
     }
 
     /**
@@ -1088,7 +1095,7 @@ abstract class Connection
             return $this->getRealSql($sql, $bind);
         }
 
-        return $this->execute($sql, $bind);
+        return $this->execute($sql, $bind, $query);
     }
 
     /**
@@ -1165,7 +1172,7 @@ abstract class Connection
         }
 
         // 执行操作
-        $result = '' == $sql ? 0 : $this->execute($sql, $bind);
+        $result = '' == $sql ? 0 : $this->execute($sql, $bind, $query);
 
         if ($result) {
             if (is_string($pk) && isset($where[$pk])) {
@@ -1231,7 +1238,7 @@ abstract class Connection
         }
 
         // 执行操作
-        $result = $this->execute($sql, $bind);
+        $result = $this->execute($sql, $bind, $query);
 
         if ($result) {
             if (!is_array($data) && is_string($pk) && isset($key) && strpos($key, '|')) {
@@ -1261,8 +1268,8 @@ abstract class Connection
         $options = $query->getOptions();
 
         if (empty($options['fetch_sql']) && !empty($options['cache'])) {
-
-            $result = $this->getCacheData($query, $options['cache'], $field, $key);
+            $cache  = $options['cache'];
+            $result = $this->getCacheData($query, $cache, $field, $key);
 
             if (false !== $result) {
                 return $result;
@@ -1867,9 +1874,10 @@ abstract class Connection
      * @access protected
      * @param  boolean $start 调试开始标记 true 开始 false 结束
      * @param  string  $sql 执行的SQL语句 留空自动获取
+     * @param  bool    $master 主从标记
      * @return void
      */
-    protected function debug($start, $sql = '')
+    protected function debug($start, $sql = '', $master = false)
     {
         if (!empty($this->config['debug'])) {
             // 开启数据库调试模式
@@ -1890,7 +1898,7 @@ abstract class Connection
                 }
 
                 // SQL监听
-                $this->triggerSql($sql, $runtime, $result);
+                $this->triggerSql($sql, $runtime, $result, $master);
             }
         }
     }
@@ -1912,19 +1920,27 @@ abstract class Connection
      * @param  string    $sql SQL语句
      * @param  float     $runtime SQL运行时间
      * @param  mixed     $explain SQL分析
-     * @return bool
+     * @param  bool      $master 主从标记
+     * @return void
      */
-    protected function triggerSql($sql, $runtime, $explain = [])
+    protected function triggerSql($sql, $runtime, $explain = [], $master = false)
     {
         if (!empty(self::$event)) {
             foreach (self::$event as $callback) {
                 if (is_callable($callback)) {
-                    call_user_func_array($callback, [$sql, $runtime, $explain]);
+                    call_user_func_array($callback, [$sql, $runtime, $explain, $master]);
                 }
             }
         } else {
+            if ($this->config['deploy']) {
+                // 分布式记录当前操作的主从
+                $master = $master ? 'master|' : 'slave|';
+            } else {
+                $master = '';
+            }
+
             // 未注册监听则记录到日志中
-            $this->log('[ SQL ] ' . $sql . ' [ RunTime:' . $runtime . 's ]');
+            $this->log('[ SQL ] ' . $sql . ' [ ' . $master . 'RunTime:' . $runtime . 's ]');
 
             if (!empty($explain)) {
                 $this->log('[ EXPLAIN : ' . var_export($explain, true) . ' ]');

+ 30 - 5
thinkphp/library/think/db/Query.php

@@ -89,6 +89,12 @@ class Query
     private static $extend = [];
 
     /**
+     * 读取主库的表
+     * @var array
+     */
+    private static $readMaster = [];
+
+    /**
      * 日期查询表达式
      * @var array
      */
@@ -243,6 +249,21 @@ class Query
     }
 
     /**
+     * 设置从主库读取数据
+     * @access public
+     * @param  bool $all 是否所有表有效
+     * @return $this
+     */
+    public function readMaster($all = false)
+    {
+        $table = $all ? '*' : $this->getTable();
+
+        static::$readMaster[$table] = true;
+
+        return $this;
+    }
+
+    /**
      * 指定当前数据表名(不含前缀)
      * @access public
      * @param  string $name
@@ -1511,7 +1532,7 @@ class Query
         } elseif (in_array(strtoupper($op), ['REGEXP', 'NOT REGEXP', 'EXISTS', 'NOT EXISTS', 'NOTEXISTS'], true)) {
             $where = [$field, $op, is_string($condition) ? $this->raw($condition) : $condition];
         } else {
-            $where = $field ? [$field, $op, $condition] : null;
+            $where = $field ? [$field, $op, $condition, isset($param[2]) ? $param[2] : null] : null;
         }
 
         return $where;
@@ -3070,16 +3091,16 @@ class Query
             $key = isset($alias) ? $alias . '.' . $pk : $pk;
             // 根据主键查询
             if (is_array($data)) {
-                $where[$pk] = isset($data[$pk]) ? [$key, '=', $data[$pk]] : [$key, 'in', $data];
+                $where[] = isset($data[$pk]) ? [$key, '=', $data[$pk]] : [$key, 'in', $data];
             } else {
-                $where[$pk] = strpos($data, ',') ? [$key, 'IN', $data] : [$key, '=', $data];
+                $where[] = strpos($data, ',') ? [$key, 'IN', $data] : [$key, '=', $data];
             }
         } elseif (is_array($pk) && is_array($data) && !empty($data)) {
             // 根据复合主键查询
             foreach ($pk as $key) {
                 if (isset($data[$key])) {
-                    $attr        = isset($alias) ? $alias . '.' . $key : $key;
-                    $where[$key] = [$attr, '=', $data[$key]];
+                    $attr    = isset($alias) ? $alias . '.' . $key : $key;
+                    $where[] = [$attr, '=', $data[$key]];
                 } else {
                     throw new Exception('miss complex primary data');
                 }
@@ -3138,6 +3159,10 @@ class Query
             }
         }
 
+        if (isset(static::$readMaster['*']) || (is_string($options['table']) && isset(static::$readMaster[$options['table']]))) {
+            $options['master'] = true;
+        }
+
         foreach (['join', 'union', 'group', 'having', 'limit', 'force', 'comment'] as $name) {
             if (!isset($options[$name])) {
                 $options[$name] = '';

+ 12 - 0
thinkphp/library/think/model/Collection.php

@@ -17,6 +17,18 @@ use think\Model;
 class Collection extends BaseCollection
 {
     /**
+     * 返回数组中指定的一列
+     * @access public
+     * @param  string        $column_key
+     * @param  string|null   $index_key
+     * @return array
+     */
+    public function column($column_key, $index_key = null)
+    {
+        return array_column($this->toArray(), $column_key, $index_key);
+    }
+
+    /**
      * 延迟预载入关联查询
      * @access public
      * @param  mixed $relation 关联

+ 0 - 74
thinkphp/library/think/paginator/Collection.php

@@ -1,74 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: zhangyajun <448901948@qq.com>
-// +----------------------------------------------------------------------
-
-namespace think\paginator;
-
-use Exception;
-use think\Paginator;
-
-/**
- * Class Collection
- * @package think\paginator
- * @method integer total()
- * @method integer listRows()
- * @method integer currentPage()
- * @method string render()
- * @method Paginator fragment($fragment)
- * @method Paginator appends($key, $value)
- * @method integer lastPage()
- * @method boolean hasPages()
- */
-class Collection extends \think\Collection
-{
-
-    /** @var Paginator */
-    protected $paginator;
-
-    public function __construct($items = [], Paginator $paginator = null)
-    {
-        $this->paginator = $paginator;
-        parent::__construct($items);
-    }
-
-    public static function make($items = [], Paginator $paginator = null)
-    {
-        return new static($items, $paginator);
-    }
-
-    public function toArray()
-    {
-        if ($this->paginator) {
-            try {
-                $total = $this->total();
-            } catch (Exception $e) {
-                $total = null;
-            }
-
-            return [
-                'total'        => $total,
-                'per_page'     => $this->listRows(),
-                'current_page' => $this->currentPage(),
-                'data'         => parent::toArray(),
-            ];
-        } else {
-            return parent::toArray();
-        }
-    }
-
-    public function __call($method, $args)
-    {
-        if ($this->paginator && method_exists($this->paginator, $method)) {
-            return call_user_func_array([$this->paginator, $method], $args);
-        } else {
-            throw new Exception('method not exists:' . __CLASS__ . '->' . $method);
-        }
-    }
-}

+ 6 - 10
thinkphp/library/think/template/driver/File.php

@@ -15,6 +15,8 @@ use think\Exception;
 
 class File
 {
+    protected $cacheFile;
+
     /**
      * 写入编译缓存
      * @access public
@@ -46,21 +48,15 @@ class File
      */
     public function read($cacheFile, $vars = [])
     {
+        $this->cacheFile = $cacheFile;
+
         if (!empty($vars) && is_array($vars)) {
             // 模板阵列变量分解成为独立变量
-            if (isset($vars['cacheFile'])) {
-                $_think_cacheFile = $cacheFile;
-                $cacheFile        = $vars['cacheFile'];
-                unset($vars['cacheFile'], $vars['_think_cacheFile']);
-                extract($vars, EXTR_OVERWRITE);
-                include $_think_cacheFile;
-                return;
-            }
-            extract($vars);
+            extract($vars, EXTR_OVERWRITE);
         }
 
         //载入模版缓存文件
-        include $cacheFile;
+        include $this->cacheFile;
     }
 
     /**

+ 11 - 20
thinkphp/library/think/view/driver/Php.php

@@ -31,6 +31,9 @@ class Php
         'view_depr'   => DIRECTORY_SEPARATOR,
     ];
 
+    protected $template;
+    protected $content;
+
     public function __construct($config = [])
     {
         $this->config = array_merge($this->config, (array) $config);
@@ -71,20 +74,14 @@ class Php
             throw new TemplateNotFoundException('template not exists:' . $template, $template);
         }
 
+        $this->template = $template;
+
         // 记录视图信息
         Container::get('app')
             ->log('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]');
 
-        if (isset($data['template'])) {
-            $__template__ = $template;
-            $template     = $data['template'];
-            unset($data['template'], $data['__template__']);
-            extract($data, EXTR_OVERWRITE);
-            include $__template__;
-        } else {
-            extract($data, EXTR_OVERWRITE);
-            include $template;
-        }
+        extract($data, EXTR_OVERWRITE);
+        include $this->template;
     }
 
     /**
@@ -96,16 +93,10 @@ class Php
      */
     public function display($content, $data = [])
     {
-        if (isset($data['content'])) {
-            $__content__ = $content;
-            $content     = $data['content'];
-            unset($data['content'], $data['__content__']);
-            extract($data, EXTR_OVERWRITE);
-            eval('?>' . $__content__);
-        } else {
-            extract($data, EXTR_OVERWRITE);
-            eval('?>' . $content);
-        }
+        $this->content = $content;
+
+        extract($data, EXTR_OVERWRITE);
+        eval('?>' . $this->content);
     }
 
     /**

+ 1 - 1
vendor/autoload.php

@@ -4,4 +4,4 @@
 
 require_once __DIR__ . '/composer/autoload_real.php';
 
-return ComposerAutoloaderInit634fe4faf75443ee005458ef619df6f4::getLoader();
+return ComposerAutoloaderInit6bdafcea0aae51264a9f8f289803db99::getLoader();

+ 3 - 2
vendor/composer/autoload_classmap.php

@@ -101,13 +101,11 @@ return array(
     'Qiniu\\Storage\\ResumeUploader' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/ResumeUploader.php',
     'Qiniu\\Storage\\UploadManager' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php',
     'Qiniu\\Zone' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Zone.php',
-    'Symfony\\Component\\OptionsResolver\\Debug\\OptionsResolverIntrospector' => $vendorDir . '/symfony/options-resolver/Debug/OptionsResolverIntrospector.php',
     'Symfony\\Component\\OptionsResolver\\Exception\\AccessException' => $vendorDir . '/symfony/options-resolver/Exception/AccessException.php',
     'Symfony\\Component\\OptionsResolver\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/options-resolver/Exception/ExceptionInterface.php',
     'Symfony\\Component\\OptionsResolver\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/options-resolver/Exception/InvalidArgumentException.php',
     'Symfony\\Component\\OptionsResolver\\Exception\\InvalidOptionsException' => $vendorDir . '/symfony/options-resolver/Exception/InvalidOptionsException.php',
     'Symfony\\Component\\OptionsResolver\\Exception\\MissingOptionsException' => $vendorDir . '/symfony/options-resolver/Exception/MissingOptionsException.php',
-    'Symfony\\Component\\OptionsResolver\\Exception\\NoConfigurationException' => $vendorDir . '/symfony/options-resolver/Exception/NoConfigurationException.php',
     'Symfony\\Component\\OptionsResolver\\Exception\\NoSuchOptionException' => $vendorDir . '/symfony/options-resolver/Exception/NoSuchOptionException.php',
     'Symfony\\Component\\OptionsResolver\\Exception\\OptionDefinitionException' => $vendorDir . '/symfony/options-resolver/Exception/OptionDefinitionException.php',
     'Symfony\\Component\\OptionsResolver\\Exception\\UndefinedOptionsException' => $vendorDir . '/symfony/options-resolver/Exception/UndefinedOptionsException.php',
@@ -161,6 +159,9 @@ return array(
     'app\\goods\\controller\\Spec' => $baseDir . '/application/goods/controller/Spec.php',
     'app\\goods\\service\\ProductService' => $baseDir . '/application/goods/service/ProductService.php',
     'app\\index\\controller\\Index' => $baseDir . '/application/index/controller/Index.php',
+    'app\\store\\controller\\Express' => $baseDir . '/application/store/controller/Express.php',
+    'app\\store\\controller\\Order' => $baseDir . '/application/store/controller/Order.php',
+    'app\\store\\service\\OrderService' => $baseDir . '/application/store/service/OrderService.php',
     'app\\wechat\\controller\\Block' => $baseDir . '/application/wechat/controller/Block.php',
     'app\\wechat\\controller\\Config' => $baseDir . '/application/wechat/controller/Config.php',
     'app\\wechat\\controller\\Fans' => $baseDir . '/application/wechat/controller/Fans.php',

+ 7 - 7
vendor/composer/autoload_real.php

@@ -2,7 +2,7 @@
 
 // autoload_real.php @generated by Composer
 
-class ComposerAutoloaderInit634fe4faf75443ee005458ef619df6f4
+class ComposerAutoloaderInit6bdafcea0aae51264a9f8f289803db99
 {
     private static $loader;
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit634fe4faf75443ee005458ef619df6f4
             return self::$loader;
         }
 
-        spl_autoload_register(array('ComposerAutoloaderInit634fe4faf75443ee005458ef619df6f4', 'loadClassLoader'), true, true);
+        spl_autoload_register(array('ComposerAutoloaderInit6bdafcea0aae51264a9f8f289803db99', 'loadClassLoader'), true, true);
         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
-        spl_autoload_unregister(array('ComposerAutoloaderInit634fe4faf75443ee005458ef619df6f4', 'loadClassLoader'));
+        spl_autoload_unregister(array('ComposerAutoloaderInit6bdafcea0aae51264a9f8f289803db99', 'loadClassLoader'));
 
         $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
         if ($useStaticLoader) {
             require_once __DIR__ . '/autoload_static.php';
 
-            call_user_func(\Composer\Autoload\ComposerStaticInit634fe4faf75443ee005458ef619df6f4::getInitializer($loader));
+            call_user_func(\Composer\Autoload\ComposerStaticInit6bdafcea0aae51264a9f8f289803db99::getInitializer($loader));
         } else {
             $map = require __DIR__ . '/autoload_namespaces.php';
             foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit634fe4faf75443ee005458ef619df6f4
         $loader->register(true);
 
         if ($useStaticLoader) {
-            $includeFiles = Composer\Autoload\ComposerStaticInit634fe4faf75443ee005458ef619df6f4::$files;
+            $includeFiles = Composer\Autoload\ComposerStaticInit6bdafcea0aae51264a9f8f289803db99::$files;
         } else {
             $includeFiles = require __DIR__ . '/autoload_files.php';
         }
         foreach ($includeFiles as $fileIdentifier => $file) {
-            composerRequire634fe4faf75443ee005458ef619df6f4($fileIdentifier, $file);
+            composerRequire6bdafcea0aae51264a9f8f289803db99($fileIdentifier, $file);
         }
 
         return $loader;
     }
 }
 
-function composerRequire634fe4faf75443ee005458ef619df6f4($fileIdentifier, $file)
+function composerRequire6bdafcea0aae51264a9f8f289803db99($fileIdentifier, $file)
 {
     if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
         require $file;

+ 7 - 6
vendor/composer/autoload_static.php

@@ -4,7 +4,7 @@
 
 namespace Composer\Autoload;
 
-class ComposerStaticInit634fe4faf75443ee005458ef619df6f4
+class ComposerStaticInit6bdafcea0aae51264a9f8f289803db99
 {
     public static $files = array (
         '1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php',
@@ -184,13 +184,11 @@ class ComposerStaticInit634fe4faf75443ee005458ef619df6f4
         'Qiniu\\Storage\\ResumeUploader' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/ResumeUploader.php',
         'Qiniu\\Storage\\UploadManager' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php',
         'Qiniu\\Zone' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Zone.php',
-        'Symfony\\Component\\OptionsResolver\\Debug\\OptionsResolverIntrospector' => __DIR__ . '/..' . '/symfony/options-resolver/Debug/OptionsResolverIntrospector.php',
         'Symfony\\Component\\OptionsResolver\\Exception\\AccessException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/AccessException.php',
         'Symfony\\Component\\OptionsResolver\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/ExceptionInterface.php',
         'Symfony\\Component\\OptionsResolver\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/InvalidArgumentException.php',
         'Symfony\\Component\\OptionsResolver\\Exception\\InvalidOptionsException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/InvalidOptionsException.php',
         'Symfony\\Component\\OptionsResolver\\Exception\\MissingOptionsException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/MissingOptionsException.php',
-        'Symfony\\Component\\OptionsResolver\\Exception\\NoConfigurationException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/NoConfigurationException.php',
         'Symfony\\Component\\OptionsResolver\\Exception\\NoSuchOptionException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/NoSuchOptionException.php',
         'Symfony\\Component\\OptionsResolver\\Exception\\OptionDefinitionException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/OptionDefinitionException.php',
         'Symfony\\Component\\OptionsResolver\\Exception\\UndefinedOptionsException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/UndefinedOptionsException.php',
@@ -244,6 +242,9 @@ class ComposerStaticInit634fe4faf75443ee005458ef619df6f4
         'app\\goods\\controller\\Spec' => __DIR__ . '/../..' . '/application/goods/controller/Spec.php',
         'app\\goods\\service\\ProductService' => __DIR__ . '/../..' . '/application/goods/service/ProductService.php',
         'app\\index\\controller\\Index' => __DIR__ . '/../..' . '/application/index/controller/Index.php',
+        'app\\store\\controller\\Express' => __DIR__ . '/../..' . '/application/store/controller/Express.php',
+        'app\\store\\controller\\Order' => __DIR__ . '/../..' . '/application/store/controller/Order.php',
+        'app\\store\\service\\OrderService' => __DIR__ . '/../..' . '/application/store/service/OrderService.php',
         'app\\wechat\\controller\\Block' => __DIR__ . '/../..' . '/application/wechat/controller/Block.php',
         'app\\wechat\\controller\\Config' => __DIR__ . '/../..' . '/application/wechat/controller/Config.php',
         'app\\wechat\\controller\\Fans' => __DIR__ . '/../..' . '/application/wechat/controller/Fans.php',
@@ -269,9 +270,9 @@ class ComposerStaticInit634fe4faf75443ee005458ef619df6f4
     public static function getInitializer(ClassLoader $loader)
     {
         return \Closure::bind(function () use ($loader) {
-            $loader->prefixLengthsPsr4 = ComposerStaticInit634fe4faf75443ee005458ef619df6f4::$prefixLengthsPsr4;
-            $loader->prefixDirsPsr4 = ComposerStaticInit634fe4faf75443ee005458ef619df6f4::$prefixDirsPsr4;
-            $loader->classMap = ComposerStaticInit634fe4faf75443ee005458ef619df6f4::$classMap;
+            $loader->prefixLengthsPsr4 = ComposerStaticInit6bdafcea0aae51264a9f8f289803db99::$prefixLengthsPsr4;
+            $loader->prefixDirsPsr4 = ComposerStaticInit6bdafcea0aae51264a9f8f289803db99::$prefixDirsPsr4;
+            $loader->classMap = ComposerStaticInit6bdafcea0aae51264a9f8f289803db99::$classMap;
 
         }, null, ClassLoader::class);
     }

+ 14 - 14
vendor/composer/installed.json

@@ -176,17 +176,17 @@
     },
     {
         "name": "topthink/framework",
-        "version": "v5.1.11",
-        "version_normalized": "5.1.11.0",
+        "version": "v5.1.12",
+        "version_normalized": "5.1.12.0",
         "source": {
             "type": "git",
             "url": "https://github.com/top-think/framework.git",
-            "reference": "3156528b80dfa004109dfbfdbeb770b376a13f01"
+            "reference": "f879603ee321af8fde56d8855445cf98bc81b042"
         },
         "dist": {
             "type": "zip",
-            "url": "https://files.phpcomposer.com/files/top-think/framework/3156528b80dfa004109dfbfdbeb770b376a13f01.zip",
-            "reference": "3156528b80dfa004109dfbfdbeb770b376a13f01",
+            "url": "https://files.phpcomposer.com/files/top-think/framework/f879603ee321af8fde56d8855445cf98bc81b042.zip",
+            "reference": "f879603ee321af8fde56d8855445cf98bc81b042",
             "shasum": ""
         },
         "require": {
@@ -202,7 +202,7 @@
             "sebastian/phpcpd": "2.*",
             "squizlabs/php_codesniffer": "2.*"
         },
-        "time": "2018-04-19T10:12:09+00:00",
+        "time": "2018-04-26T03:46:41+00:00",
         "type": "think-framework",
         "installation-source": "dist",
         "notification-url": "https://packagist.org/downloads/",
@@ -270,27 +270,27 @@
     },
     {
         "name": "symfony/options-resolver",
-        "version": "v3.4.8",
-        "version_normalized": "3.4.8.0",
+        "version": "v3.3.6",
+        "version_normalized": "3.3.6.0",
         "source": {
             "type": "git",
             "url": "https://github.com/symfony/options-resolver.git",
-            "reference": "f3109a6aedd20e35c3a33190e932c2b063b7b50e"
+            "reference": "ff48982d295bcac1fd861f934f041ebc73ae40f0"
         },
         "dist": {
             "type": "zip",
-            "url": "https://files.phpcomposer.com/files/symfony/options-resolver/f3109a6aedd20e35c3a33190e932c2b063b7b50e.zip",
-            "reference": "f3109a6aedd20e35c3a33190e932c2b063b7b50e",
+            "url": "https://files.phpcomposer.com/files/symfony/options-resolver/ff48982d295bcac1fd861f934f041ebc73ae40f0.zip",
+            "reference": "ff48982d295bcac1fd861f934f041ebc73ae40f0",
             "shasum": ""
         },
         "require": {
-            "php": "^5.5.9|>=7.0.8"
+            "php": ">=5.5.9"
         },
-        "time": "2018-01-11T07:56:07+00:00",
+        "time": "2017-04-12T14:14:56+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {
-                "dev-master": "3.4-dev"
+                "dev-master": "3.3-dev"
             }
         },
         "installation-source": "dist",

+ 2 - 8
vendor/symfony/options-resolver/CHANGELOG.md

@@ -1,12 +1,6 @@
 CHANGELOG
 =========
 
-3.4.0
------
-
- * added `OptionsResolverIntrospector` to inspect options definitions inside an `OptionsResolver` instance
- * added array of types support in allowed types (e.g int[])
-
 2.6.0
 -----
 
@@ -31,7 +25,7 @@ CHANGELOG
  * deprecated OptionsResolver::isKnown() in favor of isDefined()
  * [BC BREAK] OptionsResolver::isRequired() returns true now if a required
    option has a default value set
- * [BC BREAK] merged Options into OptionsResolver and turned Options into an
+ * [BC BREAK] merged Options into OptionsResolver and turned Options into an 
    interface
  * deprecated Options::overload() (now in OptionsResolver)
  * deprecated Options::set() (now in OptionsResolver)
@@ -42,7 +36,7 @@ CHANGELOG
    lazy option/normalizer closures now
  * [BC BREAK] removed Traversable interface from Options since using within
    lazy option/normalizer closures resulted in exceptions
- * [BC BREAK] removed Options::all() since using within lazy option/normalizer
+ * [BC BREAK] removed Options::all() since using within lazy option/normalizer 
    closures resulted in exceptions
  * [BC BREAK] OptionDefinitionException now extends LogicException instead of
    RuntimeException

+ 0 - 102
vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php

@@ -1,102 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\OptionsResolver\Debug;
-
-use Symfony\Component\OptionsResolver\Exception\NoConfigurationException;
-use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException;
-use Symfony\Component\OptionsResolver\OptionsResolver;
-
-/**
- * @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
- *
- * @final
- */
-class OptionsResolverIntrospector
-{
-    private $get;
-
-    public function __construct(OptionsResolver $optionsResolver)
-    {
-        $this->get = \Closure::bind(function ($property, $option, $message) {
-            /** @var OptionsResolver $this */
-            if (!$this->isDefined($option)) {
-                throw new UndefinedOptionsException(sprintf('The option "%s" does not exist.', $option));
-            }
-
-            if (!array_key_exists($option, $this->{$property})) {
-                throw new NoConfigurationException($message);
-            }
-
-            return $this->{$property}[$option];
-        }, $optionsResolver, $optionsResolver);
-    }
-
-    /**
-     * @param string $option
-     *
-     * @return mixed
-     *
-     * @throws NoConfigurationException on no configured value
-     */
-    public function getDefault($option)
-    {
-        return call_user_func($this->get, 'defaults', $option, sprintf('No default value was set for the "%s" option.', $option));
-    }
-
-    /**
-     * @param string $option
-     *
-     * @return \Closure[]
-     *
-     * @throws NoConfigurationException on no configured closures
-     */
-    public function getLazyClosures($option)
-    {
-        return call_user_func($this->get, 'lazy', $option, sprintf('No lazy closures were set for the "%s" option.', $option));
-    }
-
-    /**
-     * @param string $option
-     *
-     * @return string[]
-     *
-     * @throws NoConfigurationException on no configured types
-     */
-    public function getAllowedTypes($option)
-    {
-        return call_user_func($this->get, 'allowedTypes', $option, sprintf('No allowed types were set for the "%s" option.', $option));
-    }
-
-    /**
-     * @param string $option
-     *
-     * @return mixed[]
-     *
-     * @throws NoConfigurationException on no configured values
-     */
-    public function getAllowedValues($option)
-    {
-        return call_user_func($this->get, 'allowedValues', $option, sprintf('No allowed values were set for the "%s" option.', $option));
-    }
-
-    /**
-     * @param string $option
-     *
-     * @return \Closure
-     *
-     * @throws NoConfigurationException on no configured normalizer
-     */
-    public function getNormalizer($option)
-    {
-        return call_user_func($this->get, 'normalizers', $option, sprintf('No normalizer was set for the "%s" option.', $option));
-    }
-}

+ 0 - 26
vendor/symfony/options-resolver/Exception/NoConfigurationException.php

@@ -1,26 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\OptionsResolver\Exception;
-
-use Symfony\Component\OptionsResolver\Debug\OptionsResolverIntrospector;
-
-/**
- * Thrown when trying to introspect an option definition property
- * for which no value was configured inside the OptionsResolver instance.
- *
- * @see OptionsResolverIntrospector
- *
- * @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
- */
-class NoConfigurationException extends \RuntimeException implements ExceptionInterface
-{
-}

+ 1 - 1
vendor/symfony/options-resolver/LICENSE

@@ -1,4 +1,4 @@
-Copyright (c) 2004-2018 Fabien Potencier
+Copyright (c) 2004-2017 Fabien Potencier
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal

+ 33 - 75
vendor/symfony/options-resolver/OptionsResolver.php

@@ -28,21 +28,29 @@ class OptionsResolver implements Options
 {
     /**
      * The names of all defined options.
+     *
+     * @var array
      */
     private $defined = array();
 
     /**
      * The default option values.
+     *
+     * @var array
      */
     private $defaults = array();
 
     /**
      * The names of required options.
+     *
+     * @var array
      */
     private $required = array();
 
     /**
      * The resolved option values.
+     *
+     * @var array
      */
     private $resolved = array();
 
@@ -55,16 +63,22 @@ class OptionsResolver implements Options
 
     /**
      * A list of accepted values for each option.
+     *
+     * @var array
      */
     private $allowedValues = array();
 
     /**
      * A list of accepted types for each option.
+     *
+     * @var array
      */
     private $allowedTypes = array();
 
     /**
      * A list of closures for evaluating lazy options.
+     *
+     * @var array
      */
     private $lazy = array();
 
@@ -72,6 +86,8 @@ class OptionsResolver implements Options
      * A list of lazy options whose closure is currently being called.
      *
      * This list helps detecting circular dependencies between lazy options.
+     *
+     * @var array
      */
     private $calling = array();
 
@@ -82,6 +98,8 @@ class OptionsResolver implements Options
      * necessary in order to avoid inconsistencies during the resolving
      * process. If any option is changed after being read, all evaluated
      * lazy options that depend on this option would become invalid.
+     *
+     * @var bool
      */
     private $locked = false;
 
@@ -774,12 +792,21 @@ class OptionsResolver implements Options
         // Validate the type of the resolved option
         if (isset($this->allowedTypes[$option])) {
             $valid = false;
-            $invalidTypes = array();
 
             foreach ($this->allowedTypes[$option] as $type) {
                 $type = isset(self::$typeAliases[$type]) ? self::$typeAliases[$type] : $type;
 
-                if ($valid = $this->verifyTypes($type, $value, $invalidTypes)) {
+                if (function_exists($isFunction = 'is_'.$type)) {
+                    if ($isFunction($value)) {
+                        $valid = true;
+                        break;
+                    }
+
+                    continue;
+                }
+
+                if ($value instanceof $type) {
+                    $valid = true;
                     break;
                 }
             }
@@ -791,7 +818,7 @@ class OptionsResolver implements Options
                     $option,
                     $this->formatValue($value),
                     implode('" or "', $this->allowedTypes[$option]),
-                    implode('|', array_keys($invalidTypes))
+                    $this->formatTypeOf($value)
                 ));
             }
         }
@@ -869,45 +896,6 @@ class OptionsResolver implements Options
     }
 
     /**
-     * @param string $type
-     * @param mixed  $value
-     * @param array  &$invalidTypes
-     *
-     * @return bool
-     */
-    private function verifyTypes($type, $value, array &$invalidTypes)
-    {
-        if ('[]' === substr($type, -2) && is_array($value)) {
-            $originalType = $type;
-            $type = substr($type, 0, -2);
-            $invalidValues = array_filter( // Filter out valid values, keeping invalid values in the resulting array
-                $value,
-                function ($value) use ($type) {
-                    return !self::isValueValidType($type, $value);
-                }
-            );
-
-            if (!$invalidValues) {
-                return true;
-            }
-
-            $invalidTypes[$this->formatTypeOf($value, $originalType)] = true;
-
-            return false;
-        }
-
-        if (self::isValueValidType($type, $value)) {
-            return true;
-        }
-
-        if (!$invalidTypes) {
-            $invalidTypes[$this->formatTypeOf($value, null)] = true;
-        }
-
-        return false;
-    }
-
-    /**
      * Returns whether a resolved option with the given name exists.
      *
      * @param string $option The option name
@@ -975,38 +963,13 @@ class OptionsResolver implements Options
      * parameters should usually not be included in messages aimed at
      * non-technical people.
      *
-     * @param mixed  $value The value to return the type of
-     * @param string $type
+     * @param mixed $value The value to return the type of
      *
      * @return string The type of the value
      */
-    private function formatTypeOf($value, $type)
+    private function formatTypeOf($value)
     {
-        $suffix = '';
-
-        if ('[]' === substr($type, -2)) {
-            $suffix = '[]';
-            $type = substr($type, 0, -2);
-            while ('[]' === substr($type, -2)) {
-                $type = substr($type, 0, -2);
-                $value = array_shift($value);
-                if (!is_array($value)) {
-                    break;
-                }
-                $suffix .= '[]';
-            }
-
-            if (is_array($value)) {
-                $subTypes = array();
-                foreach ($value as $val) {
-                    $subTypes[$this->formatTypeOf($val, null)] = true;
-                }
-
-                return implode('|', array_keys($subTypes)).$suffix;
-            }
-        }
-
-        return (is_object($value) ? get_class($value) : gettype($value)).$suffix;
+        return is_object($value) ? get_class($value) : gettype($value);
     }
 
     /**
@@ -1073,9 +1036,4 @@ class OptionsResolver implements Options
 
         return implode(', ', $values);
     }
-
-    private static function isValueValidType($type, $value)
-    {
-        return (function_exists($isFunction = 'is_'.$type) && $isFunction($value)) || $value instanceof $type;
-    }
 }

+ 0 - 203
vendor/symfony/options-resolver/Tests/Debug/OptionsResolverIntrospectorTest.php

@@ -1,203 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\OptionsResolver\Tests\Debug;
-
-use PHPUnit\Framework\TestCase;
-use Symfony\Component\OptionsResolver\Debug\OptionsResolverIntrospector;
-use Symfony\Component\OptionsResolver\Options;
-use Symfony\Component\OptionsResolver\OptionsResolver;
-
-class OptionsResolverIntrospectorTest extends TestCase
-{
-    public function testGetDefault()
-    {
-        $resolver = new OptionsResolver();
-        $resolver->setDefault($option = 'foo', 'bar');
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame('bar', $debug->getDefault($option));
-    }
-
-    public function testGetDefaultNull()
-    {
-        $resolver = new OptionsResolver();
-        $resolver->setDefault($option = 'foo', null);
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertNull($debug->getDefault($option));
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException
-     * @expectedExceptionMessage No default value was set for the "foo" option.
-     */
-    public function testGetDefaultThrowsOnNoConfiguredValue()
-    {
-        $resolver = new OptionsResolver();
-        $resolver->setDefined($option = 'foo');
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame('bar', $debug->getDefault($option));
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
-     * @expectedExceptionMessage The option "foo" does not exist.
-     */
-    public function testGetDefaultThrowsOnNotDefinedOption()
-    {
-        $resolver = new OptionsResolver();
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame('bar', $debug->getDefault('foo'));
-    }
-
-    public function testGetLazyClosures()
-    {
-        $resolver = new OptionsResolver();
-        $closures = array();
-        $resolver->setDefault($option = 'foo', $closures[] = function (Options $options) {});
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame($closures, $debug->getLazyClosures($option));
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException
-     * @expectedExceptionMessage No lazy closures were set for the "foo" option.
-     */
-    public function testGetLazyClosuresThrowsOnNoConfiguredValue()
-    {
-        $resolver = new OptionsResolver();
-        $resolver->setDefined($option = 'foo');
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame('bar', $debug->getLazyClosures($option));
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
-     * @expectedExceptionMessage The option "foo" does not exist.
-     */
-    public function testGetLazyClosuresThrowsOnNotDefinedOption()
-    {
-        $resolver = new OptionsResolver();
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame('bar', $debug->getLazyClosures('foo'));
-    }
-
-    public function testGetAllowedTypes()
-    {
-        $resolver = new OptionsResolver();
-        $resolver->setDefined($option = 'foo');
-        $resolver->setAllowedTypes($option = 'foo', $allowedTypes = array('string', 'bool'));
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame($allowedTypes, $debug->getAllowedTypes($option));
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException
-     * @expectedExceptionMessage No allowed types were set for the "foo" option.
-     */
-    public function testGetAllowedTypesThrowsOnNoConfiguredValue()
-    {
-        $resolver = new OptionsResolver();
-        $resolver->setDefined($option = 'foo');
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame('bar', $debug->getAllowedTypes($option));
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
-     * @expectedExceptionMessage The option "foo" does not exist.
-     */
-    public function testGetAllowedTypesThrowsOnNotDefinedOption()
-    {
-        $resolver = new OptionsResolver();
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame('bar', $debug->getAllowedTypes('foo'));
-    }
-
-    public function testGetAllowedValues()
-    {
-        $resolver = new OptionsResolver();
-        $resolver->setDefined($option = 'foo');
-        $resolver->setAllowedValues($option = 'foo', $allowedValues = array('bar', 'baz'));
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame($allowedValues, $debug->getAllowedValues($option));
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException
-     * @expectedExceptionMessage No allowed values were set for the "foo" option.
-     */
-    public function testGetAllowedValuesThrowsOnNoConfiguredValue()
-    {
-        $resolver = new OptionsResolver();
-        $resolver->setDefined($option = 'foo');
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame('bar', $debug->getAllowedValues($option));
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
-     * @expectedExceptionMessage The option "foo" does not exist.
-     */
-    public function testGetAllowedValuesThrowsOnNotDefinedOption()
-    {
-        $resolver = new OptionsResolver();
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame('bar', $debug->getAllowedValues('foo'));
-    }
-
-    public function testGetNormalizer()
-    {
-        $resolver = new OptionsResolver();
-        $resolver->setDefined($option = 'foo');
-        $resolver->setNormalizer($option = 'foo', $normalizer = function () {});
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame($normalizer, $debug->getNormalizer($option));
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException
-     * @expectedExceptionMessage No normalizer was set for the "foo" option.
-     */
-    public function testGetNormalizerThrowsOnNoConfiguredValue()
-    {
-        $resolver = new OptionsResolver();
-        $resolver->setDefined($option = 'foo');
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame('bar', $debug->getNormalizer($option));
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
-     * @expectedExceptionMessage The option "foo" does not exist.
-     */
-    public function testGetNormalizerThrowsOnNotDefinedOption()
-    {
-        $resolver = new OptionsResolver();
-
-        $debug = new OptionsResolverIntrospector($resolver);
-        $this->assertSame('bar', $debug->getNormalizer('foo'));
-    }
-}

+ 6 - 100
vendor/symfony/options-resolver/Tests/OptionsResolverTest.php

@@ -486,15 +486,6 @@ class OptionsResolverTest extends TestCase
         $this->resolver->setAllowedTypes('foo', 'string');
     }
 
-    public function testResolveTypedArray()
-    {
-        $this->resolver->setDefined('foo');
-        $this->resolver->setAllowedTypes('foo', 'string[]');
-        $options = $this->resolver->resolve(array('foo' => array('bar', 'baz')));
-
-        $this->assertSame(array('foo' => array('bar', 'baz')), $options);
-    }
-
     /**
      * @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
      */
@@ -510,65 +501,6 @@ class OptionsResolverTest extends TestCase
     }
 
     /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
-     * @expectedExceptionMessage The option "foo" with value array is expected to be of type "int[]", but is of type "DateTime[]".
-     */
-    public function testResolveFailsIfInvalidTypedArray()
-    {
-        $this->resolver->setDefined('foo');
-        $this->resolver->setAllowedTypes('foo', 'int[]');
-
-        $this->resolver->resolve(array('foo' => array(new \DateTime())));
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
-     * @expectedExceptionMessage The option "foo" with value "bar" is expected to be of type "int[]", but is of type "string".
-     */
-    public function testResolveFailsWithNonArray()
-    {
-        $this->resolver->setDefined('foo');
-        $this->resolver->setAllowedTypes('foo', 'int[]');
-
-        $this->resolver->resolve(array('foo' => 'bar'));
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
-     * @expectedExceptionMessage The option "foo" with value array is expected to be of type "int[]", but is of type "integer|stdClass|array|DateTime[]".
-     */
-    public function testResolveFailsIfTypedArrayContainsInvalidTypes()
-    {
-        $this->resolver->setDefined('foo');
-        $this->resolver->setAllowedTypes('foo', 'int[]');
-        $values = range(1, 5);
-        $values[] = new \stdClass();
-        $values[] = array();
-        $values[] = new \DateTime();
-        $values[] = 123;
-
-        $this->resolver->resolve(array('foo' => $values));
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
-     * @expectedExceptionMessage The option "foo" with value array is expected to be of type "int[][]", but is of type "double[][]".
-     */
-    public function testResolveFailsWithCorrectLevelsButWrongScalar()
-    {
-        $this->resolver->setDefined('foo');
-        $this->resolver->setAllowedTypes('foo', 'int[][]');
-
-        $this->resolver->resolve(
-            array(
-                'foo' => array(
-                    array(1.2),
-                ),
-            )
-        );
-    }
-
-    /**
      * @dataProvider provideInvalidTypes
      */
     public function testResolveFailsIfInvalidType($actualType, $allowedType, $exceptionMessage)
@@ -636,32 +568,6 @@ class OptionsResolverTest extends TestCase
         $this->assertNotEmpty($this->resolver->resolve());
     }
 
-    public function testResolveSucceedsIfTypedArray()
-    {
-        $this->resolver->setDefault('foo', null);
-        $this->resolver->setAllowedTypes('foo', array('null', 'DateTime[]'));
-
-        $data = array(
-            'foo' => array(
-                new \DateTime(),
-                new \DateTime(),
-            ),
-        );
-        $result = $this->resolver->resolve($data);
-        $this->assertEquals($data, $result);
-    }
-
-    /**
-     * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
-     */
-    public function testResolveFailsIfNotInstanceOfClass()
-    {
-        $this->resolver->setDefault('foo', 'bar');
-        $this->resolver->setAllowedTypes('foo', '\stdClass');
-
-        $this->resolver->resolve();
-    }
-
     ////////////////////////////////////////////////////////////////////////////
     // addAllowedTypes()
     ////////////////////////////////////////////////////////////////////////////
@@ -1513,12 +1419,12 @@ class OptionsResolverTest extends TestCase
         });
 
         $this->resolver->setDefault('lazy2', function (Options $options) {
-            Assert::assertArrayHasKey('default1', $options);
-            Assert::assertArrayHasKey('default2', $options);
-            Assert::assertArrayHasKey('required', $options);
-            Assert::assertArrayHasKey('lazy1', $options);
-            Assert::assertArrayHasKey('lazy2', $options);
-            Assert::assertArrayNotHasKey('defined', $options);
+            Assert::assertTrue(isset($options['default1']));
+            Assert::assertTrue(isset($options['default2']));
+            Assert::assertTrue(isset($options['required']));
+            Assert::assertTrue(isset($options['lazy1']));
+            Assert::assertTrue(isset($options['lazy2']));
+            Assert::assertFalse(isset($options['defined']));
 
             Assert::assertSame(0, $options['default1']);
             Assert::assertSame(42, $options['default2']);

+ 2 - 2
vendor/symfony/options-resolver/composer.json

@@ -16,7 +16,7 @@
         }
     ],
     "require": {
-        "php": "^5.5.9|>=7.0.8"
+        "php": ">=5.5.9"
     },
     "autoload": {
         "psr-4": { "Symfony\\Component\\OptionsResolver\\": "" },
@@ -27,7 +27,7 @@
     "minimum-stability": "dev",
     "extra": {
         "branch-alias": {
-            "dev-master": "3.4-dev"
+            "dev-master": "3.3-dev"
         }
     }
 }