Skip to content

Commit d3c0a28

Browse files
committed
Improve grammar to make the spec clearer.
1 parent ea860a0 commit d3c0a28

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

proposed/phpdoc.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ PSR-5: PHPDoc
1919

2020
## 1. Introduction
2121

22-
The purpose of the PSR is to provide a formal definition of the PHPDoc standard.
22+
This PSR defines a formal specification for the PHPDoc standard.
2323

2424
## 2. Conventions Used In This Document
2525

@@ -49,7 +49,7 @@ interpreted as described in [RFC 2119][RFC2119].
4949

5050
It is RECOMMENDED to precede a "Structural Element" with a DocBlock where it
5151
is defined. It is common practice to have the DocBlock precede a Structural
52-
Element but it MAY also be separated by any number of empty lines.
52+
Element, but it MAY also be separated by any number of empty lines.
5353

5454
Examples:
5555

@@ -116,7 +116,7 @@ interpreted as described in [RFC 2119][RFC2119].
116116
}
117117
```
118118

119-
* "DocComment" is a special type of comment which MUST
119+
* "DocComment" is a special type of comment that MUST
120120

121121
- start with the character sequence `/**` followed by a whitespace character
122122
- end with `*/` and
@@ -156,7 +156,7 @@ interpreted as described in [RFC 2119][RFC2119].
156156
The PHPDoc format has the following [ABNF][RFC5234] definition:
157157

158158
PHPDoc = [summary [description]] [tags]
159-
eol = [CR] LF ; to compatible with PSR-12
159+
eol = [CR] LF ; to be compatible with PSR-12
160160
summary = 1*CHAR 2*eol
161161
description = 1*(CHAR / inline-tag) 1*eol ; any amount of characters
162162
; with inline tags inside
@@ -173,7 +173,7 @@ Examples of use are included in chapter 5.4.
173173

174174
### 5.1. Summary
175175

176-
A Summary MUST contain an abstract of the "Structural Element" defining the
176+
A Summary MUST provide an abstract of the "Structural Element" defining the
177177
purpose. It is RECOMMENDED for Summaries to span a single line or two, but not
178178
more than that.
179179

@@ -183,17 +183,16 @@ content in the PHPDoc.
183183
If a Description is provided, then it MUST be preceded by a Summary. Otherwise
184184
the Description risks being mistaken as the Summary.
185185

186-
Because a Summary is comparable to a chapter title, it is RECOMMENDED to use as
187-
little formatting as possible. Contrary to the Description, no recommendation is
188-
made to support a mark-up language.
186+
Because a Summary is comparable to a chapter title, it is NOT RECOMMENDED to use formatting.
187+
Contrary to the Description, no recommendation is made to support Markdown.
189188

190189
### 5.2. Description
191190

192191
The Description is OPTIONAL but SHOULD be included when the "Structural Element"
193192
contains more complexity than can be described by the Summary alone.
194193

195194
Any application parsing the Description is RECOMMENDED to support the
196-
Markdown mark-up language, to make it possible for the author to provide
195+
Markdown language, to make it possible for the author to provide
197196
formatting and a clear way of representing code examples.
198197

199198
Common uses for the Description:
@@ -215,11 +214,10 @@ tags with the same syntax. An inline tag MUST start with `{@` and MUST with `}`
215214
*/
216215
```
217216

218-
Inline tags are only covering regular tags and SHALL NOT cover _Annotation_ tags.
217+
Inline tags MAY only represent regular tags and SHALL NOT represent _Annotation_ tags.
219218

220219
As inline tags are always closed with a `}` developers cannot use this char in a
221-
description. To overcome this issue parsers MUST support escape char `{` followed
222-
by `}` to be interpreted as a single `}`
220+
description. To overcome this issue parsers MUST support escape sequence of `{` followed by `}` MUST be interpreted as a literal closing brace.
223221

224222
```php
225223
/**
@@ -231,9 +229,8 @@ by `}` to be interpreted as a single `}`
231229

232230
### 5.3. Tags
233231

234-
Tags supply concise metadata for a "Structural Element". Each tag starts on a
235-
new line, followed by an at-sign (`@`) and a tag-name, followed by whitespace and
236-
metadata (including a description).
232+
Tags supply concise metadata for a "Structural Element". Each tag MUST start on a
233+
new line, followed by an at-sign (`@`) and a tag-name, then optional whitespace and metadata.
237234

238235
If metadata is provided, it MAY span multiple lines and COULD follow a strict
239236
format, as dictated by the specific tag.
@@ -263,7 +260,7 @@ This definition does NOT apply to _Annotation_ tags, which are not in scope.
263260

264261
#### 5.3.1 Tag Specialization
265262

266-
Tag specialization give a scope to the tag. It is RECOMMENDED to follow the
263+
Tag specialization defines a scope for the tag. It is RECOMMENDED to follow the
267264
list of tags in the tag [Tag Catalog PSR][TAG_PSR]. But the metadata of specialized
268265
tags MAY differ from the list.
269266

@@ -284,7 +281,7 @@ Tag names indicate what type of information is represented by this tag.
284281
Whitespace handling for parsing DocBlocks MUST follow these rules:
285282

286283
- Leading and trailing whitespace characters (spaces, tabs) on each line MUST be ignored.
287-
- Lines in descriptions or tag metadata MAY contain multiple whitespace characters between words, but the number of spaces MUST NOT affect interpretation.
284+
- Lines in descriptions or tag metadata MAY contain multiple whitespace characters between words, but varying amounts of whitespace MUST NOT alter the meaning.
288285
For example: `@param string $var` is semantically equivalent to `@param string $var`
289286

290287
- A description MAY contain empty lines. These are preserved as part of the Markdown block and MUST NOT be interpreted as ending the description.

0 commit comments

Comments
 (0)