Skip to content

Commit 315a950

Browse files
committed
Removing empty section.
Adding docs for method chaining.
1 parent 5724934 commit 315a950

File tree

3 files changed

+24
-60
lines changed

3 files changed

+24
-60
lines changed

en/contributing.rst

-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ cover the various ways you can contribute to CakePHP:
1111
contributing/tickets
1212
contributing/code
1313
contributing/cakephp-coding-conventions
14-
contributing/articles
1514

en/contributing/articles.rst

-2
This file was deleted.

en/contributing/cakephp-coding-conventions.rst

+24-57
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ Indentation
1717

1818
One tab will be used for indentation.
1919

20-
So, indentation should look like this:
21-
22-
::
20+
So, indentation should look like this::
2321

2422
<?php
2523
// base level
@@ -29,10 +27,9 @@ So, indentation should look like this:
2927
// base level
3028
?>
3129

32-
Or:
33-
34-
::
30+
Or::
3531

32+
<?php
3633
$booleanVariable = true;
3734
$stringVariable = "moose";
3835
if ($booleanVariable) {
@@ -46,9 +43,7 @@ Control Structures
4643
==================
4744

4845
Control structures are for example "``if``", "``for``", "``foreach``",
49-
"``while``", "``switch``" etc. Below, an example with "``if``":
50-
51-
::
46+
"``while``", "``switch``" etc. Below, an example with "``if``"::
5247

5348
<?php
5449
if ((expr_1) || (expr_2)) {
@@ -58,7 +53,6 @@ Control structures are for example "``if``", "``for``", "``foreach``",
5853
} else {
5954
// default_action;
6055
}
61-
?>
6256

6357
* In the control structures there should be 1 (one) space before the
6458
first parenthesis and 1 (one) space between the last parenthesis and
@@ -87,7 +81,6 @@ Control structures are for example "``if``", "``for``", "``foreach``",
8781
if (expr) {
8882
statement;
8983
}
90-
?>
9184

9285
Ternary Operator
9386
----------------
@@ -96,10 +89,9 @@ Ternary operators are permissible when the entire ternary operation fits
9689
on one line. Longer ternaries should be split into ``if else``
9790
statements. Ternary operators should not ever be nested. Optionally
9891
parentheses can be used around the condition check of the ternary for
99-
clarity.
100-
101-
::
92+
clarity::
10293

94+
<?php
10395
//Good, simple and readable
10496
$variable = isset($options['variable']) ? $options['variable'] : true;
10597

@@ -111,23 +103,18 @@ Function Calls
111103

112104
Functions should be called without space between function's name and
113105
starting bracket. There should be one space between every parameter of a
114-
function call.
115-
116-
::
106+
function call::
117107

118108
<?php
119109
$var = foo($bar, $bar2, $bar3);
120-
?>
121110

122111
As you can see above there should be one space on both sides of equals
123112
sign (=).
124113

125114
Method definition
126115
=================
127116

128-
Example of a function definition:
129-
130-
::
117+
Example of a function definition::
131118

132119
<?php
133120
function someFunction($arg1, $arg2 = '') {
@@ -136,19 +123,16 @@ Example of a function definition:
136123
}
137124
return $var;
138125
}
139-
?>
140126

141127
Parameters with a default value, should be placed last in function
142128
definition. Try to make your functions return something, at least true
143129
or false = so it can be determined whether the function call was
144-
successful.
145-
146-
::
130+
successful::
147131

148132
<?php
149-
function connection(&$dns, $persistent = false) {
133+
function connection($dns, $persistent = false) {
150134
if (is_array($dns)) {
151-
$dnsInfo = &$dns;
135+
$dnsInfo = $dns;
152136
} else {
153137
$dnsInfo = BD::parseDNS($dns);
154138
}
@@ -158,7 +142,6 @@ successful.
158142
}
159143
return true;
160144
}
161-
?>
162145

163146
There are spaces on both side of the equals sign.
164147

@@ -183,14 +166,9 @@ tags:
183166
* `@since <http://manual.phpdoc.org/HTMLframesConverter/phpdoc.de/phpDocumentor/tutorial_tags.since.pkg.html>`_
184167
* `@tutorial <http://manual.phpdoc.org/HTMLframesConverter/phpdoc.de/phpDocumentor/tutorial_tags.tutorial.pkg.html>`_
185168
* `@version <http://manual.phpdoc.org/HTMLframesConverter/phpdoc.de/phpDocumentor/tutorial_tags.version.pkg.html>`_
186-
* `inline {@internal}} <http://manual.phpdoc.org/HTMLframesConverter/phpdoc.de/phpDocumentor/tutorial_tags.inlineinternal.pkg.html>`_
187-
* `inline {@inheritdoc}} <http://manual.phpdoc.org/HTMLframesConverter/phpdoc.de/phpDocumentor/tutorial_tags.inlineinheritdoc.pkg.html>`_
188-
* `inline {@link}} <http://manual.phpdoc.org/HTMLframesConverter/phpdoc.de/phpDocumentor/tutorial_tags.inlinelink.pkg.html>`_
189169

190170
PhpDoc tags are very much like JavaDoc tags in Java. Tags are only
191-
processed if they are the first thing in a DocBlock line, for example:
192-
193-
::
171+
processed if they are the first thing in a DocBlock line, for example::
194172

195173
<?php
196174
/**
@@ -200,19 +178,13 @@ processed if they are the first thing in a DocBlock line, for example:
200178
*/
201179
?>
202180

203-
There are 3 inline tags
204-
(`{@internal}} <http://manual.phpdoc.org/HTMLframesConverter/phpdoc.de/phpDocumentor/tutorial_tags.inlineinternal.pkg.html>`_,
205-
`{@inheritdoc}} <http://manual.phpdoc.org/HTMLframesConverter/phpdoc.de/phpDocumentor/tutorial_tags.inlineinheritdoc.pkg.html>`_
206-
and
207-
`{@link}} <http://manual.phpdoc.org/HTMLframesConverter/phpdoc.de/phpDocumentor/tutorial_tags.inlinelink.pkg.html>`_).
208-
209181
::
210182

211183
<?php
212184
/**
213185
* Example of inline phpDoc tags.
214186
*
215-
* This function works hard with {@link foo()} to rule the world.
187+
* This function works hard with foo() to rule the world.
216188
*/
217189
function bar() {
218190
}
@@ -222,7 +194,6 @@ and
222194
*/
223195
function foo() {
224196
}
225-
?>
226197

227198
Comment blocks, with the exception of the first block in a file, should
228199
always be preceeded by a newline.
@@ -244,26 +215,20 @@ Naming convention
244215
Functions
245216
---------
246217

247-
Write all functions in camelBack
248-
249-
::
218+
Write all functions in camelBack::
250219

251220
<?php
252221
function longFunctionName() {
253222
}
254-
?>
255223

256224
Classes
257225
-------
258226

259-
Class names should be written in CamelCase, for example:
260-
261-
::
227+
Class names should be written in CamelCase, for example::
262228

263229
<?php
264230
class ExampleClass {
265231
}
266-
?>
267232

268233
Variables
269234
---------
@@ -272,16 +237,13 @@ Variable names should be as descriptive as possible, but also as short
272237
as possible. Normal variables should start with a lowercase letter, and
273238
should be written in camelBack in case of multiple words. Variables
274239
containing objects should start with a capital letter, and in some way
275-
associate to the class the variable is an object of. Example:
276-
277-
::
240+
associate to the class the variable is an object of. Example::
278241

279242
<?php
280243
$user = 'John';
281244
$users = array('John', 'Hans', 'Arne');
282245

283246
$Dispatcher = new Dispatcher();
284-
?>
285247

286248
Member visibility
287249
-----------------
@@ -297,7 +259,6 @@ protected method or variable names start with a single underscore ("\_"). Exampl
297259
/*...*/
298260
}
299261
}
300-
?>
301262

302263
Private methods or variable names start with double underscore ("\_\_"). Example::
303264

@@ -309,12 +270,18 @@ Private methods or variable names start with double underscore ("\_\_"). Example
309270
/*...*/
310271
}
311272
}
312-
?>
313273

314274
Method Chaining
315275
---------------
316276

317-
todo
277+
Method chaining should have multiple methods spread across separate lines, and
278+
indented with one tab::
279+
280+
<?php
281+
$email->from('[email protected]')
282+
283+
->subject('A great message')
284+
->send();
318285

319286
Example addresses
320287
-----------------

0 commit comments

Comments
 (0)