Skip to content

Commit a3b155d

Browse files
Fix ABNF in phpdoc.md
- Description can exists without summary (`PHPDoc` rule) - `eol` rule added to be compatible with PSR-12 - Summary can't be empty (`summary` rule) - No spaces before `tag-signature` (`tag-details` rule) - Fix invalid definition of `keyword` rule - Description can contain line tags and can't be empty (`tag-description` rule)
1 parent 4685299 commit a3b155d

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

proposed/phpdoc.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ interpreted as described in [RFC 2119][RFC2119].
205205
FQSEN = fqnn / fqcn / constant / method / property / function
206206
fqnn = "\" [name] *("\" [name])
207207
fqcn = fqnn "\" name
208-
constant = (fqnn "\" / fqcn "::") name
208+
constant = ((fqnn "\") / (fqcn "::")) name
209209
method = fqcn "::" name "()"
210210
property = fqcn "::$" name
211211
function = fqnn "\" name "()"
@@ -223,17 +223,18 @@ interpreted as described in [RFC 2119][RFC2119].
223223
The PHPDoc format has the following [ABNF][RFC5234]
224224
definition:
225225

226-
PHPDoc = [summary] [description] [tags]
227-
summary = *CHAR (2*CRLF)
228-
description = 1*(CHAR / inline-tag) 1*CRLF ; any amount of characters
226+
PHPDoc = [summary [description]] [tags]
227+
eol = [CR] LF ; to compatible with PSR-12
228+
summary = 1*CHAR 2*eol
229+
description = 1*(CHAR / inline-tag) 1*eol ; any amount of characters
229230
; with inline tags inside
230-
tags = *(tag 1*CRLF)
231+
tags = *(tag 1*eol)
231232
inline-tag = "{" tag "}"
232233
tag = "@" tag-name [":" tag-specialization] [tag-details]
233234
tag-name = (ALPHA / "\") *(ALPHA / DIGIT / "\" / "-" / "_")
234235
tag-specialization = 1*(ALPHA / DIGIT / "-")
235-
tag-details = *SP (SP tag-description / tag-signature )
236-
tag-description = 1*(CHAR / CRLF)
236+
tag-details = (1*SP tag-description) / tag-signature
237+
tag-description = (CHAR / inline-tag) *(CHAR / inline-tag / eol)
237238
tag-signature = "(" *tag-argument ")"
238239
tag-argument = *SP 1*CHAR [","] *SP
239240

@@ -481,8 +482,8 @@ A Type has the following [ABNF][RFC5234] definition:
481482
array-expression = "(" type-expression ")"
482483
class-name = ["\"] label *("\" label)
483484
label = (ALPHA / %x7F-FF) *(ALPHA / DIGIT / %x7F-FF)
484-
keyword = "array" / "bool" / "callable" / "false" / "float" / "int" / "iterable" / "mixed" / "null" / "object" /
485-
keyword = "resource" / "self" / "static" / "string" / "true" / "void" / "$this" / "never"
485+
keyword = "array" / "bool" / "callable" / "false" / "float" / "int" / "iterable" / "mixed" / "never"
486+
keyword =/ "null" / "object" / "resource" / "self" / "static" / "string" / "true" / "void" / "$this"
486487

487488
### Details
488489

0 commit comments

Comments
 (0)