- var_dump: documentation ( source)
<?php
class C {
public function getThis(): self {
return $this;
}
public function getThat(): self {
// Fails.
return new stdClass;
}
}
var_dump((new C)->getThis());
var_dump((new C)->getThat());