updated-packages
This commit is contained in:
@@ -26,10 +26,7 @@ use Symfony\Component\Console\Input\InputOption;
|
||||
*/
|
||||
class XmlDescriptor extends Descriptor
|
||||
{
|
||||
/**
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
public function getInputDefinitionDocument(InputDefinition $definition)
|
||||
public function getInputDefinitionDocument(InputDefinition $definition): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($definitionXML = $dom->createElement('definition'));
|
||||
@@ -47,10 +44,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
public function getCommandDocument(Command $command)
|
||||
public function getCommandDocument(Command $command): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($commandXML = $dom->createElement('command'));
|
||||
@@ -64,7 +58,7 @@ class XmlDescriptor extends Descriptor
|
||||
|
||||
$commandXML->appendChild($usagesXML = $dom->createElement('usages'));
|
||||
|
||||
foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
|
||||
foreach (array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()) as $usage) {
|
||||
$usagesXML->appendChild($dom->createElement('usage', $usage));
|
||||
}
|
||||
|
||||
@@ -80,13 +74,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Application $application
|
||||
* @param string|null $namespace
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
public function getApplicationDocument(Application $application, $namespace = null)
|
||||
public function getApplicationDocument(Application $application, string $namespace = null): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($rootXml = $dom->createElement('symfony'));
|
||||
@@ -130,7 +118,7 @@ class XmlDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = array())
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = [])
|
||||
{
|
||||
$this->writeDocument($this->getInputArgumentDocument($argument));
|
||||
}
|
||||
@@ -138,7 +126,7 @@ class XmlDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputOption(InputOption $option, array $options = array())
|
||||
protected function describeInputOption(InputOption $option, array $options = [])
|
||||
{
|
||||
$this->writeDocument($this->getInputOptionDocument($option));
|
||||
}
|
||||
@@ -146,7 +134,7 @@ class XmlDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = array())
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
|
||||
{
|
||||
$this->writeDocument($this->getInputDefinitionDocument($definition));
|
||||
}
|
||||
@@ -154,7 +142,7 @@ class XmlDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeCommand(Command $command, array $options = array())
|
||||
protected function describeCommand(Command $command, array $options = [])
|
||||
{
|
||||
$this->writeDocument($this->getCommandDocument($command));
|
||||
}
|
||||
@@ -162,9 +150,9 @@ class XmlDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function describeApplication(Application $application, array $options = array())
|
||||
protected function describeApplication(Application $application, array $options = [])
|
||||
{
|
||||
$this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
|
||||
$this->writeDocument($this->getApplicationDocument($application, $options['namespace'] ?? null));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,8 +167,6 @@ class XmlDescriptor extends Descriptor
|
||||
|
||||
/**
|
||||
* Writes DOM document.
|
||||
*
|
||||
* @return \DOMDocument|string
|
||||
*/
|
||||
private function writeDocument(\DOMDocument $dom)
|
||||
{
|
||||
@@ -200,7 +186,7 @@ class XmlDescriptor extends Descriptor
|
||||
$descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
|
||||
|
||||
$objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
|
||||
$defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
|
||||
$defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? [var_export($argument->getDefault(), true)] : ($argument->getDefault() ? [$argument->getDefault()] : []));
|
||||
foreach ($defaults as $default) {
|
||||
$defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
|
||||
$defaultXML->appendChild($dom->createTextNode($default));
|
||||
@@ -215,7 +201,7 @@ class XmlDescriptor extends Descriptor
|
||||
|
||||
$dom->appendChild($objectXML = $dom->createElement('option'));
|
||||
$objectXML->setAttribute('name', '--'.$option->getName());
|
||||
$pos = strpos($option->getShortcut(), '|');
|
||||
$pos = strpos($option->getShortcut() ?? '', '|');
|
||||
if (false !== $pos) {
|
||||
$objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
|
||||
$objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
|
||||
@@ -229,7 +215,7 @@ class XmlDescriptor extends Descriptor
|
||||
$descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
|
||||
|
||||
if ($option->acceptValue()) {
|
||||
$defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
|
||||
$defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? [var_export($option->getDefault(), true)] : ($option->getDefault() ? [$option->getDefault()] : []));
|
||||
$objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
|
||||
|
||||
if (!empty($defaults)) {
|
||||
|
Reference in New Issue
Block a user