Mercurial > hg > cmmr2012-drupal-site
diff vendor/psy/psysh/src/Command/WhereamiCommand.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children |
line wrap: on
line diff
--- a/vendor/psy/psysh/src/Command/WhereamiCommand.php Thu Feb 28 11:14:44 2019 +0000 +++ b/vendor/psy/psysh/src/Command/WhereamiCommand.php Thu Feb 28 13:11:55 2019 +0000 @@ -33,7 +33,7 @@ public function __construct($colorMode = null) { $this->colorMode = $colorMode ?: Configuration::COLOR_MODE_AUTO; - $this->backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + $this->backtrace = \debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); parent::__construct(); } @@ -69,13 +69,13 @@ */ protected function trace() { - foreach (array_reverse($this->backtrace) as $stackFrame) { + foreach (\array_reverse($this->backtrace) as $stackFrame) { if ($this->isDebugCall($stackFrame)) { return $stackFrame; } } - return end($this->backtrace); + return \end($this->backtrace); } private static function isDebugCall(array $stackFrame) @@ -84,7 +84,7 @@ $function = isset($stackFrame['function']) ? $stackFrame['function'] : null; return ($class === null && $function === 'Psy\debug') || - ($class === 'Psy\Shell' && in_array($function, ['__construct', 'debug'])); + ($class === 'Psy\Shell' && \in_array($function, ['__construct', 'debug'])); } /** @@ -95,8 +95,8 @@ protected function fileInfo() { $stackFrame = $this->trace(); - 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); $file = $matches[1][0]; $line = (int) $matches[2][0]; } else { @@ -104,7 +104,7 @@ $line = $stackFrame['line']; } - return compact('file', 'line'); + return \compact('file', 'line'); } /** @@ -117,11 +117,11 @@ $factory = new ConsoleColorFactory($this->colorMode); $colors = $factory->getConsoleColor(); $highlighter = new Highlighter($colors); - $contents = file_get_contents($info['file']); + $contents = \file_get_contents($info['file']); $output->startPaging(); $output->writeln(''); - $output->writeln(sprintf('From <info>%s:%s</info>:', $this->replaceCwd($info['file']), $info['line'])); + $output->writeln(\sprintf('From <info>%s:%s</info>:', $this->replaceCwd($info['file']), $info['line'])); $output->writeln(''); $output->write($highlighter->getCodeSnippet($contents, $info['line'], $num, $num), ShellOutput::OUTPUT_RAW); $output->stopPaging(); @@ -136,13 +136,13 @@ */ private function replaceCwd($file) { - $cwd = getcwd(); + $cwd = \getcwd(); if ($cwd === false) { return $file; } - $cwd = rtrim($cwd, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + $cwd = \rtrim($cwd, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; - return preg_replace('/^' . preg_quote($cwd, '/') . '/', '', $file); + return \preg_replace('/^' . \preg_quote($cwd, '/') . '/', '', $file); } }