Security update for Core, with self-updated composer
[yaffs-website] / vendor / psy / psysh / src / Psy / Input / ShellInput.php
index e25db4618f387daebd10be98bc796af6bbc58f18..68a4252a2205dbef059293b19aee59ae0e5fe0be 100644 (file)
@@ -50,7 +50,7 @@ class ShellInput extends StringInput
         $hasCodeArgument = false;
 
         if ($definition->getArgumentCount() > 0) {
-            $args = $definition->getArguments();
+            $args    = $definition->getArguments();
             $lastArg = array_pop($args);
             foreach ($args as $arg) {
                 if ($arg instanceof CodeArgument) {
@@ -165,20 +165,24 @@ class ShellInput extends StringInput
                 $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
             }
 
+            return;
+        }
+
         // if last argument isArray(), append token to last argument
-        } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
+        if ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
             $arg = $this->definition->getArgument($c - 1);
             $this->arguments[$arg->getName()][] = $token;
 
-        // unexpected argument
-        } else {
-            $all = $this->definition->getArguments();
-            if (count($all)) {
-                throw new \RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
-            }
+            return;
+        }
 
-            throw new \RuntimeException(sprintf('No arguments expected, got "%s".', $token));
+        // unexpected argument
+        $all = $this->definition->getArguments();
+        if (count($all)) {
+            throw new \RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
         }
+
+        throw new \RuntimeException(sprintf('No arguments expected, got "%s".', $token));
     }
 
     // Everything below this is copypasta from ArgvInput private methods
@@ -214,7 +218,7 @@ class ShellInput extends StringInput
     private function parseShortOptionSet($name)
     {
         $len = strlen($name);
-        for ($i = 0; $i < $len; ++$i) {
+        for ($i = 0; $i < $len; $i++) {
             if (!$this->definition->hasShortcut($name[$i])) {
                 throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
             }