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

Commit 63113ab

Browse files
committed
Remove instanceof and top-level requires
1 parent a62a3b2 commit 63113ab

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

bin/try-parse.php

+13-9
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
namespace Facebook\DefinitionFinder;
1212

13-
require_once (__DIR__.'/../vendor/hh_autoload.php');
14-
1513
use namespace HH\Lib\{Str, Vec};
1614

1715
async function try_parse_async(string $path): Awaitable<void> {
@@ -35,10 +33,12 @@
3533
}
3634
}
3735
$json = \exec(
38-
'hh_parse --full-fidelity-json '.\escapeshellarg($path).' 2>/dev/null'
36+
'hh_parse --full-fidelity-json '.\escapeshellarg($path).' 2>/dev/null',
3937
);
4038
$json = Str\trim($json);
41-
if (\json_decode($json) === null && \json_last_error() === \JSON_ERROR_DEPTH) {
39+
if (
40+
\json_decode($json) === null && \json_last_error() === \JSON_ERROR_DEPTH
41+
) {
4242
print $line."JSON TOO DEEP";
4343
return;
4444
}
@@ -48,8 +48,12 @@
4848
print $line."OK\n";
4949
}
5050

51-
$files = array_slice($argv, 1);
52-
53-
\HH\Asio\join(
54-
Vec\map_async($files, async $file ==> await try_parse_async($file)),
55-
);
51+
<<__EntryPoint>>
52+
async function try_parse_main_async(): Awaitable<void> {
53+
require_once(__DIR__.'/../vendor/hh_autoload.php');
54+
$files = Vec\drop(\HH\global_get('argv') as Traversable<_>, 1);
55+
await Vec\map_async(
56+
$files,
57+
async $file ==> await try_parse_async($file as string),
58+
);
59+
}

hhast-lint.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"patterns": [ "tests/data/*" ],
77
"builtinLinters": "none",
88
"extraLinters": [
9-
"Facebook\\HHAST\\LicenseHeaderLinter"
9+
"Facebook\\HHAST\\Linters\\LicenseHeaderLinter"
1010
]
1111
}
1212
]

src/consumers/property_from_ast.hack

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function properties_from_ast(
2626
$modifiers = vec[$modifiers];
2727
}
2828
$has_modifier = (classname<HHAST\Token> $class) ==>
29-
C\any($modifiers, $m ==> $m instanceof $class);
29+
C\any($modifiers, $m ==> \is_a($m, $class));
3030
$is_static = $has_modifier(HHAST\StaticToken::class)
3131
? StaticityToken::IS_STATIC
3232
: StaticityToken::NOT_STATIC;

0 commit comments

Comments
 (0)