phpcompat
phpcompat copied to clipboard
FALSE POSITIVE: break within a loop
This line of code
foreach( Some_Object::return_an_array() as $array_item ) break;
whilst valid will cause the following error:
ERROR | Using ‘break’ outside of a loop or switch structure is invalid and will throw a fatal error since PHP 7.0
To work arround this false positive use curly brackets.
Thanks, I think I must have done that already as the error doesn't appear anymore. Also thought you'd like to know about the false positive.
@msykes Hi Marcus, this is a known issue and being working on - see https://github.com/wimg/PHPCompatibility/issues/292