-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Updated the CS rule about return null; and return; #6614
Conversation
I picked the |
Can we also add an example that does not return |
@xabbuh I've added the |
👍 status: reviewed |
void early; | ||
* Use ``return null;`` when a function explicitly returns ``null`` values and | ||
use ``return;`` when the function returns ``void`` values (available from | ||
PHP 7.1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if the last part wouldn't be confusing. Could people think that this isn't usable yet as their code needed to be compatible with older PHP versions too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I indeed think the part between parenthesis can be removed as it doesn't add anything really usefull (and removing it avoids confusion)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been removed. Thanks!
Not related to this PR, but man, we really have to update the example with a more real example. It doesn't make sense at all anymore. 😄 |
👍 |
Thank you Javier. |
…reguiluz) 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;
this reverts commit 4b8b0ae due to symfony/symfony-docs#6614
this reverts commit f733111 due to symfony/symfony-docs#6614
this reverts commit b6da256 due to symfony/symfony-docs#6614
This fixes symfony/symfony#17201