Skip to content

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

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

Closed
wants to merge 1 commit into from
Closed
Changes from all 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
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