Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4:
  [TwigBridge] foundation 5 layout: use form_label_content block for checkbox and radio labels
  [TwigBridge] Fix compat with Twig v3.9
  [Cache] Sync the Redis proxies with upstream
  [Doctrine Messenger] Fix support for pgsql + pgbouncer.
  [Mailer] Simplify fix
  Do not produce notice/warning when consuming from multiple transports and explicitly listed queues
  [FrameworkBundle] Check if the _route attribute exists on the request
  [Scheduler] fix documentation link
  [PropertyAccess] Fixes getValue() on an unitialized object property on a lazy ghost
  [HttpClient] Make retry strategy work again
  AssetMapper: Remove 'auto-generated' info
  [Mailer] Fix signed emails breaking the profiler
  [Mailer] [Mailgun] Fix expecting payload without tags or user variables
  [Validator] Update Spanish (es) translations
  Fix fetching data in `W3CReferenceTest` on AppVeyor
  Fix SQS visibility_timeout type
  [VarDumper] Fix serialization of stubs with null or uninitialized values
  • Loading branch information
nicolas-grekas committed Feb 15, 2024
2 parents c4a0e75 + 256f330 commit d16aa4e
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Node/DumpNode.php
Expand Up @@ -11,12 +11,14 @@

namespace Symfony\Bridge\Twig\Node;

use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Node\Node;

/**
* @author Julien Galenski <julien.galenski@gmail.com>
*/
#[YieldReady]
final class DumpNode extends Node
{
private string $varPrefix;
Expand Down
2 changes: 2 additions & 0 deletions Node/FormThemeNode.php
Expand Up @@ -12,12 +12,14 @@
namespace Symfony\Bridge\Twig\Node;

use Symfony\Component\Form\FormRenderer;
use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Node\Node;

/**
* @author Fabien Potencier <fabien@symfony.com>
*/
#[YieldReady]
final class FormThemeNode extends Node
{
public function __construct(Node $form, Node $resources, int $lineno, ?string $tag = null, bool $only = false)
Expand Down
2 changes: 2 additions & 0 deletions Node/StopwatchNode.php
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bridge\Twig\Node;

use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Node\Expression\AssignNameExpression;
use Twig\Node\Node;
Expand All @@ -20,6 +21,7 @@
*
* @author Wouter J <wouter@wouterj.nl>
*/
#[YieldReady]
final class StopwatchNode extends Node
{
public function __construct(Node $name, Node $body, AssignNameExpression $var, int $lineno = 0, ?string $tag = null)
Expand Down
2 changes: 2 additions & 0 deletions Node/TransDefaultDomainNode.php
Expand Up @@ -11,13 +11,15 @@

namespace Symfony\Bridge\Twig\Node;

use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Node\Expression\AbstractExpression;
use Twig\Node\Node;

/**
* @author Fabien Potencier <fabien@symfony.com>
*/
#[YieldReady]
final class TransDefaultDomainNode extends Node
{
public function __construct(AbstractExpression $expr, int $lineno = 0, ?string $tag = null)
Expand Down
5 changes: 4 additions & 1 deletion Node/TransNode.php
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bridge\Twig\Node;

use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Node\Expression\AbstractExpression;
use Twig\Node\Expression\ArrayExpression;
Expand All @@ -22,6 +23,7 @@
/**
* @author Fabien Potencier <fabien@symfony.com>
*/
#[YieldReady]
final class TransNode extends Node
{
public function __construct(Node $body, ?Node $domain = null, ?AbstractExpression $count = null, ?AbstractExpression $vars = null, ?AbstractExpression $locale = null, int $lineno = 0, ?string $tag = null)
Expand Down Expand Up @@ -53,9 +55,10 @@ public function compile(Compiler $compiler): void
$vars = null;
}
[$msg, $defaults] = $this->compileString($this->getNode('body'), $defaults, (bool) $vars);
$display = class_exists(YieldReady::class) ? 'yield' : 'echo';

$compiler
->write('echo $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans(')
->write($display.' $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans(')
->subcompile($msg)
;

Expand Down
4 changes: 3 additions & 1 deletion Resources/views/Form/foundation_5_layout.html.twig
Expand Up @@ -269,7 +269,9 @@
{% endif %}
<label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
{{ widget|raw }}
{{ translation_domain is same as(false) ? label : label|trans(label_translation_parameters, translation_domain) }}
{%- if label is not same as(false) -%}
{{- block('form_label_content') -}}
{%- endif -%}
</label>
{%- endblock checkbox_radio_label %}

Expand Down
4 changes: 3 additions & 1 deletion Tests/Node/TransNodeTest.php
Expand Up @@ -13,6 +13,7 @@

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Twig\Node\TransNode;
use Twig\Attribute\YieldReady;
use Twig\Compiler;
use Twig\Environment;
use Twig\Loader\LoaderInterface;
Expand All @@ -35,7 +36,8 @@ public function testCompileStrict()

$this->assertEquals(
sprintf(
'echo $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans("trans %%var%%", array_merge(["%%var%%" => %s], %s), "messages");',
'%s $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans("trans %%var%%", array_merge(["%%var%%" => %s], %s), "messages");',
class_exists(YieldReady::class) ? 'yield' : 'echo',
$this->getVariableGetterWithoutStrictCheck('var'),
$this->getVariableGetterWithStrictCheck('foo')
),
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -18,7 +18,7 @@
"require": {
"php": ">=8.2",
"symfony/translation-contracts": "^2.5|^3",
"twig/twig": "~3.8.0"
"twig/twig": "^3.0.4"
},
"require-dev": {
"egulias/email-validator": "^2.1.10|^3|^4",
Expand Down

0 comments on commit d16aa4e

Please sign in to comment.