Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
remove else and parenthesis unneeded#2884
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
wouterj commentedAug 8, 2013
👎 imo having the else makes the code easier to understand and read |
cordoval commentedAug 8, 2013
ok you advocate bad practices? |
wouterj commentedAug 8, 2013
no, I give my opinion based on my preferences. |
cordoval commentedAug 8, 2013
granted, but i still think is simpler to read this way, cleaner and less lines, and advocate a good practice |
xabbuh commentedAug 8, 2013
When talking about cleaner ways, I'd prefer just one if (...) {$response =...;}else {$response =...;}return$response; |
stof commentedAug 9, 2013
The Symfony codebase is using early returns without |
wouterj commentedAug 9, 2013
ok, 👍 then :) |
xabbuh commentedAug 9, 2013
Thanks for the clarification,@stof. Is it documented anywhere? I didn't find it in the CS and the first example inhttp://symfony.com/doc/current/contributing/code/standards.html doesn't follow this way. |
stof commentedAug 9, 2013
I don't think it is written in the doc, but it is applied when reviewing code (it may be worth adding it in the doc) |
xabbuh commentedAug 9, 2013
At least we should change the example to be consistent which what is actually the "standard" being used. |
xabbuh commentedAug 9, 2013
if ('string' ===$dummy) {if ('values' ===$mergedOptions['some_default']) {returnsubstr($dummy,0,5); }returnucwords($dummy);}else {thrownew \RuntimeException(sprintf('Unrecognized dummy option "%s"',$dummy));} This would match the standard? Or should we use the same style to throw exceptions? Like this: if ('string' ===$dummy) {if ('values' ===$mergedOptions['some_default']) {returnsubstr($dummy,0,5); }returnucwords($dummy);}thrownew \RuntimeException(sprintf('Unrecognized dummy option "%s"',$dummy)); |
cordoval commentedAug 9, 2013
👍 ready to merge then 🔨 |
cordoval commentedAug 25, 2013
i guess this is not that important, closing@weaverryan |
wouterj commentedAug 25, 2013
I is important, code in the doc should follow symfony standards. |
cordoval commentedAug 25, 2013
yes but this is a change, don't want to change the whole documentation examples, so it should be a simple merge right? |
wouterj commentedAug 25, 2013
Yes, it's a simple merge |
No description provided.