Skip to content

Commit

Permalink
drop support for old hhvm version
Browse files Browse the repository at this point in the history
  • Loading branch information
azjezz committed Nov 22, 2020
1 parent 8dd4040 commit 566a177
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .hhconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ const_default_func_args = true
disallow_array_literal = true
disable_lval_as_an_expression = true
ignored_paths = [ "vendor/.+/tests/.+", "vendor/.+/bin/.+" ]
allowed_decl_fixme_codes=2053,4045,4047
allowed_fixme_codes_strict=2011,2049,2050,2053,2083,3084,4027,4045,4047,4104,4106,4107,4108,4110,4128,4135,4188,4200,4223,4248,4240,4323
12 changes: 8 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@
}
],
"require": {
"hhvm": "^4.25",
"hhvm/type-assert": "^3.6"
"hhvm": "~4.83.1 || ~4.84.0",
"hhvm/type-assert": "^4.1.2"
},
"require-dev": {
"facebook/fbexpect": "^2.7",
"facebook/difflib": "^1.1.1",
"facebook/fbexpect": "^2.7.7",
"facebook/hh-clilib": "^2.5.2",
"hhvm/hacktest": "^2.0",
"hhvm/hhast": "^4.25"
"hhvm/hhast": "^4.82.2",
"hhvm/hhvm-autoload": "^3.1.6",
"hhvm/type-assert": "^4.1.2"
},
"scripts": {
"check": [
Expand Down
7 changes: 6 additions & 1 deletion src/Nuxed/Json/decode.hack
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ function decode(string $json, bool $assoc = true): dynamic {
$json,
$assoc,
512,
\JSON_BIGINT_AS_STRING | \JSON_FB_HACK_ARRAYS,
\JSON_BIGINT_AS_STRING |
(
\defined('JSON_FB_HACK_ARRAYS')
? \constant('\JSON_FB_HACK_ARRAYS')
: 0
),
);
} catch (\Throwable $e) {
// assoc = true & invalid property name results in `\Error`
Expand Down
1 change: 1 addition & 0 deletions src/Nuxed/Json/encode.hack
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function encode(mixed $value, bool $pretty = false, int $flags = 0): string {
$flags |= \JSON_UNESCAPED_UNICODE |
\JSON_UNESCAPED_SLASHES |
\JSON_PRESERVE_ZERO_FRACTION;

if ($pretty) {
$flags |= \JSON_PRETTY_PRINT;
}
Expand Down
1 change: 1 addition & 0 deletions src/Nuxed/Json/spec.hack
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use namespace Facebook\{TypeAssert, TypeSpec};
*/
function spec<T>(string $json, TypeSpec\TypeSpec<T> $spec): T {
$value = decode($json);

try {
return $spec->assertType($value);
} catch (TypeAssert\IncorrectTypeException $e) {
Expand Down

0 comments on commit 566a177

Please sign in to comment.