Update to Drupal 8.2.6. For more information, see https://www.drupal.org/project/drupal/releases/8.2.6

This commit is contained in:
Pantheon Automation 2017-02-02 16:28:38 -08:00 committed by Greg Anderson
parent db56c09587
commit f1e72395cb
588 changed files with 26857 additions and 2777 deletions

View file

@ -46,8 +46,8 @@ class ArgvInput extends Input
/**
* Constructor.
*
* @param array $argv An array of parameters from the CLI (in the argv format)
* @param InputDefinition $definition A InputDefinition instance
* @param array|null $argv An array of parameters from the CLI (in the argv format)
* @param InputDefinition|null $definition A InputDefinition instance
*/
public function __construct(array $argv = null, InputDefinition $definition = null)
{
@ -69,7 +69,7 @@ class ArgvInput extends Input
}
/**
* Processes command line arguments.
* {@inheritdoc}
*/
protected function parse()
{
@ -93,7 +93,7 @@ class ArgvInput extends Input
/**
* Parses a short option.
*
* @param string $token The current token.
* @param string $token The current token
*/
private function parseShortOption($token)
{
@ -147,7 +147,10 @@ class ArgvInput extends Input
$name = substr($token, 2);
if (false !== $pos = strpos($name, '=')) {
$this->addLongOption(substr($name, 0, $pos), substr($name, $pos + 1));
if (0 === strlen($value = substr($name, $pos + 1))) {
array_unshift($this->parsed, null);
}
$this->addLongOption(substr($name, 0, $pos), $value);
} else {
$this->addLongOption($name, null);
}
@ -176,7 +179,12 @@ class ArgvInput extends Input
// unexpected argument
} else {
throw new RuntimeException('Too many arguments.');
$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));
}
}
@ -229,7 +237,7 @@ class ArgvInput extends Input
if (isset($next[0]) && '-' !== $next[0]) {
$value = $next;
} elseif (empty($next)) {
$value = '';
$value = null;
} else {
array_unshift($this->parsed, $next);
}
@ -253,9 +261,7 @@ class ArgvInput extends Input
}
/**
* Returns the first argument from the raw parameters (not parsed).
*
* @return string The value of the first argument or null otherwise
* {@inheritdoc}
*/
public function getFirstArgument()
{
@ -269,14 +275,7 @@ class ArgvInput extends Input
}
/**
* Returns true if the raw parameters (not parsed) contain a value.
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
*
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
*
* @return bool true if the value is contained in the raw parameters
* {@inheritdoc}
*/
public function hasParameterOption($values)
{
@ -294,15 +293,7 @@ class ArgvInput extends Input
}
/**
* Returns the value of a raw option (not parsed).
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
*
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
* @param mixed $default The default value to return if no result is found
*
* @return mixed The option value
* {@inheritdoc}
*/
public function getParameterOption($values, $default = false)
{

View file

@ -30,8 +30,8 @@ class ArrayInput extends Input
/**
* Constructor.
*
* @param array $parameters An array of parameters
* @param InputDefinition $definition A InputDefinition instance
* @param array $parameters An array of parameters
* @param InputDefinition|null $definition A InputDefinition instance
*/
public function __construct(array $parameters, InputDefinition $definition = null)
{
@ -41,9 +41,7 @@ class ArrayInput extends Input
}
/**
* Returns the first argument from the raw parameters (not parsed).
*
* @return string The value of the first argument or null otherwise
* {@inheritdoc}
*/
public function getFirstArgument()
{
@ -57,14 +55,7 @@ class ArrayInput extends Input
}
/**
* Returns true if the raw parameters (not parsed) contain a value.
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
*
* @param string|array $values The values to look for in the raw parameters (can be an array)
*
* @return bool true if the value is contained in the raw parameters
* {@inheritdoc}
*/
public function hasParameterOption($values)
{
@ -84,15 +75,7 @@ class ArrayInput extends Input
}
/**
* Returns the value of a raw option (not parsed).
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
*
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
* @param mixed $default The default value to return if no result is found
*
* @return mixed The option value
* {@inheritdoc}
*/
public function getParameterOption($values, $default = false)
{
@ -131,7 +114,7 @@ class ArrayInput extends Input
}
/**
* Processes command line arguments.
* {@inheritdoc}
*/
protected function parse()
{

View file

@ -38,7 +38,7 @@ abstract class Input implements InputInterface
/**
* Constructor.
*
* @param InputDefinition $definition A InputDefinition instance
* @param InputDefinition|null $definition A InputDefinition instance
*/
public function __construct(InputDefinition $definition = null)
{
@ -51,9 +51,7 @@ abstract class Input implements InputInterface
}
/**
* Binds the current Input instance with the given arguments and options.
*
* @param InputDefinition $definition A InputDefinition instance
* {@inheritdoc}
*/
public function bind(InputDefinition $definition)
{
@ -70,9 +68,7 @@ abstract class Input implements InputInterface
abstract protected function parse();
/**
* Validates the input.
*
* @throws RuntimeException When not enough arguments are given
* {@inheritdoc}
*/
public function validate()
{
@ -89,9 +85,7 @@ abstract class Input implements InputInterface
}
/**
* Checks if the input is interactive.
*
* @return bool Returns true if the input is interactive
* {@inheritdoc}
*/
public function isInteractive()
{
@ -99,9 +93,7 @@ abstract class Input implements InputInterface
}
/**
* Sets the input interactivity.
*
* @param bool $interactive If the input should be interactive
* {@inheritdoc}
*/
public function setInteractive($interactive)
{
@ -109,9 +101,7 @@ abstract class Input implements InputInterface
}
/**
* Returns the argument values.
*
* @return array An array of argument values
* {@inheritdoc}
*/
public function getArguments()
{
@ -119,13 +109,7 @@ abstract class Input implements InputInterface
}
/**
* Returns the argument value for a given argument name.
*
* @param string $name The argument name
*
* @return mixed The argument value
*
* @throws InvalidArgumentException When argument given doesn't exist
* {@inheritdoc}
*/
public function getArgument($name)
{
@ -137,12 +121,7 @@ abstract class Input implements InputInterface
}
/**
* Sets an argument value by name.
*
* @param string $name The argument name
* @param string $value The argument value
*
* @throws InvalidArgumentException When argument given doesn't exist
* {@inheritdoc}
*/
public function setArgument($name, $value)
{
@ -154,11 +133,7 @@ abstract class Input implements InputInterface
}
/**
* Returns true if an InputArgument object exists by name or position.
*
* @param string|int $name The InputArgument name or position
*
* @return bool true if the InputArgument object exists, false otherwise
* {@inheritdoc}
*/
public function hasArgument($name)
{
@ -166,9 +141,7 @@ abstract class Input implements InputInterface
}
/**
* Returns the options values.
*
* @return array An array of option values
* {@inheritdoc}
*/
public function getOptions()
{
@ -176,13 +149,7 @@ abstract class Input implements InputInterface
}
/**
* Returns the option value for a given option name.
*
* @param string $name The option name
*
* @return mixed The option value
*
* @throws InvalidArgumentException When option given doesn't exist
* {@inheritdoc}
*/
public function getOption($name)
{
@ -194,12 +161,7 @@ abstract class Input implements InputInterface
}
/**
* Sets an option value by name.
*
* @param string $name The option name
* @param string|bool $value The option value
*
* @throws InvalidArgumentException When option given doesn't exist
* {@inheritdoc}
*/
public function setOption($name, $value)
{
@ -211,11 +173,7 @@ abstract class Input implements InputInterface
}
/**
* Returns true if an InputOption object exists by name.
*
* @param string $name The InputOption name
*
* @return bool true if the InputOption object exists, false otherwise
* {@inheritdoc}
*/
public function hasOption($name)
{

View file

@ -284,6 +284,9 @@ class InputDefinition
/**
* Returns true if an InputOption object exists by name.
*
* This method can't be used to check if the user included the option when
* executing the command (use getOption() instead).
*
* @param string $name The InputOption name
*
* @return bool true if the InputOption object exists, false otherwise

View file

@ -11,6 +11,9 @@
namespace Symfony\Component\Console\Input;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\RuntimeException;
/**
* InputInterface is the interface implemented by all input classes.
*
@ -58,11 +61,9 @@ interface InputInterface
public function bind(InputDefinition $definition);
/**
* Validates if arguments given are correct.
* Validates the input.
*
* Throws an exception when not enough arguments are given.
*
* @throws \RuntimeException
* @throws RuntimeException When not enough arguments are given
*/
public function validate();
@ -74,11 +75,13 @@ interface InputInterface
public function getArguments();
/**
* Gets argument by name.
* Returns the argument value for a given argument name.
*
* @param string $name The name of the argument
* @param string $name The argument name
*
* @return mixed
* @return mixed The argument value
*
* @throws InvalidArgumentException When argument given doesn't exist
*/
public function getArgument($name);
@ -109,11 +112,13 @@ interface InputInterface
public function getOptions();
/**
* Gets an option by name.
* Returns the option value for a given option name.
*
* @param string $name The name of the option
* @param string $name The option name
*
* @return mixed
* @return mixed The option value
*
* @throws InvalidArgumentException When option given doesn't exist
*/
public function getOption($name);