PHP Coding styles return; in switch/case
Posted
by ArneRie
on Stack Overflow
See other posts from Stack Overflow
or by ArneRie
Published on 2009-09-17T08:26:06Z
Indexed on
2010/04/01
1:23 UTC
Read the original article
Hit count: 452
php
|coding-style
Hi ,
we're trying to implement new coding style guidelines for our team, the php codesniffer is printing an warning on switch case statements when no "break" is found like:
switch ($foo) {
case 1:
return 1;
case 2:
return 2;
default:
return 3;
}
is there any good reason to use :
switch ($foo) {
case 1:
return 1;
break;
}
?? the break is never reached ?
© Stack Overflow or respective owner