Skip to content

1753/twig test#1759

Merged
jarednova merged 3 commits intomasterfrom
1753/twig_test
Jul 26, 2018
Merged

1753/twig test#1759
jarednova merged 3 commits intomasterfrom
1753/twig_test

Conversation

@jarednova
Copy link
Member

Ticket: #1753

Raphaël Droz and others added 3 commits July 20, 2018 14:08
Normally, when the argument of a Twig Function is a Callable, Twig creates such call (see Twig's `compileCallable()`).
Eg:
```
{{__("foo")}}
=> echo twig_escape_filter($this->env, call_user_func_array($this->env->getFunction('__')->getCallable(), array("foo")), "html", null, true)
```

This has the side effect that effect resulting template loose the xgettext friendly syntax.

By using feeding string to Twig Function, the result is clearer (to xgettext):
```
{{__("foo")}}
=> echo twig_escape_filter($this->env, __("foo"), "html", null, true);
````

Since wrapping these functions is of no use (same arguments), and since compiled templates containing these functions
 may very well have to be looked into for gettext*() function calls, it's better to avoid it.
@coveralls
Copy link

coveralls commented Jul 26, 2018

Coverage Status

Coverage increased (+0.1%) to 94.302% when pulling a787340 on 1753/twig_test into 5568143 on master.

@codecov
Copy link

codecov bot commented Jul 26, 2018

Codecov Report

Merging #1759 into master will increase coverage by 0.07%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1759      +/-   ##
============================================
+ Coverage     94.83%   94.91%   +0.07%     
+ Complexity     1536     1525      -11     
============================================
  Files            48       48              
  Lines          3604     3582      -22     
============================================
- Hits           3418     3400      -18     
+ Misses          186      182       -4
Impacted Files Coverage Δ Complexity Δ
lib/Twig.php 99.43% <100%> (+1.95%) 83 <0> (-11) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5568143...a787340. Read the comment docs.

@jarednova jarednova merged commit 1271857 into master Jul 26, 2018
@jarednova jarednova deleted the 1753/twig_test branch July 27, 2018 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants