Page MenuHomePhorge

switches.lint-test
No OneTemporary

switches.lint-test

<?php
$x = 0;
$y = 0;
switch ($x) {
case 1:
$x++;
continue;
case 2:
$x++;
break;
case 3:
$x++;
return;
case 4:
$x++;
throw new Exception("!");
case 5:
break 2;
case 6:
continue 2;
case 7:
case 8:
$x++;
break;
case 9:
$x++;
/* fallthrough */
case 10:
$x++;
break;
case 11:
$x++;
exit(1);
default:
break;
}
switch ($x) {
case 1:
$x++;
case 2:
break;
}
switch ($x) {
default:
$x++;
}
switch ($x) {
case 1:
while (true) {
break;
}
case 2:
switch ($y) {
case 1:
break;
}
case 3:
while (true) {
return;
}
case 4:
function f() { throw new Exception(); }
g(function() { return; });
final class C { public function m() { return; } }
interface I { }
case 5:
do {
break;
} while (true);
case 6:
// We accept this "false" positive because the construction is bizarre and
// the author can easily add an unreachable "break;" for clarity.
do {
break 2;
} while (true);
case 7:
/* fallthrough */
case 8:
throw_exception();
}
~~~~~~~~~~
warning:41:3
warning:48:3
warning:53:3
warning:57:3
warning:66:3
disabled:68:7 # PHP 5.3 features
warning:71:3
warning:75:3
~~~~~~~~~~
~~~~~~~~~~
{"config":{"xhpast.switchhook":"ArcanistXHPASTLintTestSwitchHook"}}

File Metadata

Mime Type
text/x-php
Expires
Jan 19 2025, 21:47 (6 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1129097
Default Alt Text
switches.lint-test (1 KB)

Event Timeline