c2ec1c97c9
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
37 linhas
538 B
PHP
37 linhas
538 B
PHP
<?php
|
|
|
|
error_reporting(-1);
|
|
set_error_handler('handle');
|
|
function handle() {
|
|
throw new exception;
|
|
}
|
|
function foo($a,$b=null) {
|
|
return $a;
|
|
}
|
|
function test1() {
|
|
if (foo(0)) $a=1;
|
|
$x = new StdClass;
|
|
return $a;
|
|
}
|
|
function test2() {
|
|
if (foo(0)) $a=1;
|
|
return $a | new StdClass;
|
|
}
|
|
function test3() {
|
|
if (foo(0)) $a=1;
|
|
$x = new StdClass;
|
|
return $a::foo;
|
|
}
|
|
function test($f) {
|
|
try {
|
|
$f();
|
|
}
|
|
catch (Exception $e) {
|
|
var_dump($f.':Caught');
|
|
}
|
|
}
|
|
test('test1');
|
|
test('test2');
|
|
test('test3');
|
|
var_dump('not reached');
|