switch case "expecting statement"

Code example:

switch ($test) {

    case 'foo':

         $dostuff;
         break;

    case 'bar':

         $domore;
         break;

}

 

If I add "case 'baz':" under "case 'foo':" then it displays a code error "Expecting statement" even though 2 case statements is perfectly fine. If I select the whole line for "case 'baz':" then cut/paste, the error disappears.

0
5 comments
Avatar
Vladimir Luchansky

Hello,

Could you, please, download and install the latest Early Access Program build from https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program and check if the described issues are still present there?

0

Just FYI I just updated to 16.2 and it exhibits the same issue. I'll try to look at EAP sometime.

0

I'm getting a similar problem with 2016.3

0

I got the same problem adding a default case. Cutting and pasting that part of the case statement fixes the issue.

0

There were some fixes made for 2017.1 in this regard -- try latest EAP build: https://blog.jetbrains.com/phpstorm/2017/02/phpstorm-2017-1-eap-171-3566/

0

Please sign in to leave a comment.