@@ -960,9 +960,9 @@ Each Constant or Property definition or Variable where the type is ambiguous
960
960
or unknown SHOULD be preceded by a DocBlock containing the @var tag. Any
961
961
other variable MAY be preceded with a DocBlock containing the @var tag.
962
962
963
- The @var tag SHOULD contain the name of the element it documents. An exception
964
- to this is when property declarations only refer to a single property. In this
965
- case the name of the property MAY be omitted.
963
+ The @var tag MUST contain the name of the element it documents, unless this
964
+ property declaration only refers to a single property. In this case the name of
965
+ the property MAY be omitted.
966
966
967
967
` element_name ` is used when compound statements are used to define a series of Constants
968
968
or Properties. Such a compound statement can only have one DocBlock while several
@@ -1000,15 +1000,28 @@ Another example is to document the variable in a foreach explicitly; many IDEs
1000
1000
use this information to help you with auto-completion:
1001
1001
1002
1002
``` php
1003
- /* @var \Sqlite3 $sqlite */
1003
+ /** @var \Sqlite3 $sqlite */
1004
1004
foreach ($connections as $sqlite) {
1005
1005
// there should be no docblock here
1006
1006
$sqlite->open('/my/database/path');
1007
1007
<...>
1008
1008
}
1009
1009
```
1010
1010
1011
- Even compound statements may be documented:
1011
+ Even compound statements may be documented... these two property blocks are
1012
+ equivalent:
1013
+
1014
+ ``` php
1015
+ class Foo
1016
+ {
1017
+ /**
1018
+ * @var string $name Should contain a description
1019
+ * @var string $description Should contain a description
1020
+ */
1021
+ protected $name, $description;
1022
+
1023
+ }
1024
+ ```
1012
1025
1013
1026
``` php
1014
1027
class Foo
0 commit comments