Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Twig\Node\Expression\FilterExpression use attribute instate of … #177

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Visitor/Twig/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public function work(Node $node, SourceCollection $collection, callable $getAbso
$this->stack[] = $node;
if ($node instanceof FilterExpression && $node->getNode('node') instanceof ConstantExpression) {
$domain = null;
if ('trans' === $node->getNode('filter')->getAttribute('value')) {
if ('trans' === $node->getAttribute('twig_callable')->getName()) {
$domain = $this->getReadDomainFromArguments($node->getNode('arguments'), 1);
} elseif ('transchoice' === $node->getNode('filter')->getAttribute('value')) {
} elseif ('transchoice' === $node->getAttribute('twig_callable')->getName()) {
$domain = $this->getReadDomainFromArguments($node->getNode('arguments'), 2);
}

Expand Down Expand Up @@ -83,7 +83,7 @@ private function extractContextFromJoinedFilters(): array
if (!$this->stack[$i] instanceof FilterExpression) {
break;
}
$name = $this->stack[$i]->getNode('filter')->getAttribute('value');
$name = $this->stack[$i]->getAttribute('twig_callable')->getName();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A BC question, will it work for v2? I see we allow "twig/twig": "^2.0 || ^3.0". Or should we bump the twig/twig dependency to allow only v3?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am Not shure but it should. I checked the source code of booth branches.

I can open another pr to fix the cs, because the problems are not related to the changes of this pr.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, feel free to open a new PR to fix SA tools fails!

if ('trans' === $name) {
break;
} elseif ('desc' === $name) {
Expand Down
Loading