Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
796b9d9
Submit PHPDoc proposal and meta-document
mvriel Aug 5, 2013
1572a8b
textual changes from first pass review
ashnazg Aug 5, 2013
ad2a261
textual changes from second pass review
ashnazg Aug 5, 2013
853f44b
Merge pull request #1 from ashnazg/chuck-review
mvriel Aug 5, 2013
6d1451d
Added Donald Gilbert as sponsor for phpdoc
mvriel Aug 6, 2013
fc11367
Merge branch 'master' of github.com:phpDocumentor/fig-standards
mvriel Aug 6, 2013
27d90d3
Fix indenting issues
Seldaek Aug 13, 2013
e5097b4
Merge pull request #8 from Seldaek/patch
mvriel Aug 13, 2013
5c56bd9
Remove extraneous lines from null keyword example
joncave Aug 17, 2013
99dad5c
Don't use single type notation for mixed type arrays
joncave Aug 17, 2013
f8d5382
Merge pull request #11 from joncave/patch-1
mvriel Aug 17, 2013
cb518e8
Merge pull request #12 from joncave/patch-2
mvriel Aug 17, 2013
7b41a17
Fixing internal links to the tags
JDGrimes Aug 20, 2013
87623ec
#6: Add Generics notation description and refactor ABNF
mvriel Aug 20, 2013
2b4ff37
Merge branch 'master' of github.com:phpDocumentor/fig-standards
mvriel Aug 20, 2013
c640add
Merge pull request #13 from JDGrimes/patch-1
mvriel Aug 20, 2013
b3c9f8a
Merge branch 'master' of github.com:phpDocumentor/fig-standards
mvriel Aug 20, 2013
9b232fb
Update PSR number to PSR-5
mvriel Aug 29, 2013
761afeb
#16: Improve definition of DocComment and object
mvriel Sep 4, 2013
a7c09ca
#16: Update Type ABNF according to the suggestion of @nikic
mvriel Sep 4, 2013
1853628
Fix nested lists
GaryJones Sep 23, 2013
2d6149d
Fix typo
GaryJones Sep 23, 2013
dd20d56
Use File-Level, not Page-Level, for consistency
GaryJones Sep 24, 2013
8556da6
Update @return tag exceptions for constructors, fixes #18
Oct 10, 2013
9748de1
Merge branch 'master' of https://github.com/php-fig/fig-standards
mvriel Oct 11, 2013
a0f9141
Reword PSR-4 to be more verbose and complete
mvriel Oct 11, 2013
0e75d8a
Change indentation to MD format
mvriel Oct 11, 2013
b26791d
Fix numbering
mvriel Oct 11, 2013
ff1ae19
Merge pull request #31 from alexrussell/patch-1
mvriel Nov 1, 2013
1b68927
Merge pull request #29 from GaryJones/patch-5
mvriel Nov 1, 2013
f717b2b
Merge pull request #25 from GaryJones/patch-2
mvriel Nov 2, 2013
31d593c
Merge pull request #23 from GaryJones/patch-1
mvriel Nov 2, 2013
7b822dd
Fixes #34: altered special exception for @return
mvriel Nov 29, 2013
c54bc1f
#36 Addresses an ambiguous example
mvriel Nov 29, 2013
36e82be
Merge branch 'master' of https://github.com/php-fig/fig-standards
mvriel Dec 4, 2013
365d1a1
Removed meta-information as that is already, or should be, in the met…
mvriel Dec 4, 2013
1d6b650
Removed erroneous TOC entry
mvriel Dec 4, 2013
eac8337
Refactored the @type definition according to recent discussions
mvriel Dec 4, 2013
78c73ec
#36 Adjusted ABNF to allows line breaks in tag descriptions
mvriel Dec 4, 2013
0f90737
#36 Clarified the structure of a tag by describing the parts and that…
mvriel Dec 4, 2013
2e1b505
Fix typo
mvriel Dec 4, 2013
520e410
Clarify that @var is not as much an alias of @type
mvriel Dec 4, 2013
1df2582
#2 describe @see in more detail and add deprecation of @link
mvriel Dec 4, 2013
065e65b
Add markdown as requirement for tag descriptions
mvriel Dec 7, 2013
44519fd
Add markdown as requirement for tag descriptions
mvriel Dec 7, 2013
051d5f9
Merge branch 'master' of https://github.com/php-fig/fig-standards
mvriel Mar 25, 2014
8fe3d42
Introduced Summary
mvriel Mar 25, 2014
db15c21
Fixes #3: Add Inline PHPDoc description
mvriel Mar 25, 2014
cbf58ef
consolidate the two FQSEN definitions;
ashnazg Mar 29, 2014
ed9e863
'annotation' is a defined term, so use 'name' here;
ashnazg Mar 29, 2014
a3dacae
Change meaning of @deprecated version and add a second machine-readab…
sun May 18, 2014
f001ebe
Specify @deprecated versions as a range, delimited by a colon.
sun May 20, 2014
4319c6c
Merge pull request #46 from ashnazg/nameNotAnnotation
mvriel May 24, 2014
68bc885
Merge pull request #45 from ashnazg/dupeFQSEN
mvriel May 24, 2014
604e15c
Revised @deprecated tag description using explicit 'starting version'…
sun May 24, 2014
8e272d4
Revised @deprecated to clarify that the stated 'ending version' is ex…
sun May 24, 2014
f9fccfa
Added description and some discussion on tag specializations
May 29, 2014
adc0241
Improved layout of tag specialization docs
May 29, 2014
d44d6c7
Merge pull request #51 from chrishoult/feature/tag-specialization-docs
mvriel Jun 6, 2014
40f9b13
Fixed synposis + description of `@license`.
sun Jun 6, 2014
1d07566
Add typedef tag
mvriel Jul 15, 2014
61c695c
Reverted @type to @var and changed compound @var notation to match PHPs
mvriel Aug 8, 2014
a015038
Fixed chapter numbering
mvriel Aug 8, 2014
1d20343
Added a text explaining how to recognize the File-level DocBlock
mvriel Aug 15, 2014
4f4b640
Clarified the paragraph on File-level DocBlocks
mvriel Aug 15, 2014
8a6a2ff
Clean-up of all external hyperlinks.
Fleshgrinder Nov 23, 2014
ca1477e
Be more specific about static in PHPDoc vs. PHP
Fleshgrinder Nov 23, 2014
30fdbb2
Formatting
Fleshgrinder Nov 23, 2014
4f588d7
Merge branch 'master' of https://github.com/php-fig/fig-standards
mvriel Dec 9, 2014
5317d4f
Merge pull request #50 from sun/psr5-deprecated
mvriel Dec 9, 2014
eda5e92
Merge pull request #52 from sun/license
mvriel Dec 9, 2014
0633623
Post-process @license edit
mvriel Dec 9, 2014
143e8d8
Merge pull request #54 from phpDocumentor/features/typedef
mvriel Dec 9, 2014
a63e95f
Merge pull request #55 from phpDocumentor/features/type-to-var
mvriel Dec 9, 2014
04b3e73
Merge pull request #66 from Fleshgrinder/master
mvriel Dec 9, 2014
f650a15
Add paragraph with summary to clearly indicate no explicit recommenda…
mvriel Dec 9, 2014
6861e37
#68: Add clause that an empty line is allowed between a DocBlock and …
mvriel Dec 17, 2014
46e4e4e
phpdoc.md - make TOC clickable
Feb 19, 2015
b3f503f
Merge pull request #70 from TomasVotruba/patch-1
mvriel Mar 3, 2015
e287633
Remove Style recommendation
mvriel Mar 4, 2015
0379e00
Fix small typo in @since example
Mar 6, 2015
5f209f9
Fixed scalar types
GrahamCampbell Mar 25, 2015
38222fe
"is it NOT" to "it is NOT"
Rarst Mar 25, 2015
b293909
Merge pull request #74 from Rarst/patch-1
mvriel Mar 26, 2015
5b68085
Merge pull request #73 from GrahamCampbell/patch-1
mvriel Mar 26, 2015
d6b9e48
Fixed an unclosed docblock
GrahamCampbell Mar 26, 2015
eca33f8
Fixed a typo
GrahamCampbell Mar 26, 2015
2726c89
Merge pull request #75 from GrahamForks/patch-1
mvriel Mar 26, 2015
d486bad
fix @version example
Wes1262 May 2, 2015
b55176c
Merge branch 'master' of git://github.com/php-fig/fig-standards
mvriel Jun 5, 2015
63af227
Update phpdoc.md
gerardroche Jul 20, 2015
da00906
Merge pull request #71 from nueckman/patch-1
mvriel Aug 14, 2015
d27159e
Merge pull request #78 from WesNetmo/master
mvriel Aug 14, 2015
8abaef4
Merge pull request #84 from gerardroche/patch-1
mvriel Aug 14, 2015
e8ae204
Merge branch 'master' of git://github.com/php-fig/fig-standards
mvriel Aug 14, 2015
695b38a
Merge branch 'master' of github.com:phpDocumentor/fig-standards
mvriel Aug 14, 2015
3b425d1
Removed contentious sections and other various updates
mvriel Dec 10, 2015
ead19fb
Fix typo in table of contents
spiegelm Feb 24, 2016
b994d85
Merge pull request #126 from spiegelm/patch-1
mvriel Feb 26, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#6: Add Generics notation description and refactor ABNF
  • Loading branch information
mvriel committed Aug 20, 2013
commit 87623ece16097c391a9cf59287e0bbe6b4fff444
84 changes: 58 additions & 26 deletions proposed/phpdoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -1755,48 +1755,79 @@ class Foo

### ABNF

type-expression = 1*(array-of-type-expression|array-of-type|type ["|"])
array-of-type-expression = "(" type-expression ")[]"
array-of-type = type "[]"
type = class-name|keyword
class-name = 1*CHAR
keyword = "string"|"integer"|"int"|"boolean"|"bool"|"float"
|"double"|"object"|"mixed"|"array"|"resource"
|"void"|"null"|"callable"|"false"|"true"|"self"
|"static"|"$this"
A Type has the following [ABNF][RFC5234] definition:

### Additional details
; the vertical bar sign in the type-expression MUST be used as separator when multiple elements are used
type-expression = 1*((array / type) ["|"])
array = "array" / (type / array-expression / array) "[]" / generic
type = class-name / keyword
array-expression = "(" type-expression ")"
generic = collection-type "<" [type-expression "," *1SP] type-expression">"
collection-type = class-name / "array"
class-name = 1*ALPHA *(ALPHA / "_" / "\")
keyword = "string" / "integer" / "int" / "boolean" / "bool" / "float" / "double" / "object"
keyword =/ "mixed" / "resource" / "void" / "null" / "callable" / "false" / "true" / "self"
keyword =/ "static" / "$this"

When a "Type" is used the user will expect a value, or set of values, as
detailed below.
### Details

When the "Type" may consist of multiple types then these MUST be separated
with the vertical bar sign (|). Any application supporting this specification MUST
recognize this and split the "Type" before processing.
When a "Type" is used the user will expect a value, or set of values, as detailed below.

When the "Type" consists of multiple types then these MUST be separated with the vertical bar sign (|). Any
interpreter supporting this specification MUST recognize this and split the "Type" before evaluating.

For example: `@return int|null`

The value represented by "Type" can be an array. The type MUST be defined
following the format of one of the following options:
#### Arrays

The value represented by "Type" can be an array. The type MUST be defined following the format of one of the
following options:

1. unspecified, no definition of the contents of the represented array is given.
Example: `@return array`

2. specified containing a single type, the Type definition informs the reader of
the type of each array element. Only one type is then expected as element for
a given array.
2. specified containing a single type, the Type definition informs the reader of the type of each array value. Only one
type is then expected for each value in a given array.

Example: `@return int[]`

Please note that _mixed_ is also a single type and with this keyword it is
possible to indicate that each array element contains any possible type.
Please note that _mixed_ is also a single type and with this keyword it is possible to indicate that each array
value contains any possible type.

3. specified containing multiple types, the Type definition informs the reader
of the type of each array element. Each element can be of any of the given
types.
3. specified as containing multiple types, the Type definition informs the reader of the type of each array value.
Each value can be of any of the given types.
Example: `@return (int|string)[]`

The supported atomic types are either a *valid class name* or *keyword*.
4. specified using the Generics notation, see the next chapter "Collections" for a description on this notation.

#### Collections

The value represented by "Type" can also be a [Collection][COLLECTION], a class that contains a list of keys with
values. Collections can be denoted using a format derived from Generics in Java; as such aptly named Generics-style
notation.

With Generics-style notation it is REQUIRED to specify a class name, or the array keyword, followed by the type of
the values enclosed with angular brackets.

Example: to indicate that this element returns an object of class ArrayObject that only contains a series of strings.

@return \ArrayObject<string>

The type of the values in a Collection MAY be another array and even another Collection,

@return \ArrayObject<\ArrayObject<integer>>

A Collection MAY optionally define the type of the keys of said Collection by adding an additional type definition
between the angular brackets before the identifier denoting the values' type. These two should be separated by a comma.

Example: to declare an ArrayObject collection containing a list of strings with integer keys.

@return \ArrayObject<integer, string>

The type of a value, or key, MAY consist of several different types, this can be represented by separating each
individual type with a vertical bar sign between the angular brackets.

@return \ArrayObject<string|boolean>

### Valid Class Name

Expand Down Expand Up @@ -2004,3 +2035,4 @@ The following keywords are recognized by this PSR:
[DEFACTO]: http://www.phpdoc.org/docs/1.4/index.html
[PHPDOC.ORG]: http://www.phpdoc.org
[FLUENT]: http://en.wikipedia.org/wiki/Fluent_interface
[COLLECTION]: http://en.wikipedia.org/wiki/Collection_(abstract_data_type)