Inspectopedia Help

'continue' is targeting 'switch' statement

Reports the continue statements that are targeting switch statements. In PHP 7.3 and later, such usages are deprecated and will emit an E_WARNING, since they are most likely the result of a programming mistake.

  • In PHP, such continue statements are equivalent to break, that is, they end the execution of the current switch structure.

  • In other languages, such continue statements behave as continue 2 in PHP, that is, they take the execution to a higher level control structure (for example, the next iteration of an outer loop).

See continue (php.net), break (php.net), and switch (php.net) for details.

Inspection options

Option

Type

Default

PHP 7.3 Severity

Dropdown

Warning

Inspection Details

Available in:

PhpStorm 2023.3, Qodana for PHP 2023.3

Plugin:

PHP, 233.SNAPSHOT

Last modified: 13 July 2023