Skip to content

Commit 09685c3

Browse files
committed
Fix some issues with previous cs docs
1 parent b24c217 commit 09685c3

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

source/coding_standards/javascript.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Starting with GLPI 9.5.0, the target version was bumped to 6 (2015).
1313
Functions
1414
---------
1515

16-
Function names must be written in *camelCaps*:
16+
Function names must be written in *camelCase*:
1717

1818
.. code-block:: JavaScript
1919
@@ -37,7 +37,7 @@ Classes
3737

3838
If you are writing code for versions of GLPI before 9.5.0, you may not use classes as class support was added in EMCAScript 6.
3939

40-
Class names must be written in `PascalCase`.
40+
Class names must be written in *PascalCase*.
4141

4242
..code-block:: JavaScript
4343

source/coding_standards/php.rst

+14-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Arrays must be declared using the short notation syntax (``[]``), long notation
99
Including files
1010
---------------
1111

12-
Use ``include_once`` in order to include the file once and to raise warning if file does not exists:
12+
Use ``include_once`` in order to include the file once and to raise warning if file does not exist:
1313

1414
.. code-block:: php
1515
@@ -31,7 +31,7 @@ The PHP closing tag ``?>`` must be avoided on full PHP files (so in most of GLPI
3131
Functions
3232
---------
3333

34-
Function names must be written in *camelCaps*:
34+
Function names must be written in *camelCase*:
3535

3636
.. code-block:: php
3737
@@ -40,9 +40,9 @@ Function names must be written in *camelCaps*:
4040
//do something here!
4141
}
4242
43-
Space after opening parenthesis and before closing parenthesis are forbidden. For parematers which have a default value; add a space before and after the equel sign.
43+
Space after opening parenthesis and before closing parenthesis are forbidden. For parameters which have a default value, add a space before and after the equals sign.
4444

45-
If parameters add block doc for these parameters, please see the `Comments`_ section for any example.
45+
If the function has parameters, add doc block for these parameters. Please see the `Comments`_ section for an example.
4646

4747
If function from parent add
4848

@@ -51,7 +51,7 @@ If function from parent add
5151
<?php
5252
function getMenuContent()
5353
54-
If it's a new function, add in block doc (see the `Comments`_ section):
54+
If it's a new function, add the `@since` tag in the doc block (see the `Comments`_ section):
5555

5656
.. code-block:: php
5757
@@ -96,9 +96,9 @@ On the other hand; if you already have an object instance; you should better use
9696
Classes
9797
-------
9898

99-
Class names must be written in `CamelCase`:
99+
Class names must be written in *PascalCase*:
100100

101-
GLPI do not use `PHP namespaces <http://php.net/manual/en/language.namespaces.php>`_ right now; so be careful when creating new classes to take a name that does not exists yet.
101+
Most of the GLPI code does not use or support `PHP namespaces <http://php.net/manual/en/language.namespaces.php>`_ yet. Therefore, you will need to be careful when creating new classes to take a name that does not exists yet.
102102

103103
.. code-block:: php
104104
@@ -108,9 +108,9 @@ GLPI do not use `PHP namespaces <http://php.net/manual/en/language.namespaces.ph
108108
}
109109
110110
111-
Note: even if GLPI does not use namespaces, some libs does, you will have to take care of that. You can also if you wish use namespaces for PHP objects call.
111+
Note: You can use namespaces for PHP classes if you want, but you should be aware that there are some parts of the code that still don't support them. As a good rule, avoid using a namespaced class to extend CommonDBTM.
112112

113-
For example, the folloging code:
113+
For example, the following code:
114114

115115
.. code-block:: php
116116
@@ -137,6 +137,8 @@ Could also be written as (see the ``\``):
137137
...
138138
}
139139
140+
When referring to classes in another namespace you SHOULD use `use` statements instead of using the full name.
141+
140142
Comments
141143
--------
142144

@@ -170,9 +172,9 @@ For each method or function documentation, you'll need at least to have a descri
170172
//[...]
171173
}
172174
173-
Some other informations way be added; if the function requires it.
175+
Some other information may be added if the function requires it.
174176

175-
Refer to the `PHPDocumentor website <https://phpdoc.org/docs/latest>`_ to get more informations on documentation. The `latest GLPI API documentation <https://forge.glpi-project.org/projects/glpi/embedded/index.html>`_ is also available online.
177+
Refer to the `PHPDocumentor website <https://phpdoc.org/docs/latest>`_ to get more information on documentation. The `latest GLPI API documentation <https://forge.glpi-project.org/projects/glpi/embedded/index.html>`_ is also available online.
176178

177179
Please follow the order defined below:
178180

@@ -193,7 +195,7 @@ Parameters documentation
193195
Each parameter must be documented in its own line, begining with the ``@param`` tag, followed by the `Variables types`_, followed by the param name (``$param``), and finally with the description itself.
194196
If your parameter can be of different types, you can list them separated with a ``|`` or you can use the ``mixed`` type; it's up to you!
195197

196-
All parameters names and description must be aligned vertically on the longest (plu one character); see the above example.
198+
All parameters names and description must be aligned vertically on the longest (plus one character); see the above example.
197199

198200
Override method: @inheritDoc? @see? docblock? no docblock?
199201
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)