Add pear modules, mail and net_smtp via composer (#93)

Add pear modules, mail and net_smtp via composer, remove php 5.6 build due to phpunit 6
This commit is contained in:
Thilina Hasantha
2018-01-08 23:13:43 +01:00
committed by GitHub
parent 359e3f8382
commit e7792e7d79
2349 changed files with 117270 additions and 83170 deletions

View File

@@ -44,8 +44,6 @@ class ArgvInput extends Input
private $parsed;
/**
* Constructor.
*
* @param array|null $argv An array of parameters from the CLI (in the argv format)
* @param InputDefinition|null $definition A InputDefinition instance
*/
@@ -148,7 +146,12 @@ class ArgvInput extends Input
if (false !== $pos = strpos($name, '=')) {
if (0 === strlen($value = substr($name, $pos + 1))) {
array_unshift($this->parsed, null);
// if no value after "=" then substr() returns "" since php7 only, false before
// see http://php.net/manual/fr/migration70.incompatible.php#119151
if (\PHP_VERSION_ID < 70000 && false === $value) {
$value = '';
}
array_unshift($this->parsed, $value);
}
$this->addLongOption(substr($name, 0, $pos), $value);
} else {
@@ -221,23 +224,16 @@ class ArgvInput extends Input
$option = $this->definition->getOption($name);
// Convert empty values to null
if (!isset($value[0])) {
$value = null;
}
if (null !== $value && !$option->acceptValue()) {
throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
}
if (null === $value && $option->acceptValue() && count($this->parsed)) {
if (in_array($value, array('', null), true) && $option->acceptValue() && count($this->parsed)) {
// if option accepts an optional or mandatory argument
// let's see if there is one provided
$next = array_shift($this->parsed);
if (isset($next[0]) && '-' !== $next[0]) {
if ((isset($next[0]) && '-' !== $next[0]) || in_array($next, array('', null), true)) {
$value = $next;
} elseif (empty($next)) {
$value = null;
} else {
array_unshift($this->parsed, $next);
}
@@ -248,8 +244,8 @@ class ArgvInput extends Input
throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
}
if (!$option->isArray()) {
$value = $option->isValueOptional() ? $option->getDefault() : true;
if (!$option->isArray() && !$option->isValueOptional()) {
$value = true;
}
}
@@ -282,13 +278,23 @@ class ArgvInput extends Input
$values = (array) $values;
foreach ($this->tokens as $token) {
if ($onlyParams && $token === '--') {
if ($onlyParams && '--' === $token) {
return false;
}
foreach ($values as $value) {
if ($token === $value || 0 === strpos($token, $value.'=')) {
return true;
}
if (0 === strpos($token, '-') && 0 !== strpos($token, '--')) {
$noValue = explode('=', $token);
$token = $noValue[0];
$searchableToken = str_replace('-', '', $token);
$searchableValue = str_replace('-', '', $value);
if ('' !== $searchableToken && '' !== $searchableValue && false !== strpos($searchableToken, $searchableValue)) {
return true;
}
}
}
}
@@ -305,7 +311,7 @@ class ArgvInput extends Input
while (0 < count($tokens)) {
$token = array_shift($tokens);
if ($onlyParams && $token === '--') {
if ($onlyParams && '--' === $token) {
return false;
}
@@ -335,7 +341,7 @@ class ArgvInput extends Input
return $match[1].$this->escapeToken($match[2]);
}
if ($token && $token[0] !== '-') {
if ($token && '-' !== $token[0]) {
return $this->escapeToken($token);
}