-
Notifications
You must be signed in to change notification settings - Fork 23
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
Handle new _serialize === true functionality #11
Conversation
} | ||
$this->Controller->set('_serialize', $serializeKeys); |
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 would be cleaner and easier to just return early
if ($this->Controller->viewVars['_serialize'] === true) {
return;
}
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 tend to agree, but so many people seem obsessed with having only a single return point from functions. I'll make the change and submit a new PR?
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.
Having return early is one of the most useful code practices. I dont know any sane person who would argue against that.
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.
No need, you can just update this PR with a 2nd commit - by pushing to the same branch.
See, so much cleaner :) Beautiful, thx! |
PS: Tests are failing, you need an additional |
In the interests of reducing duplicate code, I'm tempted to put the new block inside the existing |
return early still trumps it IMO as more levels of nesting is always worse. |
Handle new _serialize === true functionality
Resolution for issue #10