Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

javiereguiluz
Copy link
Member

@javiereguiluz
Copy link
Member Author

I picked the master branch ... but this should be merged on 2.3. I'm sorry.

@xabbuh
Copy link
Member

xabbuh commented May 26, 2016

Can we also add an example that does not return null?

@javiereguiluz
Copy link
Member Author

@xabbuh I've added the void return example.

@wouterj
Copy link
Member

wouterj commented Jun 20, 2016

👍

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);
Copy link
Member

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?

Copy link
Member

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)

Copy link
Member Author

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!

@wouterj
Copy link
Member

wouterj commented Jun 21, 2016

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. 😄

@xabbuh
Copy link
Member

xabbuh commented Jun 22, 2016

👍

@xabbuh
Copy link
Member

xabbuh commented Jun 30, 2016

Thank you Javier.

xabbuh added a commit that referenced this pull request Jun 30, 2016
…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;
@xabbuh xabbuh closed this Jun 30, 2016
craue added a commit to craue/CraueFormFlowDemoBundle that referenced this pull request Jun 30, 2016
craue added a commit to craue/TwigExtensionsBundle that referenced this pull request Jun 30, 2016
craue added a commit to craue/CraueConfigBundle that referenced this pull request Dec 2, 2016
@javiereguiluz javiereguiluz deleted the cs_null_return branch May 24, 2018 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reconsider the CS rule for returning null in functions
4 participants