}
try {
- $code = @file_get_contents($file);
+ $code = @\file_get_contents($file);
if (!$code) {
return;
}
*/
private static function getDebugFile()
{
- $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+ $trace = \debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
- foreach (array_reverse($trace) as $stackFrame) {
+ foreach (\array_reverse($trace) as $stackFrame) {
if (!self::isDebugCall($stackFrame)) {
continue;
}
- if (preg_match('/eval\(/', $stackFrame['file'])) {
- preg_match_all('/([^\(]+)\((\d+)/', $stackFrame['file'], $matches);
+ if (\preg_match('/eval\(/', $stackFrame['file'])) {
+ \preg_match_all('/([^\(]+)\((\d+)/', $stackFrame['file'], $matches);
return $matches[1][0];
}
*/
public function clean(array $codeLines, $requireSemicolons = false)
{
- $stmts = $this->parse('<?php ' . implode(PHP_EOL, $codeLines) . PHP_EOL, $requireSemicolons);
+ $stmts = $this->parse('<?php ' . \implode(PHP_EOL, $codeLines) . PHP_EOL, $requireSemicolons);
if ($stmts === false) {
return false;
}
$stmts = $this->traverser->traverse($stmts);
// Work around https://github.com/nikic/PHP-Parser/issues/399
- $oldLocale = setlocale(LC_NUMERIC, 0);
- setlocale(LC_NUMERIC, 'C');
+ $oldLocale = \setlocale(LC_NUMERIC, 0);
+ \setlocale(LC_NUMERIC, 'C');
$code = $this->printer->prettyPrint($stmts);
// Now put the locale back
- setlocale(LC_NUMERIC, $oldLocale);
+ \setlocale(LC_NUMERIC, $oldLocale);
return $code;
}
{
$msg = $e->getRawMessage();
- return ($msg === 'Unexpected token EOF') || (strpos($msg, 'Syntax error, unexpected EOF') !== false);
+ return ($msg === 'Unexpected token EOF') || (\strpos($msg, 'Syntax error, unexpected EOF') !== false);
}
/**
private function parseErrorIsTrailingComma(\PhpParser\Error $e, $code)
{
- return ($e->getRawMessage() === 'A trailing comma is not allowed here') && (substr(rtrim($code), -1) === ',');
+ return ($e->getRawMessage() === 'A trailing comma is not allowed here') && (\substr(\rtrim($code), -1) === ',');
}
}