6 public function __construct(
7 public darray
<string,mixed> $attributes,
13 public function getAttribute(string $attr, mixed $default = null): mixed {
14 $this->attributes
['attr'] = 42;
16 return $this->attributes
[$attr];
20 function takes_string(string $_): void
{}
23 function oops(): void
{
24 $xhp = <xhp attr
="hi" />;
25 // Type refinement causes attribute to become an int
26 if ($xhp->:attr is nonnull
) {
27 // The typechecker thinks the type of $xhp->attr is string
28 takes_string($xhp->:attr
); // Fatals