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

Commit

Permalink
Fix new hack errors in nightlies
Browse files Browse the repository at this point in the history
  • Loading branch information
fredemmott committed Mar 22, 2019
1 parent 72d66ca commit 56c0b9a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ sudo: required
language: generic
services: docker
env:
- HHVM_VERSION=latest
- HHVM_VERSION=nightly
install:
- docker pull hhvm/hhvm:$HHVM_VERSION
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
},
"require-dev": {
"hhvm/hhvm-autoload": "^2.0",
"hhvm/hhast": "^4.0"
"hhvm/hhast": "^4.1"
}
}
19 changes: 11 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Assert.hack
Original file line number Diff line number Diff line change
Expand Up @@ -512,15 +512,15 @@ abstract class Assert {
if ($actual is KeyedContainer<_, _>) {
$actual_value = idx($actual, $key ?as arraykey);
$part = '['.\var_export($key, true).']';
} else if (is_object($actual)) {
} else if (\is_object($actual)) {
$actual_value = /* UNSAFE_EXPR */ $actual->$key;
$part = "->".$key;
} else {
$actual_value = null;
$part = null;
}

if (is_any_array($value) || is_object($value)) {
if (is_any_array($value) || \is_object($value)) {
$this->assertSubset($value, $actual_value, $msg, $path.$part);
} else {
$this->assertEquals($value, $actual_value, $msg."\nKey: ".$path.$part);
Expand Down
2 changes: 1 addition & 1 deletion src/ExpectObj.hack
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class ExpectObj<T> extends Assert {
/* HH_FIXME[4110] KeyedContainer<_, _> always has arraykey keys */
$this->assertKeyAndValueEquals(
$expected as KeyedContainer<_, _>,
is_array($value) ? $value : [],
\is_array($value) ? $value : [],
$msg,
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/utils.hack
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,30 @@ namespace Facebook\FBExpect;

function is_any_array(mixed $value): bool {
return (
is_array($value) ||
\is_array($value) ||
($value is dict<_, _>) ||
($value is vec<_>) ||
($value is keyset<_>)
);
}

function not_hack_array(mixed $value): mixed {
if (is_any_array($value) && !is_array($value)) {
if (is_any_array($value) && !\is_array($value)) {
/* HH_IGNORE_ERROR[4007] sketchy array cast */
return (array) $value;
}
return $value;
}

function print_type(mixed $value): string {
if (is_object($value)) {
if (\is_object($value)) {
return \get_class($value);
}
return \gettype($value);
}

function is_iterable(mixed $value): bool {
return is_array($value) || (is_object($value) && ($value instanceof Traversable));
return \is_array($value) || (\is_object($value) && ($value instanceof Traversable));
}

function is_type(mixed $value): bool {
Expand Down

0 comments on commit 56c0b9a

Please sign in to comment.