Augmentation vers version 3.3.0
This commit is contained in:
21
vendor/symfony/console/Input/StringInput.php
vendored
21
vendor/symfony/console/Input/StringInput.php
vendored
@@ -28,24 +28,13 @@ class StringInput extends ArgvInput
|
||||
const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
|
||||
|
||||
/**
|
||||
* @param string $input A string representing the parameters from the CLI
|
||||
* @param InputDefinition $definition A InputDefinition instance
|
||||
*
|
||||
* @deprecated The second argument is deprecated as it does not work (will be removed in 3.0), use 'bind' method instead
|
||||
* @param string $input A string representing the parameters from the CLI
|
||||
*/
|
||||
public function __construct($input, InputDefinition $definition = null)
|
||||
public function __construct($input)
|
||||
{
|
||||
if ($definition) {
|
||||
@trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
parent::__construct(array(), null);
|
||||
parent::__construct([]);
|
||||
|
||||
$this->setTokens($this->tokenize($input));
|
||||
|
||||
if (null !== $definition) {
|
||||
$this->bind($definition);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,13 +48,13 @@ class StringInput extends ArgvInput
|
||||
*/
|
||||
private function tokenize($input)
|
||||
{
|
||||
$tokens = array();
|
||||
$tokens = [];
|
||||
$length = \strlen($input);
|
||||
$cursor = 0;
|
||||
while ($cursor < $length) {
|
||||
if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
|
||||
} elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
|
||||
$tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, \strlen($match[3]) - 2)));
|
||||
$tokens[] = $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, \strlen($match[3]) - 2)));
|
||||
} elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
|
||||
$tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2));
|
||||
} elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
|
||||
|
||||
Reference in New Issue
Block a user