Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / psy / psysh / src / TabCompletion / AutoCompleter.php
index bf538106a651cfb28ac59d24714aad08982e047f..0751aa78bf91cbec3b441e521117cef53718dc8e 100644 (file)
@@ -38,7 +38,7 @@ class AutoCompleter
      */
     public function activate()
     {
-        readline_completion_function([&$this, 'callback']);
+        \readline_completion_function([&$this, 'callback']);
     }
 
     /**
@@ -56,27 +56,27 @@ class AutoCompleter
         // try to work around it.
         $line = $info['line_buffer'];
         if (isset($info['end'])) {
-            $line = substr($line, 0, $info['end']);
+            $line = \substr($line, 0, $info['end']);
         }
         if ($line === '' && $input !== '') {
             $line = $input;
         }
 
-        $tokens = token_get_all('<?php ' . $line);
+        $tokens = \token_get_all('<?php ' . $line);
 
         // remove whitespaces
-        $tokens = array_filter($tokens, function ($token) {
+        $tokens = \array_filter($tokens, function ($token) {
             return !AbstractMatcher::tokenIs($token, AbstractMatcher::T_WHITESPACE);
         });
 
         $matches = [];
         foreach ($this->matchers as $matcher) {
             if ($matcher->hasMatched($tokens)) {
-                $matches = array_merge($matcher->getMatches($tokens), $matches);
+                $matches = \array_merge($matcher->getMatches($tokens), $matches);
             }
         }
 
-        $matches = array_unique($matches);
+        $matches = \array_unique($matches);
 
         return !empty($matches) ? $matches : [''];
     }
@@ -93,7 +93,7 @@ class AutoCompleter
      */
     public function callback($input, $index)
     {
-        return $this->processCallback($input, $index, readline_info());
+        return $this->processCallback($input, $index, \readline_info());
     }
 
     /**
@@ -103,10 +103,8 @@ class AutoCompleter
     {
         // PHP didn't implement the whole readline API when they first switched
         // to libedit. And they still haven't.
-        //
-        // So this is a thing to make PsySH work on 5.3.x:
-        if (function_exists('readline_callback_handler_remove')) {
-            readline_callback_handler_remove();
+        if (\function_exists('readline_callback_handler_remove')) {
+            \readline_callback_handler_remove();
         }
     }
 }