Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / psy / psysh / src / Command / WhereamiCommand.php
index c2b27843b809cd6cd8aac7bdaf43977a4b626903..98593d13aa5126b8efdde2b3728bdc27a36637bf 100644 (file)
@@ -33,7 +33,7 @@ class WhereamiCommand extends Command
     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 @@ HELP
      */
     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 @@ HELP
         $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 @@ HELP
     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 @@ HELP
             $line = $stackFrame['line'];
         }
 
-        return compact('file', 'line');
+        return \compact('file', 'line');
     }
 
     /**
@@ -117,11 +117,11 @@ HELP
         $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 @@ HELP
      */
     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);
     }
 }