Skip to content

Commit

Permalink
minor #5560 [2.3] [Contributing] [CS] Added missing docblocks in code…
Browse files Browse the repository at this point in the history
… snippet (phansys)

This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes #5560).

Discussion
----------

[2.3] [Contributing] [CS] Added missing docblocks in code snippet

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | no
| Applies to    |
| Fixed tickets |

Commits
-------

8395e66 [2.3] [Contributing] [CS] Added missing docblocks in code snippet
  • Loading branch information
xabbuh committed Sep 5, 2015
2 parents dea153c + 8395e66 commit de9f987
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions contributing/code/standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ example containing most features described below:
{
const SOME_CONST = 42;
/**
* @var string
*/
private $fooBar;
/**
Expand All @@ -48,20 +51,30 @@ example containing most features described below:
}
/**
* @param string $dummy Some argument description
* @param array $options
* Transforms the input given as first argument.
*
* @param bool|string $dummy Some argument description
* @param array $options An options collection to be used within the transformation
*
* @return string|null Transformed input
* @return string|null The transformed input
*
* @throws \RuntimeException
* @throws \RuntimeException When an invalid option is provided
*/
private function transformText($dummy, array $options = array())
{
$defaultOptions = array(
'some_default' => 'values',
'another_default' => 'more values',
);
foreach ($options as $option) {
if (!in_array($option, $defaultOptions)) {
throw new \RuntimeException(sprintf('Unrecognized option "%s"', $option));
}
}

$mergedOptions = array_merge(
array(
'some_default' => 'values',
'another_default' => 'more values',
),
$defaultOptions,
$options
);

Expand All @@ -76,10 +89,16 @@ example containing most features described below:

return ucwords($dummy);
}

throw new \RuntimeException(sprintf('Unrecognized dummy option "%s"', $dummy));
}

/**
* Performs some basic check for a given value.
*
* @param mixed $value Some value to check against
* @param bool $theSwitch Some switch to control the method's flow
*
* @return bool|null The resultant check if $theSwitch isn't false, null otherwise
*/
private function reverseBoolean($value = null, $theSwitch = false)
{
if (!$theSwitch) {
Expand Down

0 comments on commit de9f987

Please sign in to comment.