@@ -37,27 +37,22 @@ interpreted as described in [RFC 2119][RFC2119].
37
37
> It is important to note that a PHPDoc and a DocBlock are two separate
38
38
> entities. The DocBlock is the combination of a DocComment, which is a type
39
39
> of comment, and a PHPDoc entity. It is the PHPDoc entity that contains the
40
- > syntax as described in this specification (such as the description and tags).
40
+ > syntax as described in this specification (such as the Description and tags).
41
41
42
- * "Structural Element" is a collection of Programming Constructs which MAY be
42
+ * "Structural Element" is a collection of programming constructs which MAY be
43
43
preceded by a DocBlock. The collection contains the following constructs:
44
44
45
- * require(\_ once)
46
- * include(\_ once)
47
- * class
48
- * interface
49
- * trait
50
- * function (including methods)
51
- * property
52
- * constant
53
- * variables, both local and global scope.
54
-
55
- It is RECOMMENDED to precede a "Structural Element" with a DocBlock where it is
56
- defined and not with each usage. It is common practice to have the DocBlock
57
- precede a Structural Element but it MAY also be separated by an undetermined
58
- number of empty lines.
45
+ * ` require ` / ` include ` (and their ` \_once ` variants)
46
+ * ` class ` / ` interface ` / ` trait `
47
+ * ` function ` (both standalone functions and class methods)
48
+ * variables (local and global scope) and class properties
49
+ * constants (global constants via ` define ` and class constants)
59
50
60
- Example:
51
+ It is RECOMMENDED to precede a "Structural Element" with a DocBlock where it
52
+ is defined. It is common practice to have the DocBlock precede a Structural
53
+ Element but it MAY also be separated by any number of empty lines.
54
+
55
+ Examples:
61
56
62
57
``` php
63
58
/**
@@ -76,11 +71,9 @@ interpreted as described in [RFC 2119][RFC2119].
76
71
$int++;
77
72
```
78
73
79
- or
80
-
81
74
``` php
82
75
/**
83
- * This class acts as an example on where to position a DocBlock.
76
+ * This class shows an example on where to position a DocBlock.
84
77
*/
85
78
class Foo
86
79
{
@@ -102,9 +95,10 @@ interpreted as described in [RFC 2119][RFC2119].
102
95
}
103
96
```
104
97
105
- It is NOT RECOMMENDED to use compound definitions for Constants or Properties, since the
106
- handling of DocBlocks in these situations can lead to unexpected results. If compound statement is
107
- used each element SHOULD have a preceding DocBlock.
98
+ It is NOT RECOMMENDED to use compound definitions for constants or properties,
99
+ since the handling of DocBlocks in these situations can lead to unexpected
100
+ results. If a compound statement is used, each element SHOULD have a preceding
101
+ DocBlock.
108
102
109
103
Example:
110
104
@@ -133,9 +127,8 @@ interpreted as described in [RFC 2119][RFC2119].
133
127
- end with ` */ ` and
134
128
- have zero or more lines in between.
135
129
136
- In the case where a DocComment spans multiple lines, every line MUST start with
137
- an asterisk (` * ` ) that SHOULD be aligned with the first asterisk of the
138
- opening clause.
130
+ When a DocComment spans multiple lines, every line MUST start with an asterisk
131
+ (` * ` ) that SHOULD be aligned with the first asterisk of the opening clause.
139
132
140
133
Single line example:
141
134
@@ -154,19 +147,18 @@ interpreted as described in [RFC 2119][RFC2119].
154
147
* "DocBlock" is a "DocComment" containing a single "PHPDoc" structure and
155
148
represents the basic in-source representation.
156
149
157
- * "Tag" is a single piece of meta information regarding a "Structural Element"
158
- or a component thereof.
150
+ * "Tag" is a single piece of meta information regarding a "Structural Element".
159
151
160
152
* "Type" is the determination of what type of data is associated with an element.
161
- This is commonly used when determining the exact values of arguments, constants,
162
- properties and more .
153
+ This is used to determine the exact data type (primitive, class, object) of
154
+ arguments, properties, constants, etc .
163
155
164
156
See Appendix A for more detailed information about types.
165
157
166
158
* "FQSEN" is an abbreviation for Fully Qualified Structural Element Name. This
167
159
notation expands on the Fully Qualified Class Name and adds a notation to
168
- identify class/ interface/ trait members and re-apply the principles of the FQCN
169
- to Interfaces, Traits, Functions and global Constants.
160
+ identify class / interface / trait members and re-apply the principles of the
161
+ FQCN to Interfaces, Traits, Functions and global Constants.
170
162
171
163
The following notations can be used per type of "Structural Element":
172
164
@@ -180,8 +172,7 @@ interpreted as described in [RFC 2119][RFC2119].
180
172
- * Property* : ` \My\Space\MyClass::$my_property `
181
173
- * Class Constant* : ` \My\Space\MyClass::MY_CONSTANT `
182
174
183
- A FQSEN has the following [ ABNF] [ RFC5234 ]
184
- definition:
175
+ A FQSEN has the following [ ABNF] [ RFC5234 ] definition:
185
176
186
177
FQSEN = fqnn / fqcn / constant / method / property / function
187
178
fqnn = "\" [name] *("\" [name])
@@ -197,12 +188,11 @@ interpreted as described in [RFC 2119][RFC2119].
197
188
* A PHPDoc MUST always be contained in a "DocComment"; the combination of these
198
189
two is called a "DocBlock".
199
190
200
- * A DocBlock MUST directly precede a "Structural Element"
191
+ * A DocBlock MUST directly precede a "Structural Element".
201
192
202
193
## 5. The PHPDoc Format
203
194
204
- The PHPDoc format has the following [ ABNF] [ RFC5234 ]
205
- definition:
195
+ The PHPDoc format has the following [ ABNF] [ RFC5234 ] definition:
206
196
207
197
PHPDoc = [summary [description]] [tags]
208
198
eol = [CR] LF ; to compatible with PSR-12
@@ -223,21 +213,18 @@ Examples of use are included in chapter 5.4.
223
213
### 5.1. Summary
224
214
225
215
A Summary MUST contain an abstract of the "Structural Element" defining the
226
- purpose. It is RECOMMENDED for Summaries to span a single line or at most two,
227
- but not more than that.
216
+ purpose. It is RECOMMENDED for Summaries to span a single line or two, but not
217
+ more than that.
228
218
229
- A Summary MUST end with two sequential line breaks, unless it is the only content
230
- in the PHPDoc.
219
+ A Summary MUST end with two sequential line breaks, unless it is the only
220
+ content in the PHPDoc.
231
221
232
222
If a Description is provided, then it MUST be preceded by a Summary. Otherwise
233
- the Description will be considered the Summary, until the end of the Summary
234
- is reached.
235
-
236
- Because a Summary is comparable to a chapter title, it is beneficial to use as
237
- little formatting as possible. As such, contrary to the Description (see next
238
- chapter), no recommendation is done to support a mark-up language. It is
239
- explicitly left up to the implementing application whether it wants to support
240
- this or not.
223
+ the Description risks being mistaken as the Summary.
224
+
225
+ Because a Summary is comparable to a chapter title, it is RECOMMENDED to use as
226
+ little formatting as possible. Contrary to the Description, no recommendation is
227
+ made to support a mark-up language.
241
228
242
229
### 5.2. Description
243
230
0 commit comments