Skip to content

Commit 876470d

Browse files
committed
rewording / restyling
1 parent 32ab4ed commit 876470d

File tree

1 file changed

+36
-49
lines changed

1 file changed

+36
-49
lines changed

proposed/phpdoc.md

Lines changed: 36 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,22 @@ interpreted as described in [RFC 2119][RFC2119].
3737
> It is important to note that a PHPDoc and a DocBlock are two separate
3838
> entities. The DocBlock is the combination of a DocComment, which is a type
3939
> 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).
4141
42-
* "Structural Element" is a collection of Programming Constructs which MAY be
42+
* "Structural Element" is a collection of programming constructs which MAY be
4343
preceded by a DocBlock. The collection contains the following constructs:
4444

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)
5950

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:
6156

6257
```php
6358
/**
@@ -76,11 +71,9 @@ interpreted as described in [RFC 2119][RFC2119].
7671
$int++;
7772
```
7873

79-
or
80-
8174
```php
8275
/**
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.
8477
*/
8578
class Foo
8679
{
@@ -102,9 +95,10 @@ interpreted as described in [RFC 2119][RFC2119].
10295
}
10396
```
10497

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.
108102

109103
Example:
110104

@@ -133,9 +127,8 @@ interpreted as described in [RFC 2119][RFC2119].
133127
- end with `*/` and
134128
- have zero or more lines in between.
135129

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.
139132

140133
Single line example:
141134

@@ -154,19 +147,18 @@ interpreted as described in [RFC 2119][RFC2119].
154147
* "DocBlock" is a "DocComment" containing a single "PHPDoc" structure and
155148
represents the basic in-source representation.
156149

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".
159151

160152
* "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.
163155

164156
See Appendix A for more detailed information about types.
165157

166158
* "FQSEN" is an abbreviation for Fully Qualified Structural Element Name. This
167159
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.
170162

171163
The following notations can be used per type of "Structural Element":
172164

@@ -180,8 +172,7 @@ interpreted as described in [RFC 2119][RFC2119].
180172
- *Property*: `\My\Space\MyClass::$my_property`
181173
- *Class Constant*: `\My\Space\MyClass::MY_CONSTANT`
182174

183-
A FQSEN has the following [ABNF][RFC5234]
184-
definition:
175+
A FQSEN has the following [ABNF][RFC5234] definition:
185176

186177
FQSEN = fqnn / fqcn / constant / method / property / function
187178
fqnn = "\" [name] *("\" [name])
@@ -197,12 +188,11 @@ interpreted as described in [RFC 2119][RFC2119].
197188
* A PHPDoc MUST always be contained in a "DocComment"; the combination of these
198189
two is called a "DocBlock".
199190

200-
* A DocBlock MUST directly precede a "Structural Element"
191+
* A DocBlock MUST directly precede a "Structural Element".
201192

202193
## 5. The PHPDoc Format
203194

204-
The PHPDoc format has the following [ABNF][RFC5234]
205-
definition:
195+
The PHPDoc format has the following [ABNF][RFC5234] definition:
206196

207197
PHPDoc = [summary [description]] [tags]
208198
eol = [CR] LF ; to compatible with PSR-12
@@ -223,21 +213,18 @@ Examples of use are included in chapter 5.4.
223213
### 5.1. Summary
224214

225215
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.
228218

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.
231221

232222
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.
241228

242229
### 5.2. Description
243230

0 commit comments

Comments
 (0)