mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 22:48:45 +02:00
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:
@@ -12,7 +12,6 @@
|
||||
namespace Symfony\Bridge\Twig\Extension;
|
||||
|
||||
use Symfony\Component\Yaml\Dumper as YamlDumper;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
|
||||
@@ -21,12 +20,12 @@ use Twig\TwigFilter;
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class YamlExtension extends AbstractExtension
|
||||
final class YamlExtension extends AbstractExtension
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFilters()
|
||||
public function getFilters(): array
|
||||
{
|
||||
return [
|
||||
new TwigFilter('yaml_encode', [$this, 'encode']),
|
||||
@@ -34,7 +33,7 @@ class YamlExtension extends AbstractExtension
|
||||
];
|
||||
}
|
||||
|
||||
public function encode($input, $inline = 0, $dumpObjects = 0)
|
||||
public function encode($input, int $inline = 0, int $dumpObjects = 0): string
|
||||
{
|
||||
static $dumper;
|
||||
|
||||
@@ -43,21 +42,13 @@ class YamlExtension extends AbstractExtension
|
||||
}
|
||||
|
||||
if (\defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) {
|
||||
if (\is_bool($dumpObjects)) {
|
||||
@trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', \E_USER_DEPRECATED);
|
||||
|
||||
$flags = $dumpObjects ? Yaml::DUMP_OBJECT : 0;
|
||||
} else {
|
||||
$flags = $dumpObjects;
|
||||
}
|
||||
|
||||
return $dumper->dump($input, $inline, 0, $flags);
|
||||
return $dumper->dump($input, $inline, 0, $dumpObjects);
|
||||
}
|
||||
|
||||
return $dumper->dump($input, $inline, 0, false, $dumpObjects);
|
||||
}
|
||||
|
||||
public function dump($value, $inline = 0, $dumpObjects = false)
|
||||
public function dump($value, int $inline = 0, int $dumpObjects = 0): string
|
||||
{
|
||||
if (\is_resource($value)) {
|
||||
return '%Resource%';
|
||||
@@ -69,12 +60,4 @@ class YamlExtension extends AbstractExtension
|
||||
|
||||
return $this->encode($value, $inline, $dumpObjects);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'yaml';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user