Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / psy / psysh / src / Formatter / DocblockFormatter.php
index 33f450e1af50d5af6286301c94e2d2ef82372eeb..39ea60e54a9699b1defe129edd7bb795f066a924 100644 (file)
@@ -45,20 +45,20 @@ class DocblockFormatter implements Formatter
         if (!empty($docblock->tags)) {
             foreach ($docblock::$vectors as $name => $vector) {
                 if (isset($docblock->tags[$name])) {
-                    $chunks[] = sprintf('<comment>%s:</comment>', self::inflect($name));
+                    $chunks[] = \sprintf('<comment>%s:</comment>', self::inflect($name));
                     $chunks[] = self::formatVector($vector, $docblock->tags[$name]);
                     $chunks[] = '';
                 }
             }
 
-            $tags = self::formatTags(array_keys($docblock::$vectors), $docblock->tags);
+            $tags = self::formatTags(\array_keys($docblock::$vectors), $docblock->tags);
             if (!empty($tags)) {
                 $chunks[] = $tags;
                 $chunks[] = '';
             }
         }
 
-        return rtrim(implode("\n", $chunks));
+        return \rtrim(\implode("\n", $chunks));
     }
 
     /**
@@ -78,7 +78,7 @@ class DocblockFormatter implements Formatter
             $max = 0;
             foreach ($lines as $line) {
                 $chunk = $line[$type];
-                $cur = empty($chunk) ? 0 : strlen($chunk) + 1;
+                $cur = empty($chunk) ? 0 : \strlen($chunk) + 1;
                 if ($cur > $max) {
                     $max = $cur;
                 }
@@ -86,12 +86,12 @@ class DocblockFormatter implements Formatter
 
             $template[] = self::getVectorParamTemplate($type, $max);
         }
-        $template = implode(' ', $template);
+        $template = \implode(' ', $template);
 
-        return implode("\n", array_map(function ($line) use ($template) {
-            $escaped = array_map(['Symfony\Component\Console\Formatter\OutputFormatter', 'escape'], $line);
+        return \implode("\n", \array_map(function ($line) use ($template) {
+            $escaped = \array_map(['Symfony\Component\Console\Formatter\OutputFormatter', 'escape'], $line);
 
-            return rtrim(vsprintf($template, $escaped));
+            return \rtrim(\vsprintf($template, $escaped));
         }, $lines));
     }
 
@@ -108,18 +108,18 @@ class DocblockFormatter implements Formatter
         $chunks = [];
 
         foreach ($tags as $name => $values) {
-            if (in_array($name, $skip)) {
+            if (\in_array($name, $skip)) {
                 continue;
             }
 
             foreach ($values as $value) {
-                $chunks[] = sprintf('<comment>%s%s</comment> %s', self::inflect($name), empty($value) ? '' : ':', OutputFormatter::escape($value));
+                $chunks[] = \sprintf('<comment>%s%s</comment> %s', self::inflect($name), empty($value) ? '' : ':', OutputFormatter::escape($value));
             }
 
             $chunks[] = '';
         }
 
-        return implode("\n", $chunks);
+        return \implode("\n", $chunks);
     }
 
     /**
@@ -133,10 +133,10 @@ class DocblockFormatter implements Formatter
     private static function getVectorParamTemplate($type, $max)
     {
         if (!isset(self::$vectorParamTemplates[$type])) {
-            return sprintf('%%-%ds', $max);
+            return \sprintf('%%-%ds', $max);
         }
 
-        return sprintf('<%s>%%-%ds</%s>', self::$vectorParamTemplates[$type], $max, self::$vectorParamTemplates[$type]);
+        return \sprintf('<%s>%%-%ds</%s>', self::$vectorParamTemplates[$type], $max, self::$vectorParamTemplates[$type]);
     }
 
     /**
@@ -149,7 +149,7 @@ class DocblockFormatter implements Formatter
      */
     private static function indent($text, $indent = '  ')
     {
-        return $indent . str_replace("\n", "\n" . $indent, $text);
+        return $indent . \str_replace("\n", "\n" . $indent, $text);
     }
 
     /**
@@ -161,8 +161,8 @@ class DocblockFormatter implements Formatter
      */
     private static function inflect($text)
     {
-        $words = trim(preg_replace('/[\s_-]+/', ' ', preg_replace('/([a-z])([A-Z])/', '$1 $2', $text)));
+        $words = \trim(\preg_replace('/[\s_-]+/', ' ', \preg_replace('/([a-z])([A-Z])/', '$1 $2', $text)));
 
-        return implode(' ', array_map('ucfirst', explode(' ', $words)));
+        return \implode(' ', \array_map('ucfirst', \explode(' ', $words)));
     }
 }