I think we should change the coding guidelines to always use brackets.
I will gladly do this but it will result in every file being changed. This might break mods so I don't want to do this without
@Spuds and
@emanuele agreeing to it. It would also mean that already submited PRs and commits already made would break.
Brackets... Where? In which ways? It can help newbies to understand, ya know? ;)
Curly brackets { }
No offense but this is beyond the scope of newbie discussion
Yes but where should they be used and they aren't being used, is what gets me :P They should be widely used already...
When I wrote the coding guidelines for SMF way back when there were some people that were concerned about the size of the files and I was stupid. So it was written that a one-line block shouldn't use curly brackets. Most of the conditional blocks are a single line so there's tons of cases of not using curly brackets.
Now everything makes sense, thanks :)
To be honest I have no idea what to reply, you are talking about PHP, I know, but there's mostly the same thing in css. I code a lot in css and I found myself coding in one line or using brackets and lines properly, I guess it's not just me being messy ;D
However, if you really want to cleanup all the code, I figure it won't happen before 2.0ish.
Yeah, 2.0 is where I can break everything ;)
From time to time I already use brackets on one-line conditionals. O:-)
No objections, of course for 1.1 it would be kind of a mess, so 2.0 would be fine. :)
Lol, just spotted a bug while reading your reply. Gonna post soon.
Its fine with me as well ... although I don't tend to {} the pure one liners I can get used to it and TBH I added a lot of {} in 1.0 It also helps with most ide's which add them automatically anyway.
Main reason is that every time I commit it gives me 200+ warnings/errors and I really don't want to go through the mess of changing the inspections.
I like them since it makes it easier to add a debug line anywhere with ease and improves any code folding that I may want to do.
I know I tweaked the inspections (Settings->editor->code style->inspections such as don't complain when a docblock does not have an @return statement and use of the silence operator like on all those chmod's etc ... I don't recall the {} being in there but must be as well.