Skip to content

Commit d09b00c

Browse files
committed
Merge pull request symfony#2994 from WouterJ/namespace_standards
Added some doc standards
2 parents ae5a6d2 + 8d95119 commit d09b00c

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

contributing/documentation/standards.rst

+14-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Sphinx
1616
shorthand);
1717
* Inline hyperlinks are **not** used. Seperate the link and their target
1818
definition, which you add on the bottom of the page;
19+
* Inline markup should be closed at the same line as the open-string;
1920
* You should use a form of *you* instead of *we*.
2021

2122
Example
@@ -26,8 +27,8 @@ Example
2627
Example
2728
=======
2829
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.
3132
3233
Level 2
3334
-------
@@ -43,7 +44,7 @@ Example
4344
4445
echo 'You cannot use the :: shortcut here';
4546
46-
.. _`Symfony Docs`: http://symfony.com/doc/current/contributing/documentation/standards.html
47+
.. _`Symfony Documentation`: http://symfony.com/doc/current/contributing/documentation/standards.html
4748
4849
Code Examples
4950
-------------
@@ -60,6 +61,10 @@ Code Examples
6061
* Description of the folded code: (optional)
6162
If you fold several lines: the description of the fold can be placed after the ``...``
6263
If you fold only part of a line: the description can be placed before the line;
64+
* If usefull, a PHP file should start with the namespace declaration;
65+
* When using use statements, only the first code block of an article shows the
66+
full statement block. In further examples, this block is folded with a
67+
``// ...`` comment and only new use statements are displayed;
6368
* If useful, a ``codeblock`` should begin with a comment containing the filename
6469
of the file in the code block. Don't place a blank line after this comment,
6570
unless the next line is also a comment;
@@ -82,8 +87,11 @@ Example
8287
.. code-block:: php
8388
8489
// src/Foo/Bar.php
90+
namespace Foo;
8591
92+
use Acme\Demo\Cat;
8693
// ...
94+
8795
class Bar
8896
{
8997
// ...
@@ -93,9 +101,11 @@ Example
93101
// set foo with a value of bar
94102
$foo = ...;
95103
104+
$cat = new Cat($foo);
105+
96106
// ... check if $bar has the correct value
97107
98-
return $foo->baz($bar, ...);
108+
return $cat->baz($bar, ...);
99109
}
100110
}
101111

0 commit comments

Comments
 (0)