- Edited
I just ran into this, I would guess this has to do with the latest update before because I've never had this problem before.
Edit: Please excuse the dashes in the code samples, when I try to use tab or spaces to represent the indentation, the spaces are missing and doesn't represent the problem at hand. So all dashes below represent spaces.
When I wish to add a single line if statement, for example:
if( $a == $b ) $c = 2;
Upon adding the semicolon, this becomes:
if( $a == $b )
----$c = 2;
Ok, so I go into the options and deselect "Automatically format completed statement on ;" under PHP->Formatting->General, and all is well, except for this.
I do a lot of Wordpress development and the recommended structure for PHP for plugins and such is using the colon and text instead of braces. I use this throughout all projects, both WordPress and other applications. For instance:
if( $a == $b ):
----// Do something here
endif;
What occurs, or used to occur, is when the above is typed the formatter does this:
if( $a == $b ):
----endif
and when I press the semicolon it becomes this automatically:
if( $a == $b ):
endif;
But...if I deselect "Automatically format completed statement on ;" in the options, it doesn't automatically format and stays like so:
if( $a == $b ):
----endif;
The thing is, I need to turn off the autoformatting in the first example without affecting the autoformatting in the second example.
Is there a way to exclude the completion of blocks (foreach, each, if, etc.) from the removal of the disabling of the autoformat on ; setting?
Thanks in advance.