Skip to content

Commit c85509e

Browse files
authored
Merge pull request #1315 from ashnazg/mynotes
Various Revisions
2 parents c2eaf72 + 81abb4d commit c85509e

File tree

2 files changed

+43
-46
lines changed

2 files changed

+43
-46
lines changed

proposed/phpdoc-tags.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,6 @@ single parameter of a function or method. When provided it MUST contain a
604604
@param tags are omitted due to all useful info already being visible in the
605605
code signature itself. The description is OPTIONAL yet RECOMMENDED.
606606

607-
The @param tag MAY have a multi-line description and does not need explicit
608-
delimiting.
609-
610607
It is RECOMMENDED when documenting to use this tag with every function and
611608
method.
612609

@@ -693,16 +690,10 @@ function or method. When provided, it MUST contain a "Type"
693690
to indicate what is returned; the description on the other hand is OPTIONAL yet
694691
RECOMMENDED in case of complicated return structures, such as associative arrays.
695692

696-
The @return tag MAY have a multi-line description and does not need explicit
697-
delimiting.
698-
699-
It is RECOMMENDED to use this tag with every function and method. An exception to
700-
this recommendation, as defined by the Coding Standard of any individual project,
701-
MAY be:
702-
703-
**functions and methods without a `return` value**: the @return tag MAY be
704-
omitted here, in which case an interpreter MUST interpret this as if
705-
`@return void` is provided.
693+
It is RECOMMENDED to use this tag with every function and method.
694+
If no `@return` type is given, and no return type declaration is provided in
695+
the code signature, an interpreter MUST interpret this as if `@return mixed`
696+
is provided.
706697

707698
This tag MUST NOT occur more than once in a "DocBlock" and is limited to the
708699
"DocBlock" of a "Structural Element" of a method or function.
@@ -748,9 +739,7 @@ element (also called the "FQSEN").
748739
A URI MUST be complete and well-formed as specified in [RFC 2396][RFC2396].
749740

750741
The @see tag SHOULD have a description to provide additional information
751-
regarding the relationship between the element and its target. Additionally, the
752-
@see tag MAY have a tag specialization to add further definition to this
753-
relationship.
742+
regarding the relationship between the element and its target.
754743

755744
#### Examples
756745

@@ -789,8 +778,8 @@ This information can be used to generate a set of API Documentation where the
789778
consumer is informed which application version is necessary for a specific
790779
element.
791780

792-
The @since tag SHOULD NOT be used to show the current version of an element, the
793-
@version tag MAY be used for that purpose.
781+
The @since tag SHOULD NOT be used to show the current version of an element...
782+
the @version tag SHOULD be used for that purpose.
794783

795784
#### Examples
796785

@@ -901,28 +890,24 @@ Indicates whether the current "Structural Element" consumes the
901890

902891
#### Syntax
903892

904-
@uses [file | "FQSEN"] [<description>]
893+
@uses ["FQSEN"] [<description>]
905894

906895
#### Description
907896

908-
The `@uses` tag describes whether any part of the associated "Structural Element"
909-
uses, or consumes, another "Structural Element" or a file that is situated in
897+
The `@uses` tag describes whether any part of the associated "Structural
898+
Element" uses, or consumes, another "Structural Element" that is situated in
910899
the current project.
911900

912901
When defining a reference to another "Structural Element" you can refer to a
913902
specific element by appending a double colon and providing the name of that
914903
element (also called the "FQSEN").
915904

916-
Files that are contained in this project can be referred to by this tag. This
917-
can be used, for example, to indicate a relationship between a Controller and
918-
a template file (as View).
919-
920905
This tag MUST NOT be used to indicate relations to elements outside of the
921906
system, so URLs are not usable. To indicate relations with outside elements the
922907
@see tag can be used.
923908

924909
Applications consuming this tag, such as generators, are RECOMMENDED to provide
925-
a `@used-by` tag on the destination element. This can be used to provide a
910+
a `@usedby` tag on the destination element. This can be used to provide a
926911
bi-directional experience and allow for static analysis.
927912

928913
#### Examples
@@ -969,9 +954,9 @@ Each Constant or Property definition or Variable where the type is ambiguous
969954
or unknown SHOULD be preceded by a DocBlock containing the @var tag. Any
970955
other variable MAY be preceded with a DocBlock containing the @var tag.
971956

972-
The @var tag MUST contain the name of the element it documents. An exception
973-
to this is when property declarations only refer to a single property. In this
974-
case the name of the property MAY be omitted.
957+
The @var tag MUST contain the name of the element it documents, unless this
958+
property declaration only refers to a single property. In this case the name of
959+
the property MAY be omitted.
975960

976961
`element_name` is used when compound statements are used to define a series of Constants
977962
or Properties. Such a compound statement can only have one DocBlock while several
@@ -992,7 +977,9 @@ Or:
992977
```php
993978
class Foo
994979
{
995-
/** @var string|null Should contain a description */
980+
/**
981+
* @var string|null Should contain a description
982+
*/
996983
protected $description = null;
997984

998985
public function setDescription($description)
@@ -1015,7 +1002,20 @@ foreach ($connections as $sqlite) {
10151002
}
10161003
```
10171004

1018-
Even compound statements may be documented:
1005+
Even compound statements may be documented... these two property blocks are
1006+
equivalent:
1007+
1008+
```php
1009+
class Foo
1010+
{
1011+
/**
1012+
* @var string $name Should contain a description
1013+
* @var string $description Should contain a description
1014+
*/
1015+
protected $name, $description;
1016+
1017+
}
1018+
```
10191019

10201020
```php
10211021
class Foo

proposed/phpdoc.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ interpreted as described in [RFC 2119][RFC2119].
5858
* "Structural Element" is a collection of Programming Constructs which MAY be
5959
preceded by a DocBlock. The collection contains the following constructs:
6060

61-
* require(_once)
62-
* include(_once)
61+
* require(\_once)
62+
* include(\_once)
6363
* class
6464
* interface
6565
* trait
@@ -76,10 +76,19 @@ interpreted as described in [RFC 2119][RFC2119].
7676
Example:
7777

7878
```php
79+
/**
80+
* This is a counter.
81+
* @var int $int
82+
*/
83+
$int = 0;
84+
7985
/** @var int $int This is a counter. */
8086
$int = 0;
8187

82-
// there should be no docblock here
88+
/* comment block... this is not a docblock */
89+
$int++;
90+
91+
// single line comment... this is not a docblock
8392
$int++;
8493
```
8594

@@ -134,18 +143,6 @@ interpreted as described in [RFC 2119][RFC2119].
134143
the variable in a foreach explicitly; several IDEs use this information to
135144
assist their auto-completion functionality.
136145

137-
This Standard does not cover this specific instance, as a `foreach` statement
138-
is considered to be a "Control Flow" statement rather than a "Structural Element".
139-
140-
```php
141-
/** @var \Sqlite3 $sqlite */
142-
foreach ($connections as $sqlite) {
143-
// there should be no docblock here
144-
$sqlite->open('/my/database/path');
145-
<...>
146-
}
147-
```
148-
149146
* "DocComment" is a special type of comment which MUST
150147

151148
- start with the character sequence `/**` followed by a whitespace character

0 commit comments

Comments
 (0)