4 public function assertIsFoo(): void
{}
8 public function __construct(
9 private Tclass
$member,
12 public function getWithDefault
<Tinner
>(
17 return $this->member ?
: $default;
20 public function getOrExcept
<Tinner
>(): Tinner where Tclass
= ?Tinner
{
21 if ($this->member
=== null) {
22 throw new Exception('Member is null and can\'t be got.');
27 public function getAsIs(): Tclass
{
31 public static function caller(Boxing
<?Foo
> $c, Foo
$f): void
{
32 $c->getWithDefault($f)->assertIsFoo(); // Must succeed
33 $c->getOrExcept()->assertIsFoo(); // Must succeed
34 $c->getAsIs()->assertIsFoo(); // Must fail, because may be null