Skip to content

[Contributing] Improved CS #1393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 12, 2012
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions contributing/code/standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,40 @@ 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) {
$dummy = substr($dummy, 0, 5);
}
if (mergedOptions['some_default'] === 'values') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be 'values' === $mergedOptions['some_default'].

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. That's the part I personally don't like about the Symfony CS, but I will change it soon.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it an option to at this rule to the Coding Standards @fabpot ? I can't find this rule.

$dummy = substr($dummy, 0, 5);
} else {
$dummy = ucwords($dummy);
}
}

return $dummy;
}
Expand All @@ -74,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;
Expand Down