mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-26 12:08:47 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -28,13 +28,19 @@ use Symfony\Component\Yaml\Inline;
|
||||
*/
|
||||
class YamlReferenceDumper
|
||||
{
|
||||
private $reference;
|
||||
private ?string $reference = null;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function dump(ConfigurationInterface $configuration)
|
||||
{
|
||||
return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function dumpAtPath(ConfigurationInterface $configuration, string $path)
|
||||
{
|
||||
$rootNode = $node = $configuration->getConfigTreeBuilder()->buildTree();
|
||||
@@ -61,6 +67,9 @@ class YamlReferenceDumper
|
||||
return $this->dumpNode($node);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function dumpNode(NodeInterface $node)
|
||||
{
|
||||
$this->reference = '';
|
||||
@@ -71,7 +80,7 @@ class YamlReferenceDumper
|
||||
return $ref;
|
||||
}
|
||||
|
||||
private function writeNode(NodeInterface $node, NodeInterface $parentNode = null, int $depth = 0, bool $prototypedArray = false)
|
||||
private function writeNode(NodeInterface $node, NodeInterface $parentNode = null, int $depth = 0, bool $prototypedArray = false): void
|
||||
{
|
||||
$comments = [];
|
||||
$default = '';
|
||||
@@ -98,9 +107,9 @@ class YamlReferenceDumper
|
||||
}
|
||||
}
|
||||
} elseif ($node instanceof EnumNode) {
|
||||
$comments[] = 'One of '.implode('; ', array_map('json_encode', $node->getValues()));
|
||||
$comments[] = 'One of '.$node->getPermissibleValues('; ');
|
||||
$default = $node->hasDefaultValue() ? Inline::dump($node->getDefaultValue()) : '~';
|
||||
} elseif (VariableNode::class === \get_class($node) && \is_array($example)) {
|
||||
} elseif (VariableNode::class === $node::class && \is_array($example)) {
|
||||
// If there is an array example, we are sure we dont need to print a default value
|
||||
$default = '';
|
||||
} else {
|
||||
@@ -170,7 +179,7 @@ class YamlReferenceDumper
|
||||
|
||||
$this->writeLine('# '.$message.':', $depth * 4 + 4);
|
||||
|
||||
$this->writeArray(array_map([Inline::class, 'dump'], $example), $depth + 1);
|
||||
$this->writeArray(array_map(Inline::dump(...), $example), $depth + 1);
|
||||
}
|
||||
|
||||
if ($children) {
|
||||
@@ -183,7 +192,7 @@ class YamlReferenceDumper
|
||||
/**
|
||||
* Outputs a single config reference line.
|
||||
*/
|
||||
private function writeLine(string $text, int $indent = 0)
|
||||
private function writeLine(string $text, int $indent = 0): void
|
||||
{
|
||||
$indent = \strlen($text) + $indent;
|
||||
$format = '%'.$indent.'s';
|
||||
@@ -191,9 +200,9 @@ class YamlReferenceDumper
|
||||
$this->reference .= sprintf($format, $text)."\n";
|
||||
}
|
||||
|
||||
private function writeArray(array $array, int $depth)
|
||||
private function writeArray(array $array, int $depth): void
|
||||
{
|
||||
$isIndexed = array_values($array) === $array;
|
||||
$isIndexed = array_is_list($array);
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
if (\is_array($value)) {
|
||||
|
||||
Reference in New Issue
Block a user