Skip to content

Commit 698e684

Browse files
committed
Add a section about whitespace handling
1 parent 067cf63 commit 698e684

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

proposed/phpdoc.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ PSR-5: PHPDoc
1414
- [5.3. Tags](#53-tags)
1515
- [5.3.1. Tag Specialization](#531-tag-specialization)
1616
- [5.3.2. Tag Name](#532-tag-name)
17-
- [5.4. Examples](#54-examples)
17+
- [5.4 whitespace handling](#54-whitespace-handling)
18+
- [5.5. Examples](#55-examples)
1819

1920
## 1. Introduction
2021

@@ -278,7 +279,22 @@ Parsers MAY ignore specialized tags when they are in a supported format.
278279

279280
Tag names indicate what type of information is represented by this tag.
280281

281-
### 5.4. Examples
282+
### 5.4. Whitespace Handling
283+
284+
Whitespace handling for parsing DocBlocks MUST follow these rules:
285+
286+
- 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.
288+
For example: `@param string $var` is semantically equivalent to `@param string $var`
289+
290+
- A description MAY contain empty lines. These are preserved as part of the Markdown block and MUST NOT be interpreted as ending the description.
291+
- A description ends when:
292+
- The DocBlock ends, or
293+
- A new tag starts (i.e., a line beginning with @)
294+
295+
In tag metadata, whitespace (space or tab) MAY delimit metadata components (e.g., type, variable name, description), but excessive whitespace MUST NOT change the meaning.
296+
297+
### 5.5. Examples
282298

283299
The following examples serve to illustrate the basic use of DocBlocks; it is
284300
advised to read through the list of tags in the [Tag Catalog PSR][TAG_PSR].

0 commit comments

Comments
 (0)