8000 minor #6614 Updated the CS rule about return null; and return; (javie… · symfony/symfony-docs@5194a6a · GitHub
[go: up one dir, main page]

Skip to content

Commit 5194a6a

Browse files
committed
minor #6614 Updated the CS rule about return null; and return; (javiereguiluz)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #6614). Discussion ---------- Updated the CS rule about return null; and return; This fixes symfony/symfony#17201 Commits ------- 1cc723a Updated the CS rule about return null; and return;
2 parents e622278 + 1cc723a commit 5194a6a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

contributing/code/standards.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ example containing most features described below:
9191
);
9292

9393
if (true === $dummy) {
94-
return;
94+
return null;
9595
}
9696

9797
if ('string' === $dummy) {
@@ -109,7 +109,7 @@ example containing most features described below:
109109
* @param mixed $value Some value to check against
110110
* @param bool $theSwitch Some switch to control the method's flow
111111
*
112-
* @return bool|null The resultant check if $theSwitch isn't false, null otherwise
112+
* @return bool|void The resultant check if $theSwitch isn't false, void otherwise
113113
*/
114114
private function reverseBoolean($value = null, $theSwitch = false)
115115
{
@@ -143,8 +143,8 @@ Structure
143143
* Add a blank line before ``return`` statements, unless the return is alone
144144
inside a statement-group (like an ``if`` statement);
145145

146-
* Use just ``return;`` instead of ``return null;`` when a function must return
147-
void early;
146+
* Use ``return null;`` when a function explicitly returns ``null`` values and
147+
use ``return;`` when the function returns ``void`` values;
148148

149149
* Use braces to indicate control structure body regardless of the number of
150150
statements it contains;

0 commit comments

Comments
 (0)
0