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:
bdalsass
2023-12-05 13:56:56 +01:00
committed by GitHub
parent 863ab4560c
commit 27ce51ab07
1392 changed files with 44869 additions and 27799 deletions

View File

@@ -26,16 +26,19 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
public const DUMP_COMMA_SEPARATOR = 4;
public const DUMP_TRAILING_COMMA = 8;
/** @var callable|resource|string|null */
public static $defaultOutput = 'php://output';
protected $line = '';
/** @var callable|null */
protected $lineDumper;
/** @var resource|null */
protected $outputStream;
protected $decimalPoint; // This is locale dependent
protected $decimalPoint = '.';
protected $indentPad = ' ';
protected $flags;
private $charset = '';
private string $charset = '';
/**
* @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path, defaults to static::$defaultOutput
@@ -46,7 +49,6 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
{
$this->flags = $flags;
$this->setCharset($charset ?: \ini_get('php.output_encoding') ?: \ini_get('default_charset') ?: 'UTF-8');
$this->decimalPoint = \PHP_VERSION_ID >= 80000 ? '.' : localeconv()['decimal_point'];
$this->setOutput($output ?: static::$defaultOutput);
if (!$output && \is_string(static::$defaultOutput)) {
static::$defaultOutput = $this->outputStream;
@@ -56,9 +58,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Sets the output destination of the dumps.
*
* @param callable|resource|string $output A line dumper callable, an opened stream or an output path
* @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path
*
* @return callable|resource|string The previous output destination
* @return callable|resource|string|null The previous output destination
*/
public function setOutput($output)
{
@@ -72,7 +74,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
$output = fopen($output, 'w');
}
$this->outputStream = $output;
$this->lineDumper = [$this, 'echoLine'];
$this->lineDumper = $this->echoLine(...);
}
return $prev;
@@ -83,7 +85,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
*
* @return string The previous charset
*/
public function setCharset(string $charset)
public function setCharset(string $charset): string
{
$prev = $this->charset;
@@ -102,7 +104,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
*
* @return string The previous indent pad
*/
public function setIndentPad(string $pad)
public function setIndentPad(string $pad): string
{
$prev = $this->indentPad;
$this->indentPad = $pad;
@@ -117,10 +119,8 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
*
* @return string|null The dump as string when $output is true
*/
public function dump(Data $data, $output = null)
public function dump(Data $data, $output = null): ?string
{
$this->decimalPoint = \PHP_VERSION_ID >= 80000 ? '.' : localeconv()['decimal_point'];
if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(\LC_NUMERIC, 0) : null) {
setlocale(\LC_NUMERIC, 'C');
}
@@ -158,6 +158,8 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
*
* @param int $depth The recursive depth in the dumped structure for the line being dumped,
* or -1 to signal the end-of-dump to the line dumper callable
*
* @return void
*/
protected function dumpLine(int $depth)
{
@@ -167,6 +169,8 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Generic line dumper callback.
*
* @return void
*/
protected function echoLine(string $line, int $depth, string $indentPad)
{
@@ -177,10 +181,8 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface
/**
* Converts a non-UTF-8 string to UTF-8.
*
* @return string|null
*/
protected function utf8Encode(?string $s)
protected function utf8Encode(?string $s): ?string
{
if (null === $s || preg_match('//u', $s)) {
return $s;