Switch-case indentation
4 posts
• Page 1 of 1
Switch-case indentation
Small but annoying bug. Break jumps one tab to right as soon as you press ;
It should act like a closing tag for "default" or "case". But it acts like a part of content inside "default" or "case", adding one extra tab.
It should act like a closing tag for "default" or "case". But it acts like a part of content inside "default" or "case", adding one extra tab.
-
Maestro - Posts: 7
- Joined: April 28th, 2016, 3:16 pm
Re: Switch-case indentation
Hello,
Thank you for the post.
Actually this is not bug, it's intended behavior, because break is not really a closing tag. It's just another statement in the case/default block.
Please take a look at the samples on php.net, it's always formatted like this.
http://php.net/manual/en/control-structures.switch.php
I could imagine an option to indent/not indent the content of case/default blocks, but not just a break,return, die or another statement which can end the case block. You can even leave the block without any returning statement, so program flow would just continue.
Thank you,
Thank you for the post.
Actually this is not bug, it's intended behavior, because break is not really a closing tag. It's just another statement in the case/default block.
Please take a look at the samples on php.net, it's always formatted like this.
http://php.net/manual/en/control-structures.switch.php
I could imagine an option to indent/not indent the content of case/default blocks, but not just a break,return, die or another statement which can end the case block. You can even leave the block without any returning statement, so program flow would just continue.
Thank you,
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbeno │ miloslav@devsense.com
-
Miloslav Beno - Posts: 1252
- Joined: January 7th, 2012, 8:36 pm
Re: Switch-case indentation
Thanks, didn't knew that. Guess I'm just used to wrong indents on my previous IDE.
-
Maestro - Posts: 7
- Joined: April 28th, 2016, 3:16 pm
Re: Switch-case indentation
No problem
Have a good one,
Have a good one,
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbeno │ miloslav@devsense.com
-
Miloslav Beno - Posts: 1252
- Joined: January 7th, 2012, 8:36 pm
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 112 guests