Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
140
vendor/symfony/console/Application.php
vendored
140
vendor/symfony/console/Application.php
vendored
@@ -17,11 +17,11 @@ use Symfony\Component\Console\Command\ListCommand;
|
||||
use Symfony\Component\Console\CommandLoader\CommandLoaderInterface;
|
||||
use Symfony\Component\Console\Event\ConsoleCommandEvent;
|
||||
use Symfony\Component\Console\Event\ConsoleErrorEvent;
|
||||
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
|
||||
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
|
||||
use Symfony\Component\Console\Exception\CommandNotFoundException;
|
||||
use Symfony\Component\Console\Exception\ExceptionInterface;
|
||||
use Symfony\Component\Console\Exception\LogicException;
|
||||
use Symfony\Component\Console\Exception\NamespaceNotFoundException;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||
use Symfony\Component\Console\Helper\DebugFormatterHelper;
|
||||
use Symfony\Component\Console\Helper\FormatterHelper;
|
||||
@@ -40,6 +40,7 @@ use Symfony\Component\Console\Input\StreamableInputInterface;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Debug\ErrorHandler;
|
||||
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
@@ -81,7 +82,7 @@ class Application
|
||||
* @param string $name The name of the application
|
||||
* @param string $version The version of the application
|
||||
*/
|
||||
public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
|
||||
public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN')
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->version = $version;
|
||||
@@ -138,10 +139,6 @@ class Application
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $this->dispatcher && $this->dispatcher->hasListeners(ConsoleEvents::EXCEPTION)) {
|
||||
@trigger_error(sprintf('The "ConsoleEvents::EXCEPTION" event is deprecated since Symfony 3.3 and will be removed in 4.0. Listen to the "ConsoleEvents::ERROR" event instead.'), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->configureIO($input, $output);
|
||||
|
||||
try {
|
||||
@@ -224,24 +221,41 @@ class Application
|
||||
}
|
||||
|
||||
try {
|
||||
$e = $this->runningCommand = null;
|
||||
$this->runningCommand = null;
|
||||
// the command name MUST be the first element of the input
|
||||
$command = $this->find($name);
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Throwable $e) {
|
||||
}
|
||||
if (null !== $e) {
|
||||
if (null !== $this->dispatcher) {
|
||||
$event = new ConsoleErrorEvent($input, $output, $e);
|
||||
$this->dispatcher->dispatch(ConsoleEvents::ERROR, $event);
|
||||
$e = $event->getError();
|
||||
if (!($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException) || 1 !== \count($alternatives = $e->getAlternatives()) || !$input->isInteractive()) {
|
||||
if (null !== $this->dispatcher) {
|
||||
$event = new ConsoleErrorEvent($input, $output, $e);
|
||||
$this->dispatcher->dispatch(ConsoleEvents::ERROR, $event);
|
||||
|
||||
if (0 === $event->getExitCode()) {
|
||||
return 0;
|
||||
if (0 === $event->getExitCode()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$e = $event->getError();
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
$alternative = $alternatives[0];
|
||||
|
||||
$style = new SymfonyStyle($input, $output);
|
||||
$style->block(sprintf("\nCommand \"%s\" is not defined.\n", $name), null, 'error');
|
||||
if (!$style->confirm(sprintf('Do you want to run "%s" instead? ', $alternative), false)) {
|
||||
if (null !== $this->dispatcher) {
|
||||
$event = new ConsoleErrorEvent($input, $output, $e);
|
||||
$this->dispatcher->dispatch(ConsoleEvents::ERROR, $event);
|
||||
|
||||
return $event->getExitCode();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
$command = $this->find($alternative);
|
||||
}
|
||||
|
||||
$this->runningCommand = $command;
|
||||
@@ -540,7 +554,7 @@ class Application
|
||||
*
|
||||
* @return string A registered namespace
|
||||
*
|
||||
* @throws CommandNotFoundException When namespace is incorrect or ambiguous
|
||||
* @throws NamespaceNotFoundException When namespace is incorrect or ambiguous
|
||||
*/
|
||||
public function findNamespace($namespace)
|
||||
{
|
||||
@@ -561,12 +575,12 @@ class Application
|
||||
$message .= implode("\n ", $alternatives);
|
||||
}
|
||||
|
||||
throw new CommandNotFoundException($message, $alternatives);
|
||||
throw new NamespaceNotFoundException($message, $alternatives);
|
||||
}
|
||||
|
||||
$exact = \in_array($namespace, $namespaces, true);
|
||||
if (\count($namespaces) > 1 && !$exact) {
|
||||
throw new CommandNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
|
||||
throw new NamespaceNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
|
||||
}
|
||||
|
||||
return $exact ? $namespace : reset($namespaces);
|
||||
@@ -746,10 +760,6 @@ class Application
|
||||
}
|
||||
|
||||
$width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : PHP_INT_MAX;
|
||||
// HHVM only accepts 32 bits integer in str_split, even when PHP_INT_MAX is a 64 bit integer: https://github.com/facebook/hhvm/issues/1327
|
||||
if (\defined('HHVM_VERSION') && $width > 1 << 31) {
|
||||
$width = 1 << 31;
|
||||
}
|
||||
$lines = array();
|
||||
foreach ('' !== $message ? preg_split('/\r?\n/', $message) : array() as $line) {
|
||||
foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
|
||||
@@ -798,70 +808,6 @@ class Application
|
||||
} while ($e = $e->getPrevious());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to figure out the terminal width in which this application runs.
|
||||
*
|
||||
* @return int|null
|
||||
*
|
||||
* @deprecated since version 3.2, to be removed in 4.0. Create a Terminal instance instead.
|
||||
*/
|
||||
protected function getTerminalWidth()
|
||||
{
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
return $this->terminal->getWidth();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to figure out the terminal height in which this application runs.
|
||||
*
|
||||
* @return int|null
|
||||
*
|
||||
* @deprecated since version 3.2, to be removed in 4.0. Create a Terminal instance instead.
|
||||
*/
|
||||
protected function getTerminalHeight()
|
||||
{
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
return $this->terminal->getHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to figure out the terminal dimensions based on the current environment.
|
||||
*
|
||||
* @return array Array containing width and height
|
||||
*
|
||||
* @deprecated since version 3.2, to be removed in 4.0. Create a Terminal instance instead.
|
||||
*/
|
||||
public function getTerminalDimensions()
|
||||
{
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
return array($this->terminal->getWidth(), $this->terminal->getHeight());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets terminal dimensions.
|
||||
*
|
||||
* Can be useful to force terminal dimensions for functional tests.
|
||||
*
|
||||
* @param int $width The width
|
||||
* @param int $height The height
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since version 3.2, to be removed in 4.0. Set the COLUMNS and LINES env vars instead.
|
||||
*/
|
||||
public function setTerminalDimensions($width, $height)
|
||||
{
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Set the COLUMNS and LINES env vars instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
putenv('COLUMNS='.$width);
|
||||
putenv('LINES='.$height);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the input and output instances based on the user arguments and options.
|
||||
*/
|
||||
@@ -882,12 +828,6 @@ class Application
|
||||
$inputStream = $input->getStream();
|
||||
}
|
||||
|
||||
// This check ensures that calling QuestionHelper::setInputStream() works
|
||||
// To be removed in 4.0 (in the same time as QuestionHelper::setInputStream)
|
||||
if (!$inputStream && $this->getHelperSet()->has('question')) {
|
||||
$inputStream = $this->getHelperSet()->get('question')->getInputStream(false);
|
||||
}
|
||||
|
||||
if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
|
||||
$input->setInteractive(false);
|
||||
}
|
||||
@@ -965,19 +905,7 @@ class Application
|
||||
} else {
|
||||
$exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Throwable $e) {
|
||||
}
|
||||
if (null !== $e) {
|
||||
if ($this->dispatcher->hasListeners(ConsoleEvents::EXCEPTION)) {
|
||||
$x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
|
||||
$event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
|
||||
$this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
|
||||
|
||||
if ($x !== $event->getException()) {
|
||||
$e = $event->getException();
|
||||
}
|
||||
}
|
||||
$event = new ConsoleErrorEvent($input, $output, $e, $command);
|
||||
$this->dispatcher->dispatch(ConsoleEvents::ERROR, $event);
|
||||
$e = $event->getError();
|
||||
|
Reference in New Issue
Block a user