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