Skip to content

Commit

Permalink
Merge branch '6.4' into 7.1
Browse files Browse the repository at this point in the history
* 6.4:
  [TwigBridge] Remove `VersionAwareTest` from `AbstractLayoutTestCase`
  [DependencyInjection] Add coverage for error cases of `LazyClosure` and `AutowireLocator`
  [TwigBridge] Fixed a parameterized choice label translation
  Fix extracting of message from ->trans() method with named params
  Add missing Albanian translations for Security and Validator components
  [HttpClient] Add `crypto_method` to scoped client options
  suppress proc_open errors
  [DependencyInjection] Fix `XmlFileLoader` not respecting when env for services
  • Loading branch information
xabbuh committed Sep 28, 2024
2 parents 408af27 + bee9bfa commit b9f72ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Extractor/Visitor/TransMethodVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function leaveNode(Node $node): ?Node
if ('trans' === $name || 't' === $name) {
$firstNamedArgumentIndex = $this->nodeFirstNamedArgumentIndex($node);

if (!$messages = $this->getStringArguments($node, 0 < $firstNamedArgumentIndex ? 0 : 'message')) {
if (!$messages = $this->getStringArguments($node, 0 < $firstNamedArgumentIndex ? 0 : 'id')) {
return null;
}

Expand Down
6 changes: 3 additions & 3 deletions Tests/Fixtures/extractor-ast/translation.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@

<?php echo $view['translator']->trans('default domain', [], null); ?>

<?php echo $view['translator']->trans(message: 'ordered-named-arguments-in-trans-method', parameters: [], domain: 'not_messages'); ?>
<?php echo $view['translator']->trans(domain: 'not_messages', message: 'disordered-named-arguments-in-trans-method', parameters: []); ?>
<?php echo $view['translator']->trans(id: 'ordered-named-arguments-in-trans-method', parameters: [], domain: 'not_messages'); ?>
<?php echo $view['translator']->trans(domain: 'not_messages', id: 'disordered-named-arguments-in-trans-method', parameters: []); ?>

<?php echo $view['translator']->trans($key = 'variable-assignation-inlined-in-trans-method-call1', $parameters = [], $domain = 'not_messages'); ?>
<?php echo $view['translator']->trans('variable-assignation-inlined-in-trans-method-call2', $parameters = [], $domain = 'not_messages'); ?>
<?php echo $view['translator']->trans('variable-assignation-inlined-in-trans-method-call3', [], $domain = 'not_messages'); ?>

<?php echo $view['translator']->trans(domain: $domain = 'not_messages', message: $key = 'variable-assignation-inlined-with-named-arguments-in-trans-method', parameters: $parameters = []); ?>
<?php echo $view['translator']->trans(domain: $domain = 'not_messages', id: $key = 'variable-assignation-inlined-with-named-arguments-in-trans-method', parameters: $parameters = []); ?>

<?php echo $view['translator']->trans('mix-named-arguments', parameters: ['foo' => 'bar']); ?>
<?php echo $view['translator']->trans('mix-named-arguments-locale', parameters: ['foo' => 'bar'], locale: 'de'); ?>
Expand Down

0 comments on commit b9f72ab

Please sign in to comment.