Arquivos
hhvm/hphp/test/slow/assignment/1708.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

84 linhas
1.3 KiB
PHP

<?php
class dom {
public $kid;
public function __destruct() {
echo "dom destructing
";
$this->kid->check();
$this->kid->clear_unset();
}
}
class node {
public $dom;
public function __construct($dom) {
$this->dom = $dom;
$dom->kid = $this;
}
public function __destruct() {
echo "node destructing
";
}
public function clear_unset() {
unset($this->dom);
}
public function clear_set() {
$this->dom = null;
}
public function check() {
var_dump(isset($this->dom));
}
}
class node_arr {
public $doms = array();
public function __construct($dom) {
$this->doms[0] = $dom;
$dom->kid = $this;
}
public function __destruct() {
echo "node destructing
";
}
public function clear_unset() {
unset($this->doms[0]);
}
public function clear_set() {
$this->doms[0] = null;
}
public function check() {
var_dump(isset($this->doms[0]));
}
}
echo "
Property, SetM
";
$node = new node(new dom);
$node->clear_set();
unset($node);
echo "
Property, UnsetM
";
$node = new node(new dom);
$node->clear_unset();
unset($node);
echo "
Array, SetM
";
$node = new node_arr(new dom);
$node->clear_set();
unset($node);
echo "
Array, UnsetM
";
$node = new node_arr(new dom);
$node->clear_unset();
unset($node);