assertEquals( [], $missingVars ); } protected static function getVariableNames( $lessFilePath ) { // We'd like to do something like: // $parser = new Less_Parser; // $parser->parseFile( $lessFilePath, '' ); // $parser->getCss(); // Have to call this for ->getVariables() to work; discard the result // return array_keys( $parser->getVariables() ); // But that doesn't work, the Less compiler appears to crash because of the calc() and rgba() // calls in the variable values. Instead, use regexes :( $fileContents = file_get_contents( $lessFilePath ); $matches = null; preg_match_all( '/^@([^:]+):/m', $fileContents, $matches, PREG_PATTERN_ORDER ); return $matches[1]; } }