From ff3839b30581c68a0cde394f3f5900f983cccc94 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Wed, 23 May 2012 13:07:08 +0200 Subject: [PATCH 1/4] [Contributing][CS] Added camelCase, StudlyCaps and underscores in the example --- contributing/code/standards.rst | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/contributing/code/standards.rst b/contributing/code/standards.rst index a0244e366ca..8be9cb314f4 100644 --- a/contributing/code/standards.rst +++ b/contributing/code/standards.rst @@ -30,30 +30,34 @@ example containing most features described below: namespace Acme; - class Foo + class FooBar { const SOME_CONST = 42; - private $foo; + private $fooBar; /** * @param string $dummy Some argument description */ public function __construct($dummy) { - $this->foo = $this->transform($dummy); + $this->fooBar = $this->transform($dummy); } /** * @param string $dummy Some argument description * @return string|null Transformed input */ - private function transform($dummy) + private function transformText($dummy, $options = array()) { + $mergedOptions = array_merge($options, array( + 'some_default' => 'values', + )); + if (true === $dummy) { return; } - if ('string' === $dummy) { + if ('string' === $dummy && mergedOptions['some_default'] === 'values') { $dummy = substr($dummy, 0, 5); } From 50f3acd2f24557125d1bb4dc18f07a1dbae23f52 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Wed, 23 May 2012 16:39:16 +0200 Subject: [PATCH 2/4] [Contributing][CS] Added else statement --- contributing/code/standards.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/contributing/code/standards.rst b/contributing/code/standards.rst index 8be9cb314f4..5ebf0267b68 100644 --- a/contributing/code/standards.rst +++ b/contributing/code/standards.rst @@ -57,9 +57,13 @@ example containing most features described below: if (true === $dummy) { return; } - if ('string' === $dummy && mergedOptions['some_default'] === 'values') { - $dummy = substr($dummy, 0, 5); - } + if ('string' === $dummy) { + if (mergedOptions['some_default'] === 'values') { + $dummy = substr($dummy, 0, 5); + } else { + $dummy = ucwords($dummy); + } + } return $dummy; } From 67a7a1e9c6f2c7f94218fae0ca42f49449218b16 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Wed, 23 May 2012 16:54:12 +0200 Subject: [PATCH 3/4] [Contributing][CS] Removed visibility rules because it's in PSR-2 --- contributing/code/standards.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/contributing/code/standards.rst b/contributing/code/standards.rst index 5ebf0267b68..6aaa0dd9e0e 100644 --- a/contributing/code/standards.rst +++ b/contributing/code/standards.rst @@ -82,9 +82,6 @@ Structure * Use braces to indicate control structure body regardless of the number of statements it contains; -* Declare visibility explicitly for class, methods, and properties (usage of - `var` is prohibited); - * Define one class per file - this does not apply to private helper classes that are not intended to be instantiated from the outside and thus are not concerned by the PSR-0 standard; From 10e7bd5344107af71596fc9a7e141d09e3f8c1ba Mon Sep 17 00:00:00 2001 From: WouterJ Date: Wed, 23 May 2012 18:22:15 +0200 Subject: [PATCH 4/4] [Contributing][CS] Solved some typo's --- contributing/code/standards.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing/code/standards.rst b/contributing/code/standards.rst index 6aaa0dd9e0e..e7c525e0b4e 100644 --- a/contributing/code/standards.rst +++ b/contributing/code/standards.rst @@ -58,7 +58,7 @@ example containing most features described below: return; } if ('string' === $dummy) { - if (mergedOptions['some_default'] === 'values') { + if ('values' === $mergedOptions['some_default']) { $dummy = substr($dummy, 0, 5); } else { $dummy = ucwords($dummy);