If I'm not mistaken, inline code folding in sublime does not work by syntax, but by indentation. Observe the indents, and everything will be curtailed =)
Well, two obvious ways, if you are not satisfied with this folding:
I suppose some users may not be satisfied with the answers “I did not find the plugin,” “you can search the forums” and “write your own plugin”, so I’ll allow myself to add an answer .
Well, gridsane correctly noted that inline folding in Sublime Text works by indentation rather than syntax. Accordingly, we need to automatically adjust the indents with a formatter (beautifier):
Demonstration of folding after formatting with js-beautify .
I do not know the PHP language, therefore I can not recommend beautifier, based on personal experience. I will only mention that on the English-language Stack Overflow advise the plug-ins CodeIntel and CodeFormatter .