diff --git a/src/core/Element.php b/src/core/Element.php index 578fc196..0b78ad57 100644 --- a/src/core/Element.php +++ b/src/core/Element.php @@ -38,9 +38,8 @@ final public function toString(): string { $this->validateChildren(); } - if ($this instanceof XHPAwaitable) { - // UNSAFE - interfaces don't support 'protected': facebook/hhvm#4830 - $composed = await $this->asyncRender(); + if ($this is XHPAwaitable) { + $composed = /* HH_FIXME[4112] protected */ await $this->asyncRender(); } else { $composed = $this->render(); } diff --git a/src/core/XHPAwaitable.php b/src/core/XHPAwaitable.php index 2a4d5e88..ab4376cd 100644 --- a/src/core/XHPAwaitable.php +++ b/src/core/XHPAwaitable.php @@ -17,5 +17,5 @@ */ interface XHPAwaitable { require extends :x:element; - // protected function asyncRender(): Awaitable + protected function asyncRender(): Awaitable; } diff --git a/src/html/XHPBaseHTMLHelpers.php b/src/html/XHPBaseHTMLHelpers.php index 9f3f4928..9e848aef 100644 --- a/src/html/XHPBaseHTMLHelpers.php +++ b/src/html/XHPBaseHTMLHelpers.php @@ -17,7 +17,7 @@ trait XHPBaseHTMLHelpers implements HasXHPBaseHTMLHelpers { */ public function addClass(string $class): this { try { - $current_class = /* UNSAFE_EXPR */ $this->:class; + $current_class = ($this->getAttributes()['class'] ?? '') as string; return $this->setAttribute('class', trim($current_class.' '.$class)); } catch (XHPInvalidAttributeException $error) { throw new XHPException( @@ -42,7 +42,7 @@ public function conditionClass(bool $cond, string $class): this { * will only be generated if one has not already been set. */ public function requireUniqueID(): string { - $id = /* UNSAFE_EXPR */ $this->:id; + $id = $this->getAttributes()['id'] ?? null; if ($id === null || $id === '') { try { $id = bin2hex(random_bytes(5)); diff --git a/tests/HackEnumAttributesTest.php b/tests/HackEnumAttributesTest.php index a532d3b1..7893cb9a 100644 --- a/tests/HackEnumAttributesTest.php +++ b/tests/HackEnumAttributesTest.php @@ -41,9 +41,9 @@ public function testValidValues(): void { public function testValidRawValues(): void { // UNSAFE - $x = ; + $x = ; expect($x->toString())->toBeSame('
HERP
'); - $x = ; + $x = ; expect($x->toString())->toBeSame('
DERP
'); }