- /**
- * Check a file for syntax errors using Parsekit. Shamelessly stolen
- * from tools/lint.php by TimStarling
- * @param string $file Path to a file to check for syntax errors
- * @return bool
- */
- private function checkFileWithParsekit( $file ) {
- static $okErrors = array(
- 'Redefining already defined constructor',
- 'Assigning the return value of new by reference is deprecated',
- );
- $errors = array();
- parsekit_compile_file( $file, $errors, PARSEKIT_SIMPLE );
- $ret = true;
- if ( $errors ) {
- foreach ( $errors as $error ) {
- foreach ( $okErrors as $okError ) {
- if ( substr( $error['errstr'], 0, strlen( $okError ) ) == $okError ) {
- continue 2;
- }
- }
- $ret = false;
- $this->output( "Error in $file line {$error['lineno']}: {$error['errstr']}\n" );
- $this->mFailures[$file] = $errors;
- }
- }
-
- return $ret;
- }
-