A programming language’s features are only part of what makes it good. To be useful, a language needs to have a good tooling ecosystem around it: editor and IDE support, debuggers, analysis and linting tools, etc. The Hack typechecker is built on a powerful static analysis platform that can support many of these uses.
The standard HHVM/Hack installation ships with several tools for inspecting code, as well as for migrating code from PHP to Hack and transpiling Hack code to PHP. This chapter is about those tools.
The core of the Hack typechecker’s infrastructure is a server that remembers a set of facts about the codebase. Checking for type errors with
hh_client is but one way of querying this set of facts. This section describes other options available to
hh_client to query data:
Use this flag to perform a fuzzy search for a given symbol name. Pass a single argument after the flag as the string to search for. Note that this will search built-in symbols as well:
$ hh_client --search wrap File "/home/oyamauchi/hack/test.php", line 58, characters 7-13: Wrapper, class
The search is very responsive: the typechecker server indexes the codebase and doesn’t need to read any source files to do the search.
There are several related flags that can be used to restrict the kinds of symbols that will be returned:
--search-typedef (which searches type aliases). Each of these is ...