1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 00:32:41 +01:00

Allow the ArcanistPhutilLibraryLinter to recover from PHP syntax errors

Summary: Fixes T5577. If the `ArcanistPhutilLibraryLinter` lints a PHP file that contains a syntax error, it will die horribly. Instead, force it to continue as if nothing was wrong.

Test Plan: Introduced a PHP syntax error. Ran `arc lint` and made sure the output looked reasonable.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T5577

Differential Revision: https://secure.phabricator.com/D9865
This commit is contained in:
Joshua Spence 2014-07-10 11:48:45 +10:00
parent dfdaed0b27
commit 3de9e4aaea

View file

@ -64,7 +64,14 @@ final class ArcanistPhutilLibraryLinter extends ArcanistLinter {
$symbols = array(); $symbols = array();
foreach ($libs as $lib) { foreach ($libs as $lib) {
$root = phutil_get_library_root($lib); $root = phutil_get_library_root($lib);
try {
$symbols[$lib] = id(new PhutilLibraryMapBuilder($root))->buildMap(); $symbols[$lib] = id(new PhutilLibraryMapBuilder($root))->buildMap();
} catch (XHPASTSyntaxErrorException $ex) {
// If the library contains a syntax error then there isn't much that we
// can do.
continue;
}
} }
$all_symbols = array(); $all_symbols = array();