Arquivos
hhvm/hphp/test/slow/switch_statement/1756.php
T
Paul Tarjan c2ec1c97c9 sortof format slow tests
A poor man's formatter since I didn't like any of the other ones I found. The original C++ source sometimes put newlines and sometimes not.

Codemods:

    codemod '([;{}])([^\n])' '\1\n\2'
    codemod -m '\s*<\?php\s+' '<?php\n\n'
    codemod '\t' '  '

I hand-fixed all the failing tests
2013-05-30 17:32:57 -07:00

45 linhas
533 B
PHP

<?php
function f($x) {
switch ($x) {
default:
print "default-0";
case "foo":
print "foo-0";
case "3":
print "3-0";
default:
print "default-1";
case "3":
print "3-1";
case "foo":
print "foo-1";
default:
print "default-2";
case "bar":
print "bar";
}
}
function g($x) {
switch ($x) {
case 'x': print 'x';
break;
case '0': print '0';
break;
}
}
f("foo");
f("3");
f("bar");
f(null);
f(3);
f(0);
f(0.0);
f(3.0);
f(true);
f(false);
f(array());
f(new stdClass());
g(0);
g(0.0);