... | ... | @@ -2,18 +2,18 @@ |
|
|
|
|
|
---
|
|
|
|
|
|
# <a name='PHPCodingStandards'> </a>PHP Coding Standards
|
|
|
# PHP Coding Standards
|
|
|
|
|
|
|
|
|
|
|
|
## <a name='ShamelessCopyofSymfonyStandarts'> </a>Shameless Copy of Symfony Standards
|
|
|
## Shameless Copy of Symfony Standards
|
|
|
|
|
|
|
|
|
__These standardts are borrowed from the Symfony Standards. They are edited by Digitec when appropriate.__
|
|
|
|
|
|
Remember that the main advantage of standards is that every piece of code looks and feels familiar, it's not about this or that being more readable.
|
|
|
|
|
|
|
|
|
|
|
|
KD7 will follow the standards defined in the PSR-0, PSR-1 and PSR-2 documents.
|
|
|
|
|
|
|
... | ... | @@ -22,15 +22,13 @@ Since a picture - or some code - is worth a thousand words, here's a short examp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
<?php
|
|
|
|
|
|
/*
|
|
|
* This file is part of the Symfony package.
|
|
|
* This file is part of the KD package.
|
|
|
*
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
|
* (c) Digitec Interactive
|
|
|
*
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
* file that was distributed with this source code.
|
... | ... | @@ -41,8 +39,7 @@ namespace Acme; |
|
|
/**
|
|
|
* Coding standards demonstration.
|
|
|
*/
|
|
|
class FooBar
|
|
|
{
|
|
|
class FooBar {
|
|
|
const SOME_CONST = 42;
|
|
|
|
|
|
private $fooBar;
|
... | ... | @@ -50,9 +47,8 @@ class FooBar |
|
|
/**
|
|
|
* @param string $dummy Some argument description
|
|
|
*/
|
|
|
public function __construct($dummy)
|
|
|
{
|
|
|
$this->fooBar = $this->transformText($dummy);
|
|
|
public function __construct ($dummy) {
|
|
|
$this->fooBar = $this->transformText ($dummy);
|
|
|
}
|
|
|
|
|
|
/**
|
... | ... | @@ -61,8 +57,7 @@ class FooBar |
|
|
*
|
|
|
* @return string|null Transformed input
|
|
|
*/
|
|
|
private function transformText($dummy, array $options = array())
|
|
|
{
|
|
|
private function transformText($dummy, array $options = array()) {
|
|
|
$mergedOptions = array_merge(
|
|
|
$options,
|
|
|
array(
|
... | ... | |