final class WeakReference {
public static function create(object $object) : WeakReference;
public function get() : ?object;
}
<?php
class 👻ghost { function boo() { echo "BOO!\n"; } }
$boo = new 👻ghost;
$ref = WeakReference::create( $boo );
$ref->get()->boo();
unset( $boo );
var_dump( $ref->get() );