mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +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:
@@ -27,20 +27,14 @@ use Twig\TwigFunction;
|
||||
*/
|
||||
class WebProfilerExtension extends ProfilerExtension
|
||||
{
|
||||
/**
|
||||
* @var HtmlDumper
|
||||
*/
|
||||
private $dumper;
|
||||
private HtmlDumper $dumper;
|
||||
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
private $output;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $stackLevel = 0;
|
||||
private int $stackLevel = 0;
|
||||
|
||||
public function __construct(HtmlDumper $dumper = null)
|
||||
{
|
||||
@@ -60,18 +54,15 @@ class WebProfilerExtension extends ProfilerExtension
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
new TwigFunction('profiler_dump', [$this, 'dumpData'], ['is_safe' => ['html'], 'needs_environment' => true]),
|
||||
new TwigFunction('profiler_dump_log', [$this, 'dumpLog'], ['is_safe' => ['html'], 'needs_environment' => true]),
|
||||
new TwigFunction('profiler_dump', $this->dumpData(...), ['is_safe' => ['html'], 'needs_environment' => true]),
|
||||
new TwigFunction('profiler_dump_log', $this->dumpLog(...), ['is_safe' => ['html'], 'needs_environment' => true]),
|
||||
];
|
||||
}
|
||||
|
||||
public function dumpData(Environment $env, Data $data, int $maxDepth = 0)
|
||||
public function dumpData(Environment $env, Data $data, int $maxDepth = 0): string
|
||||
{
|
||||
$this->dumper->setCharset($env->getCharset());
|
||||
$this->dumper->dump($data, null, [
|
||||
@@ -85,7 +76,7 @@ class WebProfilerExtension extends ProfilerExtension
|
||||
return str_replace("\n</pre", '</pre', rtrim($dump));
|
||||
}
|
||||
|
||||
public function dumpLog(Environment $env, string $message, Data $context = null)
|
||||
public function dumpLog(Environment $env, string $message, Data $context = null): string
|
||||
{
|
||||
$message = twig_escape_filter($env, $message);
|
||||
$message = preg_replace('/"(.*?)"/', '"<b>$1</b>"', $message);
|
||||
@@ -109,10 +100,7 @@ class WebProfilerExtension extends ProfilerExtension
|
||||
return '<span class="dump-inline">'.strtr($message, $replacements).'</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'profiler';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user