Homec4science

Create a PHP wrapper class for the XHPAST binary

Authored by Joshua Spence <josh@joshuaspence.com> on Feb 2 2015, 20:46.

Description

Create a PHP wrapper class for the XHPAST binary

Summary:
Create a PhutilXHPASTBinary class which wraps the XHPAST binary, replacing the following functions:

  • xhpast_build() is replaced by PhutilXHPASTBinary::build().
  • xhpast_get_binary_path is replaced by PhutilXHPASTBinary::getPath().
  • xhpast_get_build_instructions is replaced by PhutilXHPASTBinary::getBuildInstructions().
  • xhpast_get_parser_future is replaced by PhutilXHPASTBinary::getParserFuture().
  • xhpast_is_available is replaced by PhutilXHPASTBinary::isAvailable().
  • xhpast_version is replaced by PhutilXHPASTBinary::getVersion().

Additionally improve handling of out-of-date XHPAST, a minor issue I stumbled across this whilst testing D11516. Basically, calling xhpast_is_available() followed by xhpast_build() followed by xhpast_is_available() has somewhat unexpected results.

Test Plan:
Pre-patch, the following code caused an infinite loop. Post-patch, the loop was correctly terminated.

while (!xhpast_is_available()) {
  echo "Building\n";
  xhpast_build();
}

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11517

Details

Committed
Joshua Spence <josh@joshuaspence.com>Feb 2 2015, 20:47
Pushed
aubortMar 17 2017, 12:03
Parents
rPHU04f81f9d9e66: Add a `phutil_fnmatch` function
Branches
Unknown
Tags
Unknown

Event Timeline

Joshua Spence <josh@joshuaspence.com> committed rPHU46be410e4d6b: Create a PHP wrapper class for the XHPAST binary (authored by Joshua Spence <josh@joshuaspence.com>).Feb 2 2015, 20:47