migration symfony 5 4 (#300)

* symfony 5.4 (diff dev)

* symfony 5.4 (working)

* symfony 5.4 (update autoload)

* symfony 5.4 (remove swiftmailer mailer implementation)

* symfony 5.4 (php doc and split Global accessor class)


### Impacted packages:

composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies

composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
bdalsass
2022-06-16 09:13:24 +02:00
committed by GitHub
parent abb13b70b9
commit 79da71ecf8
2178 changed files with 87439 additions and 59451 deletions

View File

@@ -12,13 +12,14 @@
namespace Symfony\Component\Config\Definition\Dumper;
use Symfony\Component\Config\Definition\ArrayNode;
use Symfony\Component\Config\Definition\BaseNode;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\EnumNode;
use Symfony\Component\Config\Definition\NodeInterface;
use Symfony\Component\Config\Definition\PrototypedArrayNode;
/**
* Dumps a XML reference configuration for the given configuration/node instance.
* Dumps an XML reference configuration for the given configuration/node instance.
*
* @author Wouter J <waldio.webdesign@gmail.com>
*/
@@ -26,12 +27,12 @@ class XmlReferenceDumper
{
private $reference;
public function dump(ConfigurationInterface $configuration, $namespace = null)
public function dump(ConfigurationInterface $configuration, string $namespace = null)
{
return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree(), $namespace);
}
public function dumpNode(NodeInterface $node, $namespace = null)
public function dumpNode(NodeInterface $node, string $namespace = null)
{
$this->reference = '';
$this->writeNode($node, 0, true, $namespace);
@@ -41,24 +42,19 @@ class XmlReferenceDumper
return $ref;
}
/**
* @param int $depth
* @param bool $root If the node is the root node
* @param string $namespace The namespace of the node
*/
private function writeNode(NodeInterface $node, $depth = 0, $root = false, $namespace = null)
private function writeNode(NodeInterface $node, int $depth = 0, bool $root = false, string $namespace = null)
{
$rootName = ($root ? 'config' : $node->getName());
$rootNamespace = ($namespace ?: ($root ? 'http://example.org/schema/dic/'.$node->getName() : null));
// xml remapping
if ($node->getParent()) {
$remapping = array_filter($node->getParent()->getXmlRemappings(), function ($mapping) use ($rootName) {
$remapping = array_filter($node->getParent()->getXmlRemappings(), function (array $mapping) use ($rootName) {
return $rootName === $mapping[1];
});
if (\count($remapping)) {
list($singular) = current($remapping);
[$singular] = current($remapping);
$rootName = $singular;
}
}
@@ -96,7 +92,7 @@ class XmlReferenceDumper
}
if ($prototype instanceof PrototypedArrayNode) {
$prototype->setName($key);
$prototype->setName($key ?? '');
$children = [$key => $prototype];
} elseif ($prototype instanceof ArrayNode) {
$children = $prototype->getChildren();
@@ -131,50 +127,53 @@ class XmlReferenceDumper
// get attributes and elements
foreach ($children as $child) {
if (!$child instanceof ArrayNode) {
// get attributes
// metadata
$name = str_replace('_', '-', $child->getName());
$value = '%%%%not_defined%%%%'; // use a string which isn't used in the normal world
// comments
$comments = [];
if ($info = $child->getInfo()) {
$comments[] = $info;
}
if ($example = $child->getExample()) {
$comments[] = 'Example: '.$example;
}
if ($child->isRequired()) {
$comments[] = 'Required';
}
if ($child->isDeprecated()) {
$comments[] = sprintf('Deprecated (%s)', $child->getDeprecationMessage($child->getName(), $node->getPath()));
}
if ($child instanceof EnumNode) {
$comments[] = 'One of '.implode('; ', array_map('json_encode', $child->getValues()));
}
if (\count($comments)) {
$rootAttributeComments[$name] = implode(";\n", $comments);
}
// default values
if ($child->hasDefaultValue()) {
$value = $child->getDefaultValue();
}
// append attribute
$rootAttributes[$name] = $value;
} else {
if ($child instanceof ArrayNode) {
// get elements
$rootChildren[] = $child;
continue;
}
// get attributes
// metadata
$name = str_replace('_', '-', $child->getName());
$value = '%%%%not_defined%%%%'; // use a string which isn't used in the normal world
// comments
$comments = [];
if ($child instanceof BaseNode && $info = $child->getInfo()) {
$comments[] = $info;
}
if ($child instanceof BaseNode && $example = $child->getExample()) {
$comments[] = 'Example: '.$example;
}
if ($child->isRequired()) {
$comments[] = 'Required';
}
if ($child instanceof BaseNode && $child->isDeprecated()) {
$deprecation = $child->getDeprecation($child->getName(), $node->getPath());
$comments[] = sprintf('Deprecated (%s)', ($deprecation['package'] || $deprecation['version'] ? "Since {$deprecation['package']} {$deprecation['version']}: " : '').$deprecation['message']);
}
if ($child instanceof EnumNode) {
$comments[] = 'One of '.implode('; ', array_map('json_encode', $child->getValues()));
}
if (\count($comments)) {
$rootAttributeComments[$name] = implode(";\n", $comments);
}
// default values
if ($child->hasDefaultValue()) {
$value = $child->getDefaultValue();
}
// append attribute
$rootAttributes[$name] = $value;
}
}
@@ -258,11 +257,8 @@ class XmlReferenceDumper
/**
* Outputs a single config reference line.
*
* @param string $text
* @param int $indent
*/
private function writeLine($text, $indent = 0)
private function writeLine(string $text, int $indent = 0)
{
$indent = \strlen($text) + $indent;
$format = '%'.$indent.'s';
@@ -274,10 +270,8 @@ class XmlReferenceDumper
* Renders the string conversion of the value.
*
* @param mixed $value
*
* @return string
*/
private function writeValue($value)
private function writeValue($value): string
{
if ('%%%%not_defined%%%%' === $value) {
return '';