Skip to content

[RFC] Clarification on formatting for bangs (!) #4457

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 10 commits into from
14 changes: 13 additions & 1 deletion contributing/code/standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,26 @@ example containing most features described below:

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

private function reverseBoolean($value = null)
{
if (!isset($value)) {
Copy link
Member

Choose a reason for hiding this comment

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

$value is always set. So this is a redundant check. if (!$value) would be against the CS, so I propose to add another switch which defaults to false or the like to do something else and then use if (!$theSwitch)

Copy link
Member

Choose a reason for hiding this comment

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

indeed, we never use !isset($value) to check for null, but null === $value

return;
}

return !$value;
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing empty line above return

}
}

Structure
---------

* Add a single space after each comma delimiter;

* Add a single space around operators (``==``, ``&&``, ...);
* Add a single space around binary operators (``==``, ``&&``, ...), with
the exception of the concatenation (``,``) operator;
Copy link
Member

Choose a reason for hiding this comment

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

Should this be a period? Or am I mis-understanding this?


* Place unary operators (``!``, ``--``, ...) adjacent to the affected variable;

* Add a comma after each array item in a multi-line array, even after the
last one;
Expand Down