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

Commit d2d7b19

Browse files
lexidorjjergus
authored andcommitted
Make non-test code use darray, instead of php-array (#37)
* Make non-test code use darray, instead of php-array This disallow_array_literal option can not be left on, because hhvm 4.24 can't typecheck its own HHI's that strictly. This option can be enabled after hhvm 4.25+ is the minimum version. * avoid changing type in assertType()
1 parent 4f87cb8 commit d2d7b19

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/TypeSpec/__Private/UntypedArraySpec.hack

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class UntypedArraySpec extends TypeSpec<array> {
2424
TypeCoercionException::withValue($this->getTrace(), 'array', $value);
2525
}
2626

27-
$out = [];
27+
$out = darray[];
2828
foreach ($value as $k => $v) {
2929
$out[$k as arraykey] = $v;
3030
}
@@ -39,10 +39,6 @@ final class UntypedArraySpec extends TypeSpec<array> {
3939
IncorrectTypeException::withValue($this->getTrace(), 'array', $value);
4040
}
4141

42-
$out = [];
43-
foreach ($value as $k => $v) {
44-
$out[$k] = $v;
45-
}
46-
return $out;
42+
return $value;
4743
}
4844
}

0 commit comments

Comments
 (0)