16
16
shorthand);
17
17
* Inline hyperlinks are **not ** used. Seperate the link and their target
18
18
definition, which you add on the bottom of the page;
19
+ * Inline markup should be closed on the same line as the open-string;
19
20
* You should use a form of *you * instead of *we *.
20
21
21
22
Example
@@ -26,8 +27,8 @@ Example
26
27
Example
27
28
=======
28
29
29
- When you are working on the docs, you should follow the `Symfony Docs`_
30
- standards.
30
+ When you are working on the docs, you should follow the
31
+ `Symfony Documentation`_ standards.
31
32
32
33
Level 2
33
34
-------
@@ -43,7 +44,7 @@ Example
43
44
44
45
echo 'You cannot use the :: shortcut here';
45
46
46
- .. _`Symfony Docs `: http://symfony.com/doc/current/contributing/documentation/standards.html
47
+ .. _`Symfony Documentation `: http://symfony.com/doc/current/contributing/documentation/standards.html
47
48
48
49
Code Examples
49
50
-------------
@@ -60,6 +61,11 @@ Code Examples
60
61
* Description of the folded code: (optional)
61
62
If you fold several lines: the description of the fold can be placed after the ``... ``
62
63
If you fold only part of a line: the description can be placed before the line;
64
+ * If useful to the reader, a PHP code example should start with the namespace
65
+ declaration;
66
+ * When referencing classes, be sure to show the ``use `` statements at the
67
+ top of your code block. You don't need to show *all * ``use `` statements
68
+ in every example, just show what is actually being used in the code block;
63
69
* If useful, a ``codeblock `` should begin with a comment containing the filename
64
70
of the file in the code block. Don't place a blank line after this comment,
65
71
unless the next line is also a comment;
@@ -82,8 +88,11 @@ Example
82
88
.. code-block :: php
83
89
84
90
// src/Foo/Bar.php
91
+ namespace Foo;
85
92
93
+ use Acme\Demo\Cat;
86
94
// ...
95
+
87
96
class Bar
88
97
{
89
98
// ...
@@ -93,9 +102,11 @@ Example
93
102
// set foo with a value of bar
94
103
$foo = ...;
95
104
105
+ $cat = new Cat($foo);
106
+
96
107
// ... check if $bar has the correct value
97
108
98
- return $foo ->baz($bar, ...);
109
+ return $cat ->baz($bar, ...);
99
110
}
100
111
}
101
112
0 commit comments