Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
38
vendor/symfony/console/Command/Command.php
vendored
38
vendor/symfony/console/Command/Command.php
vendored
|
@ -13,6 +13,7 @@ namespace Symfony\Component\Console\Command;
|
|||
|
||||
use Symfony\Component\Console\Descriptor\TextDescriptor;
|
||||
use Symfony\Component\Console\Descriptor\XmlDescriptor;
|
||||
use Symfony\Component\Console\Exception\ExceptionInterface;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
@ -21,6 +22,8 @@ use Symfony\Component\Console\Output\BufferedOutput;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Helper\HelperSet;
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Exception\LogicException;
|
||||
|
||||
/**
|
||||
* Base class for all commands.
|
||||
|
@ -49,7 +52,7 @@ class Command
|
|||
*
|
||||
* @param string|null $name The name of the command; passing null means it must be set in configure()
|
||||
*
|
||||
* @throws \LogicException When the command name is empty
|
||||
* @throws LogicException When the command name is empty
|
||||
*/
|
||||
public function __construct($name = null)
|
||||
{
|
||||
|
@ -62,7 +65,7 @@ class Command
|
|||
$this->configure();
|
||||
|
||||
if (!$this->name) {
|
||||
throw new \LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this)));
|
||||
throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,13 +157,13 @@ class Command
|
|||
*
|
||||
* @return null|int null or 0 if everything went fine, or an error code
|
||||
*
|
||||
* @throws \LogicException When this abstract method is not implemented
|
||||
* @throws LogicException When this abstract method is not implemented
|
||||
*
|
||||
* @see setCode()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
throw new \LogicException('You must override the execute() method in the concrete command class.');
|
||||
throw new LogicException('You must override the execute() method in the concrete command class.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -219,7 +222,7 @@ class Command
|
|||
// bind the input against the command specific arguments/options
|
||||
try {
|
||||
$input->bind($this->definition);
|
||||
} catch (\Exception $e) {
|
||||
} catch (ExceptionInterface $e) {
|
||||
if (!$this->ignoreValidationErrors) {
|
||||
throw $e;
|
||||
}
|
||||
|
@ -269,14 +272,21 @@ class Command
|
|||
*
|
||||
* @return Command The current instance
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @see execute()
|
||||
*/
|
||||
public function setCode($code)
|
||||
{
|
||||
if (!is_callable($code)) {
|
||||
throw new \InvalidArgumentException('Invalid callable provided to Command::setCode.');
|
||||
throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
|
||||
}
|
||||
|
||||
if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
|
||||
$r = new \ReflectionFunction($code);
|
||||
if (null === $r->getClosureThis()) {
|
||||
$code = \Closure::bind($code, $this);
|
||||
}
|
||||
}
|
||||
|
||||
$this->code = $code;
|
||||
|
@ -380,7 +390,7 @@ class Command
|
|||
* @param string $shortcut The shortcut (can be null)
|
||||
* @param int $mode The option mode: One of the InputOption::VALUE_* constants
|
||||
* @param string $description A description text
|
||||
* @param mixed $default The default value (must be null for InputOption::VALUE_REQUIRED or InputOption::VALUE_NONE)
|
||||
* @param mixed $default The default value (must be null for InputOption::VALUE_NONE)
|
||||
*
|
||||
* @return Command The current instance
|
||||
*/
|
||||
|
@ -403,7 +413,7 @@ class Command
|
|||
*
|
||||
* @return Command The current instance
|
||||
*
|
||||
* @throws \InvalidArgumentException When the name is invalid
|
||||
* @throws InvalidArgumentException When the name is invalid
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
|
@ -520,12 +530,12 @@ class Command
|
|||
*
|
||||
* @return Command The current instance
|
||||
*
|
||||
* @throws \InvalidArgumentException When an alias is invalid
|
||||
* @throws InvalidArgumentException When an alias is invalid
|
||||
*/
|
||||
public function setAliases($aliases)
|
||||
{
|
||||
if (!is_array($aliases) && !$aliases instanceof \Traversable) {
|
||||
throw new \InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
|
||||
throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
|
||||
}
|
||||
|
||||
foreach ($aliases as $alias) {
|
||||
|
@ -598,7 +608,7 @@ class Command
|
|||
*
|
||||
* @return mixed The helper value
|
||||
*
|
||||
* @throws \InvalidArgumentException if the helper is not defined
|
||||
* @throws InvalidArgumentException if the helper is not defined
|
||||
*/
|
||||
public function getHelper($name)
|
||||
{
|
||||
|
@ -655,12 +665,12 @@ class Command
|
|||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @throws \InvalidArgumentException When the name is invalid
|
||||
* @throws InvalidArgumentException When the name is invalid
|
||||
*/
|
||||
private function validateName($name)
|
||||
{
|
||||
if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
|
||||
throw new \InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
|
||||
throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class HelpCommand extends Command
|
|||
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
|
||||
))
|
||||
->setDescription('Displays help for a command')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command displays help for a given command:
|
||||
|
||||
<info>php %command.full_name% list</info>
|
||||
|
|
|
@ -34,7 +34,7 @@ class ListCommand extends Command
|
|||
->setName('list')
|
||||
->setDefinition($this->createDefinition())
|
||||
->setDescription('Lists commands')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command lists all commands:
|
||||
|
||||
<info>php %command.full_name%</info>
|
||||
|
|
Reference in a new issue