diff vendor/psy/psysh/src/Formatter/SignatureFormatter.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents c2387f117808
children
line wrap: on
line diff
--- a/vendor/psy/psysh/src/Formatter/SignatureFormatter.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/psy/psysh/src/Formatter/SignatureFormatter.php	Thu Feb 28 13:21:36 2019 +0000
@@ -56,7 +56,7 @@
                 return self::formatConstant($reflector);
 
             default:
-                throw new \InvalidArgumentException('Unexpected Reflector class: ' . get_class($reflector));
+                throw new \InvalidArgumentException('Unexpected Reflector class: ' . \get_class($reflector));
         }
     }
 
@@ -84,13 +84,13 @@
         if ($reflector instanceof \ReflectionClass && $reflector->isTrait()) {
             // For some reason, PHP 5.x returns `abstract public` modifiers for
             // traits. Let's just ignore that business entirely.
-            if (version_compare(PHP_VERSION, '7.0.0', '<')) {
+            if (\version_compare(PHP_VERSION, '7.0.0', '<')) {
                 return [];
             }
         }
 
-        return implode(' ', array_map(function ($modifier) {
-            return sprintf('<keyword>%s</keyword>', $modifier);
+        return \implode(' ', \array_map(function ($modifier) {
+            return \sprintf('<keyword>%s</keyword>', $modifier);
         }, \Reflection::getModifierNames($reflector->getModifiers())));
     }
 
@@ -115,24 +115,24 @@
             $chunks[] = $reflector->isInterface() ? 'interface' : 'class';
         }
 
-        $chunks[] = sprintf('<class>%s</class>', self::formatName($reflector));
+        $chunks[] = \sprintf('<class>%s</class>', self::formatName($reflector));
 
         if ($parent = $reflector->getParentClass()) {
             $chunks[] = 'extends';
-            $chunks[] = sprintf('<class>%s</class>', $parent->getName());
+            $chunks[] = \sprintf('<class>%s</class>', $parent->getName());
         }
 
         $interfaces = $reflector->getInterfaceNames();
         if (!empty($interfaces)) {
-            sort($interfaces);
+            \sort($interfaces);
 
             $chunks[] = 'implements';
-            $chunks[] = implode(', ', array_map(function ($name) {
-                return sprintf('<class>%s</class>', $name);
+            $chunks[] = \implode(', ', \array_map(function ($name) {
+                return \sprintf('<class>%s</class>', $name);
             }, $interfaces));
         }
 
-        return implode(' ', $chunks);
+        return \implode(' ', $chunks);
     }
 
     /**
@@ -147,7 +147,7 @@
         $value = $reflector->getValue();
         $style = self::getTypeStyle($value);
 
-        return sprintf(
+        return \sprintf(
             '<keyword>const</keyword> <const>%s</const> = <%s>%s</%s>',
             self::formatName($reflector),
             $style,
@@ -168,7 +168,7 @@
         $value = $reflector->getValue();
         $style = self::getTypeStyle($value);
 
-        return sprintf(
+        return \sprintf(
             '<keyword>define</keyword>(<string>%s</string>, <%s>%s</%s>)',
             OutputFormatter::escape(Json::encode($reflector->getName())),
             $style,
@@ -186,11 +186,11 @@
      */
     private static function getTypeStyle($value)
     {
-        if (is_int($value) || is_float($value)) {
+        if (\is_int($value) || \is_float($value)) {
             return 'number';
-        } elseif (is_string($value)) {
+        } elseif (\is_string($value)) {
             return 'string';
-        } elseif (is_bool($value) || is_null($value)) {
+        } elseif (\is_bool($value) || \is_null($value)) {
             return 'bool';
         } else {
             return 'strong'; // @codeCoverageIgnore
@@ -206,7 +206,7 @@
      */
     private static function formatProperty(\ReflectionProperty $reflector)
     {
-        return sprintf(
+        return \sprintf(
             '%s <strong>$%s</strong>',
             self::formatModifiers($reflector),
             $reflector->getName()
@@ -222,11 +222,11 @@
      */
     private static function formatFunction(\ReflectionFunctionAbstract $reflector)
     {
-        return sprintf(
+        return \sprintf(
             '<keyword>function</keyword> %s<function>%s</function>(%s)',
             $reflector->returnsReference() ? '&' : '',
             self::formatName($reflector),
-            implode(', ', self::formatFunctionParams($reflector))
+            \implode(', ', self::formatFunctionParams($reflector))
         );
     }
 
@@ -239,7 +239,7 @@
      */
     private static function formatMethod(\ReflectionMethod $reflector)
     {
-        return sprintf(
+        return \sprintf(
             '%s %s',
             self::formatModifiers($reflector),
             self::formatFunction($reflector)
@@ -262,7 +262,7 @@
                 if ($param->isArray()) {
                     $hint = '<keyword>array</keyword> ';
                 } elseif ($class = $param->getClass()) {
-                    $hint = sprintf('<class>%s</class> ', $class->getName());
+                    $hint = \sprintf('<class>%s</class> ', $class->getName());
                 }
             } catch (\Exception $e) {
                 // sometimes we just don't know...
@@ -272,11 +272,11 @@
                 // Hax: we'll try to extract it :P
 
                 // @codeCoverageIgnoreStart
-                $chunks = explode('$' . $param->getName(), (string) $param);
-                $chunks = explode(' ', trim($chunks[0]));
-                $guess  = end($chunks);
+                $chunks = \explode('$' . $param->getName(), (string) $param);
+                $chunks = \explode(' ', \trim($chunks[0]));
+                $guess  = \end($chunks);
 
-                $hint = sprintf('<urgent>%s</urgent> ', $guess);
+                $hint = \sprintf('<urgent>%s</urgent> ', $guess);
                 // @codeCoverageIgnoreEnd
             }
 
@@ -287,14 +287,14 @@
                 } else {
                     $value     = $param->getDefaultValue();
                     $typeStyle = self::getTypeStyle($value);
-                    $value     = is_array($value) ? 'array()' : is_null($value) ? 'null' : var_export($value, true);
+                    $value     = \is_array($value) ? 'array()' : \is_null($value) ? 'null' : \var_export($value, true);
                 }
-                $default = sprintf(' = <%s>%s</%s>', $typeStyle, OutputFormatter::escape($value), $typeStyle);
+                $default = \sprintf(' = <%s>%s</%s>', $typeStyle, OutputFormatter::escape($value), $typeStyle);
             } else {
                 $default = '';
             }
 
-            $params[] = sprintf(
+            $params[] = \sprintf(
                 '%s%s<strong>$%s</strong>%s',
                 $param->isPassedByReference() ? '&' : '',
                 $hint,