瀏覽代碼

updated type related docs

Johannes 13 年之前
父節點
當前提交
0caa64720d
共有 1 個文件被更改,包括 9 次插入3 次删除
  1. 9 3
      Resources/doc/reference/annotations.rst

+ 9 - 3
Resources/doc/reference/annotations.rst

@@ -193,8 +193,9 @@ by the object iself.
 @Type
 ~~~~~
 This annotation can be defined on a property to specify the type of that property.
-This annotation must only be defined when you want to be able to deserialize an
-object.
+For deserialization, this annotation must be defined. For serialization, you may
+define it in order to enhance the produced output; for example, you may want to
+force a certain format to be used for DateTime types.
 
 Available Types:
 
@@ -219,7 +220,12 @@ Available Types:
 |                           | Examples: array<string, string>,                 |
 |                           | array<string, MyNamespace\MyObject>, etc.        |
 +---------------------------+--------------------------------------------------+
-| DateTime                  | PHP's DateTime object                            |
+| DateTime                  | PHP's DateTime object (default format/timezone)  |
++---------------------------+--------------------------------------------------+
+| DateTime<"format">        | PHP's DateTime object (custom format/default     |
+|                           | timezone)                                        |
++---------------------------+--------------------------------------------------+
+| DateTime<"format", "zone">| PHP's DateTime object (custom format/timezone)   |
 +---------------------------+--------------------------------------------------+
 | T                         | Where T is a fully qualified class name.         |
 +---------------------------+--------------------------------------------------+