Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / psy / psysh / src / Configuration.php
index 82d20eee28a06bfba0288da4980f9fb01e424a77..67c76e7b3d4cc6030fb1312cb9ef1caa6125cdca 100644 (file)
@@ -114,7 +114,7 @@ class Configuration
         // explicit configFile option
         if (isset($config['configFile'])) {
             $this->configFile = $config['configFile'];
-        } elseif ($configFile = getenv('PSYSH_CONFIG')) {
+        } elseif ($configFile = \getenv('PSYSH_CONFIG')) {
             $this->configFile = $configFile;
         }
 
@@ -145,8 +145,8 @@ class Configuration
     public function init()
     {
         // feature detection
-        $this->hasReadline = function_exists('readline');
-        $this->hasPcntl    = function_exists('pcntl_signal') && function_exists('posix_getpid');
+        $this->hasReadline = \function_exists('readline');
+        $this->hasPcntl    = \function_exists('pcntl_signal') && \function_exists('posix_getpid');
 
         if ($configFile = $this->getConfigFile()) {
             $this->loadConfigFile($configFile);
@@ -180,9 +180,9 @@ class Configuration
         $files = ConfigPaths::getConfigFiles(['config.php', 'rc.php'], $this->configDir);
 
         if (!empty($files)) {
-            if ($this->warnOnMultipleConfigs && count($files) > 1) {
-                $msg = sprintf('Multiple configuration files found: %s. Using %s', implode($files, ', '), $files[0]);
-                trigger_error($msg, E_USER_NOTICE);
+            if ($this->warnOnMultipleConfigs && \count($files) > 1) {
+                $msg = \sprintf('Multiple configuration files found: %s. Using %s', \implode($files, ', '), $files[0]);
+                \trigger_error($msg, E_USER_NOTICE);
             }
 
             return $files[0];
@@ -199,9 +199,9 @@ class Configuration
      */
     public function getLocalConfigFile()
     {
-        $localConfig = getcwd() . '/.psysh.php';
+        $localConfig = \getcwd() . '/.psysh.php';
 
-        if (@is_file($localConfig)) {
+        if (@\is_file($localConfig)) {
             return $localConfig;
         }
     }
@@ -215,7 +215,7 @@ class Configuration
     {
         foreach (self::$AVAILABLE_OPTIONS as $option) {
             if (isset($options[$option])) {
-                $method = 'set' . ucfirst($option);
+                $method = 'set' . \ucfirst($option);
                 $this->$method($options[$option]);
             }
         }
@@ -223,14 +223,14 @@ class Configuration
         // legacy `tabCompletion` option
         if (isset($options['tabCompletion'])) {
             $msg = '`tabCompletion` is deprecated; use `useTabCompletion` instead.';
-            @trigger_error($msg, E_USER_DEPRECATED);
+            @\trigger_error($msg, E_USER_DEPRECATED);
 
             $this->setUseTabCompletion($options['tabCompletion']);
         }
 
         foreach (['commands', 'matchers', 'casters'] as $option) {
             if (isset($options[$option])) {
-                $method = 'add' . ucfirst($option);
+                $method = 'add' . \ucfirst($option);
                 $this->$method($options[$option]);
             }
         }
@@ -238,7 +238,7 @@ class Configuration
         // legacy `tabCompletionMatchers` option
         if (isset($options['tabCompletionMatchers'])) {
             $msg = '`tabCompletionMatchers` is deprecated; use `matchers` instead.';
-            @trigger_error($msg, E_USER_DEPRECATED);
+            @\trigger_error($msg, E_USER_DEPRECATED);
 
             $this->addMatchers($options['tabCompletionMatchers']);
         }
@@ -267,7 +267,7 @@ class Configuration
         $result = $load($this);
 
         if (!empty($result)) {
-            if (is_array($result)) {
+            if (\is_array($result)) {
                 $this->loadConfig($result);
             } else {
                 throw new \InvalidArgumentException('Psy Shell configuration must return an array of options');
@@ -359,8 +359,8 @@ class Configuration
             $this->runtimeDir = ConfigPaths::getRuntimeDir();
         }
 
-        if (!is_dir($this->runtimeDir)) {
-            mkdir($this->runtimeDir, 0700, true);
+        if (!\is_dir($this->runtimeDir)) {
+            \mkdir($this->runtimeDir, 0700, true);
         }
 
         return $this->runtimeDir;
@@ -393,9 +393,9 @@ class Configuration
         $files = ConfigPaths::getConfigFiles(['psysh_history', 'history'], $this->configDir);
 
         if (!empty($files)) {
-            if ($this->warnOnMultipleConfigs && count($files) > 1) {
-                $msg = sprintf('Multiple history files found: %s. Using %s', implode($files, ', '), $files[0]);
-                trigger_error($msg, E_USER_NOTICE);
+            if ($this->warnOnMultipleConfigs && \count($files) > 1) {
+                $msg = \sprintf('Multiple history files found: %s. Using %s', \implode($files, ', '), $files[0]);
+                \trigger_error($msg, E_USER_NOTICE);
             }
 
             $this->setHistoryFile($files[0]);
@@ -462,7 +462,7 @@ class Configuration
      */
     public function getTempFile($type, $pid)
     {
-        return tempnam($this->getRuntimeDir(), $type . '_' . $pid . '_');
+        return \tempnam($this->getRuntimeDir(), $type . '_' . $pid . '_');
     }
 
     /**
@@ -477,7 +477,7 @@ class Configuration
      */
     public function getPipe($type, $pid)
     {
-        return sprintf('%s/%s_%s', $this->getRuntimeDir(), $type, $pid);
+        return \sprintf('%s/%s_%s', $this->getRuntimeDir(), $type, $pid);
     }
 
     /**
@@ -861,7 +861,7 @@ class Configuration
      */
     public function setPager($pager)
     {
-        if ($pager && !is_string($pager) && !$pager instanceof OutputPager) {
+        if ($pager && !\is_string($pager) && !$pager instanceof OutputPager) {
             throw new \InvalidArgumentException('Unexpected pager instance');
         }
 
@@ -879,10 +879,10 @@ class Configuration
     public function getPager()
     {
         if (!isset($this->pager) && $this->usePcntl()) {
-            if ($pager = ini_get('cli.pager')) {
-                // use the default pager (5.4+)
+            if ($pager = \ini_get('cli.pager')) {
+                // use the default pager
                 $this->pager = $pager;
-            } elseif ($less = exec('which less 2>/dev/null')) {
+            } elseif ($less = \exec('which less 2>/dev/null')) {
                 // check for the presence of less...
                 $this->pager = $less . ' -R -S -F -X';
             }
@@ -937,7 +937,7 @@ class Configuration
      */
     public function addMatchers(array $matchers)
     {
-        $this->newMatchers = array_merge($this->newMatchers, $matchers);
+        $this->newMatchers = \array_merge($this->newMatchers, $matchers);
         if (isset($this->shell)) {
             $this->doAddMatchers();
         }
@@ -977,7 +977,7 @@ class Configuration
      */
     public function addCommands(array $commands)
     {
-        $this->newCommands = array_merge($this->newCommands, $commands);
+        $this->newCommands = \array_merge($this->newCommands, $commands);
         if (isset($this->shell)) {
             $this->doAddCommands();
         }
@@ -1033,9 +1033,9 @@ class Configuration
 
         $files = ConfigPaths::getDataFiles(['php_manual.sqlite'], $this->dataDir);
         if (!empty($files)) {
-            if ($this->warnOnMultipleConfigs && count($files) > 1) {
-                $msg = sprintf('Multiple manual database files found: %s. Using %s', implode($files, ', '), $files[0]);
-                trigger_error($msg, E_USER_NOTICE);
+            if ($this->warnOnMultipleConfigs && \count($files) > 1) {
+                $msg = \sprintf('Multiple manual database files found: %s. Using %s', \implode($files, ', '), $files[0]);
+                \trigger_error($msg, E_USER_NOTICE);
             }
 
             return $this->manualDbFile = $files[0];
@@ -1051,7 +1051,7 @@ class Configuration
     {
         if (!isset($this->manualDb)) {
             $dbFile = $this->getManualDbFile();
-            if (is_file($dbFile)) {
+            if (\is_file($dbFile)) {
                 try {
                     $this->manualDb = new \PDO('sqlite:' . $dbFile);
                 } catch (\PDOException $e) {
@@ -1133,7 +1133,7 @@ class Configuration
             self::COLOR_MODE_DISABLED,
         ];
 
-        if (in_array($colorMode, $validColorModes)) {
+        if (\in_array($colorMode, $validColorModes)) {
             $this->colorMode = $colorMode;
         } else {
             throw new \InvalidArgumentException('invalid color mode: ' . $colorMode);
@@ -1226,7 +1226,7 @@ class Configuration
             Checker::NEVER,
         ];
 
-        if (!in_array($interval, $validIntervals)) {
+        if (!\in_array($interval, $validIntervals)) {
             throw new \InvalidArgumentException('invalid update check interval: ' . $interval);
         }