浏览代码

Deprecate object usage for _types.

dereuromark 8 年之前
父节点
当前提交
b94474dc17
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      src/Database/Type.php

+ 4 - 3
src/Database/Type.php

@@ -106,9 +106,7 @@ class Type implements TypeInterface
             throw new InvalidArgumentException(sprintf('Unknown type "%s"', $name));
         }
         if (is_string(static::$_types[$name])) {
-            static::$_types[$name] = new static::$_types[$name]($name);
-
-            return static::$_builtTypes[$name] = static::$_types[$name];
+            return static::$_builtTypes[$name] = new static::$_types[$name]($name);
         }
 
         return static::$_builtTypes[$name] = static::$_types[$name];
@@ -146,6 +144,9 @@ class Type implements TypeInterface
      * If called with no arguments it will return current types map array
      * If $className is omitted it will return mapped class for $type
      *
+     * Deprecated: The usage of $type as \Cake\Database\Type[] is deprecated. Please always use string[] if you pass an array
+     * as first argument.
+     *
      * @param string|string[]|\Cake\Database\Type[]|null $type If string name of type to map, if array list of arrays to be mapped
      * @param string|\Cake\Database\Type|null $className The classname or object instance of it to register.
      * @return array|string|null If $type is null then array with current map, if $className is null string