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

@@ -19,15 +19,12 @@ use Twig\Node\Expression\NameExpression;
use Twig\Node\Node;
use Twig\Node\TextNode;
// BC/FC with namespaced Twig
class_exists('Twig\Node\Expression\ArrayExpression');
/**
* @author Fabien Potencier <fabien@symfony.com>
*/
class TransNode extends Node
final class TransNode extends Node
{
public function __construct(Node $body, Node $domain = null, AbstractExpression $count = null, AbstractExpression $vars = null, AbstractExpression $locale = null, $lineno = 0, $tag = null)
public function __construct(Node $body, Node $domain = null, AbstractExpression $count = null, AbstractExpression $vars = null, AbstractExpression $locale = null, int $lineno = 0, string $tag = null)
{
$nodes = ['body' => $body];
if (null !== $domain) {
@@ -46,7 +43,7 @@ class TransNode extends Node
parent::__construct($nodes, [], $lineno, $tag);
}
public function compile(Compiler $compiler)
public function compile(Compiler $compiler): void
{
$compiler->addDebugInfo($this);
@@ -55,24 +52,15 @@ class TransNode extends Node
$defaults = $this->getNode('vars');
$vars = null;
}
list($msg, $defaults) = $this->compileString($this->getNode('body'), $defaults, (bool) $vars);
$method = !$this->hasNode('count') ? 'trans' : 'transChoice';
[$msg, $defaults] = $this->compileString($this->getNode('body'), $defaults, (bool) $vars);
$compiler
->write('echo $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->getTranslator()->'.$method.'(')
->write('echo $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans(')
->subcompile($msg)
;
$compiler->raw(', ');
if ($this->hasNode('count')) {
$compiler
->subcompile($this->getNode('count'))
->raw(', ')
;
}
if (null !== $vars) {
$compiler
->raw('array_merge(')
@@ -98,11 +86,21 @@ class TransNode extends Node
->raw(', ')
->subcompile($this->getNode('locale'))
;
} elseif ($this->hasNode('count')) {
$compiler->raw(', null');
}
if ($this->hasNode('count')) {
$compiler
->raw(', ')
->subcompile($this->getNode('count'))
;
}
$compiler->raw(");\n");
}
protected function compileString(Node $body, ArrayExpression $vars, $ignoreStrictCheck = false)
private function compileString(Node $body, ArrayExpression $vars, bool $ignoreStrictCheck = false): array
{
if ($body instanceof ConstantExpression) {
$msg = $body->getAttribute('value');