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
13 changes: 12 additions & 1 deletion contributing/code/standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,25 @@ 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 operators (``==``, ``&&``, ...), with the excption
Copy link
Member

Choose a reason for hiding this comment

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

exception

of the not (!) operator;
Copy link
Member

Choose a reason for hiding this comment

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

Please put the ! into literals (double backticks).


* Place the not operator adjacent to the variable that it affects
Copy link
Member

Choose a reason for hiding this comment

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

Please add a semicolon at the end of the sentence.


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