Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / psy / psysh / src / Readline / Transient.php
index 585189470e9e4689f3bae3e6a71366f955bd7dcb..6623bd9818f31a94918072c465f3cd3b4c83b058 100644 (file)
@@ -50,7 +50,7 @@ class Transient implements Readline
     public function addHistory($line)
     {
         if ($this->eraseDups) {
-            if (($key = array_search($line, $this->history)) !== false) {
+            if (($key = \array_search($line, $this->history)) !== false) {
                 unset($this->history[$key]);
             }
         }
@@ -58,13 +58,13 @@ class Transient implements Readline
         $this->history[] = $line;
 
         if ($this->historySize > 0) {
-            $histsize = count($this->history);
+            $histsize = \count($this->history);
             if ($histsize > $this->historySize) {
-                $this->history = array_slice($this->history, $histsize - $this->historySize);
+                $this->history = \array_slice($this->history, $histsize - $this->historySize);
             }
         }
 
-        $this->history = array_values($this->history);
+        $this->history = \array_values($this->history);
 
         return true;
     }
@@ -106,7 +106,7 @@ class Transient implements Readline
     {
         echo $prompt;
 
-        return rtrim(fgets($this->getStdin(), 1024));
+        return \rtrim(\fgets($this->getStdin()), "\n\r");
     }
 
     /**
@@ -135,10 +135,10 @@ class Transient implements Readline
     private function getStdin()
     {
         if (!isset($this->stdin)) {
-            $this->stdin = fopen('php://stdin', 'r');
+            $this->stdin = \fopen('php://stdin', 'r');
         }
 
-        if (feof($this->stdin)) {
+        if (\feof($this->stdin)) {
             throw new BreakException('Ctrl+D');
         }