Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Support HHVM 4.10
Browse files Browse the repository at this point in the history
  • Loading branch information
fredemmott committed Jun 24, 2019
1 parent b00e0ad commit fef70b6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/core/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/XHPAwaitable.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
*/
interface XHPAwaitable {
require extends :x:element;
// protected function asyncRender(): Awaitable<XHPRoot>
protected function asyncRender(): Awaitable<XHPRoot>;
}
4 changes: 2 additions & 2 deletions src/html/XHPBaseHTMLHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions tests/HackEnumAttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public function testValidValues(): void {

public function testValidRawValues(): void {
// UNSAFE
$x = <test:hack-enum-attribute foo={1} />;
$x = <test:hack-enum-attribute foo={/* HH_IGNORE_ERROR[4110] */ 1} />;
expect($x->toString())->toBeSame('<div>HERP</div>');
$x = <test:hack-enum-attribute foo={2} />;
$x = <test:hack-enum-attribute foo={/* HH_IGNORE_ERROR[4110] */2} />;
expect($x->toString())->toBeSame('<div>DERP</div>');
}

Expand Down

0 comments on commit fef70b6

Please sign in to comment.