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
46 linhas
629 B
PHP
46 linhas
629 B
PHP
<?php
|
|
|
|
class c {
|
|
public $d = 'd';
|
|
private $e = 'e';
|
|
protected $f = 'f';
|
|
function t1($y) {
|
|
foreach ($y as $k => $v) {
|
|
var_dump($v);
|
|
}
|
|
}
|
|
}
|
|
class d extends c {
|
|
public $a = 'a';
|
|
private $b = 'b';
|
|
protected $c = 'c';
|
|
function t2($y) {
|
|
foreach ($this as $k => $v) {
|
|
var_dump($v);
|
|
}
|
|
foreach ($y as $k => $v) {
|
|
var_dump($v);
|
|
}
|
|
foreach ($y as $k => $v) {
|
|
var_dump($v);
|
|
}
|
|
}
|
|
}
|
|
$x = new d;
|
|
$x->surprise = 1;
|
|
$y = new d;
|
|
$y->shock = 2;
|
|
echo "t2
|
|
";
|
|
$x->t2($y);
|
|
echo "t1
|
|
";
|
|
$x->t1($y);
|
|
$z = new c;
|
|
echo "t12
|
|
";
|
|
$z->t1($x);
|
|
foreach ($x as $k => $v) {
|
|
var_dump($v);
|
|
}
|