0

I'm looking or a sniff, which detects:

if()
switch()
elseif()

because only

if ()
switch ()
elseif ()

is allowed!

Thanks

OskarStark
  • 384
  • 1
  • 11

1 Answers1

0

You can probably use Squiz_Sniffs_ControlStructures_ControlSignatureSniff for this, which accepts the following patterns:

try {EOL...} catch (...) {EOL
do {EOL...} while (...);EOL
while (...) {EOL
for (...) {EOL
if (...) {EOL
foreach (...) {EOL
} else if (...) {EOL
} else {EOL

If those signatures are not to your liking, have a look for *_ControlSignaturesSniff in the other namespaces.

cmbuckley
  • 40,217
  • 9
  • 77
  • 91
  • hmm, PHP_CodeSniffer_Standards_AbstractPatternSniff does not support whitespaces, so the new lines are correct, but "if(" is still allowed – OskarStark Oct 08 '12 at 08:58