[ Bug ] HHAST tries to lint `<?php` files
lexidor opened this issue · comments
If HHAST sees a .php
file it is instructed to lint, but this is a <?php
file, this will almost always throw a fatal error, since []
array creation is illegal in Hack.
HHAST should skip .php
files that do not contain a <?hh
token.
HHAST should skip .php files that do not contain a <?hh token.
The safe implementation of this is "do not invoke the lexer unless it starts with <?hh or a #!"
That said, there's an alternative approach:
Entirely stop linting .php files.
Does that seem like a terrible idea?
Our codebase is completely written in .php
files, so we'd have to run hhast-migrate
and update the require path the our own autoload.php
.
facebook/ship-it must also have support for .hack
files first, so the hsl and hsl-experimental can be linted.
facebook/ship-it must also have support for .hack files first,
Works with any text-based files
so the hsl and hsl-experimental can be linted.
These aren't linted with hhast
The blockers on moving them are time, especially for testing how the change interacts with FB internal tools, or features such as the native autoloader that are currently only in use at FB.
Probably best to:
- check for
<?hh
in first line, or immediately after a shebang - for now - drop support for
.php
files when support for// partial
is removed from the typechecker