Skip to content

Commit 6ced722

Browse files
Maik Penzweaverryan
authored andcommitted
Update contributing/code/standards.rst
Included suggestions by WouterJ. @param and @return should be separated by a single blank line (SF 2). Demonstration of trailing `,` for arrays should have a higher priority than the otherwise recommended single-line array notation (`array('key' => 'value')` in favour of `array('key' => 'value', )`). Multi-line function call syntax as suggested for SF2 is not PSR-2 conform. It may be required to consider more examples or discuss that rule at a higher level.
1 parent 38f17ec commit 6ced722

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

contributing/code/standards.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ example containing most features described below:
1818
.. code-block:: php
1919
2020
<?php
21-
21+
2222
/*
2323
* This file is part of the Symfony package.
2424
*
@@ -27,38 +27,41 @@ example containing most features described below:
2727
* For the full copyright and license information, please view the LICENSE
2828
* file that was distributed with this source code.
2929
*/
30-
30+
3131
namespace Acme;
32-
32+
3333
/**
34-
* FooBar class.
35-
*
34+
* Coding standards demonstration.
3635
*/
3736
class FooBar
3837
{
3938
const SOME_CONST = 42;
40-
39+
4140
private $fooBar;
42-
41+
4342
/**
4443
* @param string $dummy Some argument description
4544
*/
4645
public function __construct($dummy)
4746
{
4847
$this->fooBar = $this->transformText($dummy);
4948
}
50-
49+
5150
/**
5251
* @param string $dummy Some argument description
52+
*
5353
* @return string|null Transformed input
5454
*/
5555
private function transformText($dummy, $options = array())
5656
{
5757
$mergedOptions = array_merge(
5858
$options,
59-
array('some_default' => 'values', )
59+
array(
60+
'some_default' => 'values',
61+
'another_default' => 'more values',
62+
)
6063
);
61-
64+
6265
if (true === $dummy) {
6366
return;
6467
}
@@ -69,7 +72,7 @@ example containing most features described below:
6972
$dummy = ucwords($dummy);
7073
}
7174
}
72-
75+
7376
return $dummy;
7477
}
7578
}

0 commit comments

Comments
 (0)