All Astronauts Posted October 9, 2019 Posted October 9, 2019  public static function moveCheck( $configuration, $oldConfiguration ) { foreach( array( 'bucket', 'bucket_path' ) as $field ) if ( $configuration[ $field ] !== $oldConfiguration[ $field ] ) { return TRUE; } return FALSE; } @Martin A. dragged me into this brief insanity, he accepted it before I did. It's still just so wrong.
Martin A. Posted October 9, 2019 Posted October 9, 2019 Never said I accepted it. I only confirmed that it did work, no matter how insane it may be.  Is this your new kind of Easter eggs? Or some kind of bet to see how it took for someone to notice? Or did you let Charles or Lindy write that method?
Adriano Faria Posted October 9, 2019 Posted October 9, 2019 You don’t need the curly braces. https://stackoverflow.com/questions/8726339/php-if-else-for-foreach-while-without-curly-braces/8726411 Â
CodingJungle Posted October 9, 2019 Posted October 9, 2019 40 minutes ago, Adriano Faria said: You don’t need the curly braces. https://stackoverflow.com/questions/8726339/php-if-else-for-foreach-while-without-curly-braces/8726411  you don't but its bad form imho, it can make the intention unclear :)Â
bfarber Posted October 10, 2019 Posted October 10, 2019 Is it safe to assume the feedback you're wanting to provide here is that you expected curly braces in the copied code? The post isn't extremely clear.
Joy Rex Posted October 10, 2019 Posted October 10, 2019 3 hours ago, bfarber said: Is it safe to assume the feedback you're wanting to provide here is that you expected curly braces in the copied code? The post isn't extremely clear. Neither is the code! 🤣
All Astronauts Posted October 10, 2019 Author Posted October 10, 2019 3 hours ago, bfarber said: Is it safe to assume the feedback you're wanting to provide here is that you expected curly braces in the copied code? The post isn't extremely clear. 10 points Slytherin
Management Matt Posted October 11, 2019 Management Posted October 11, 2019 I checked with git, and that code pre-dates git. I no longer have access to our svn repo so I can't tell you. If we find out who it is, we will write a strongly worded letter expressing our disappointment to their mother.
Midnight Modding Posted October 15, 2019 Posted October 15, 2019 On 10/9/2019 at 5:33 PM, CodingJungle said: you don't but its bad form imho, it can make the intention unclear 🙂 how? it's still very obvious what the code is doing. I could see someone being confused by not knowing it doesn't need them, but once you accept that it can be done that way, there's only one way to interpret what the code is doing in such a simple example.
CodingJungle Posted October 15, 2019 Posted October 15, 2019 14 hours ago, Midnight Modding said: how? it's still very obvious what the code is doing. I could see someone being confused by not knowing it doesn't need them, but once you accept that it can be done that way, there's only one way to interpret what the code is doing in such a simple example. according to psr2 they are a MUST: https://www.php-fig.org/psr/psr-2/#5-control-structures As well with IPS own internal Coding Standard, they are a MUST (I've also attached IPS internal coding standards to this reply): Any professional developer or professional level software i would EXPECT them to follow at least the industry standards (best practices). In much more complex code, lacking in curly brackets around your control structures can easily lead to bugs and maintenance hell. sure you CAN write you code without them, it doesn't mean you SHOULD write it without them. Any IDE worth its salt, will add them automatically as you are writing the code, so this is really a non-issue that imho can be easily avoided, make your code look cleaner, its intention clear and less likely to lead to potential bugs as you add code or another developer comes along an inherits/adopts your code. Coding_Standards.pdf
Midnight Modding Posted October 15, 2019 Posted October 15, 2019 4 hours ago, CodingJungle said: according to psr2 they are a MUST: https://www.php-fig.org/psr/psr-2/#5-control-structures As well with IPS own internal Coding Standard, they are a MUST (I've also attached IPS internal coding standards to this reply): Any professional developer or professional level software i would EXPECT them to follow at least the industry standards (best practices). In much more complex code, lacking in curly brackets around your control structures can easily lead to bugs and maintenance hell. sure you CAN write you code without them, it doesn't mean you SHOULD write it without them. Any IDE worth its salt, will add them automatically as you are writing the code, so this is really a non-issue that imho can be easily avoided, make your code look cleaner, its intention clear and less likely to lead to potential bugs as you add code or another developer comes along an inherits/adopts your code. Coding_Standards.pdf 143.22 kB · 1 download I'm not saying otherwise. I am simply saying there's no way to be confused by that code, assuming one knows it will work without them.
CodingJungle Posted October 15, 2019 Posted October 15, 2019 21 minutes ago, Midnight Modding said: I'm not saying otherwise. I am simply saying there's no way to be confused by that code, assuming one knows it will work without them. yes, in that particular code, its not, but i wasn't specifically talk about that piece of code, that should be "clear", as if you looked at the post i was replying to, it wasn't about the OP 🙂Â
bfarber Posted October 16, 2019 Posted October 16, 2019 I have no idea who was responsible or when the missing braces were introduced, and have no appetite to dig through git history to try to figure it out. The braces have been added for the next release to alleviate confusion. This is really one of those things that shouldn't require a 2 page conversation if you ask me. 😛Â
All Astronauts Posted October 16, 2019 Author Posted October 16, 2019 10 minutes ago, bfarber said: This is really one of those things that shouldn't require a 2 page conversation if you ask me. 😛 It is if you are trying to bring a little levity into what has become a fairly mature, stable, and well-engineered product (he says after recently looking over mybb among other things...)
CodingJungle Posted October 16, 2019 Posted October 16, 2019 3 hours ago, bfarber said: I have no idea who was responsible or when the missing braces were introduced, and have no appetite to dig through git history to try to figure it out. The braces have been added for the next release to alleviate confusion. This is really one of those things that shouldn't require a 2 page conversation if you ask me. 😛 this sounds like a distraction to keep us from the #truth  #releaseTheLogs
Recommended Posts
Archived
This topic is now archived and is closed to further replies.