Arquivos
hhvm/hphp/test/slow/array_cse/534.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

34 linhas
616 B
PHP

<?php
function f(array $a = null, $e) {
$a[$e]['foo'] = 30;
$x = $a[$e]['baz'];
$a[$e]['bar'] = 50;
var_dump($a, $x);
}
function g($x, $y) {
$x[$y]['foo'] = 30;
$x[$y]['bar'] = 30;
$z = $x[$y]['bar'];
$x[$y]['baz'] = 30;
if ($z) {
$x[$y]['baz'] = 30;
}
return $x;
}
function h($x, $y) {
if ($x) {
$x[$y]['foo'] = 30;
$x[$y]['bar'] = 30;
}
var_dump($x[$y]['foo']);
}
f(null, 'e');
f(array(), 'e');
f(array('e' => array('baz' => 40)), 'e');
var_dump(f(array('y' => array()), 'y'));
var_dump(f(array(), 'y'));
var_dump(f(array(), array()));
h(array(), 0);
h(array(array()), 0);