Skip to content

Add the = assignment operator#4735

Merged
fabpot merged 1 commit intotwigphp:3.xfrom
fabpot:assignment-operator
Jan 19, 2026
Merged

Add the = assignment operator#4735
fabpot merged 1 commit intotwigphp:3.xfrom
fabpot:assignment-operator

Conversation

@fabpot
Copy link
Copy Markdown
Contributor

@fabpot fabpot commented Jan 14, 2026

No description provided.

Comment on lines +43 to +46
$right = match ($this->getName()) {
'=' => $right,
default => throw new \LogicException(\sprintf('Unknown operator: %s.', $this->getName())),
};
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This could be simplified, but I'd maybe add more assignment operators in another PR.

@fabpot fabpot force-pushed the assignment-operator branch 2 times, most recently from d2f86d5 to c68c1ce Compare January 16, 2026 13:00
if (!\is_string($name)) {
throw new \LogicException('The "name" attribute must be a string.');
}
$left = new AssignContextVariable($name, $left->getTemplateLine());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are you not bypassing the AssignNameExpression checks (ensuring "name" is different of "false" "true" ... ) Not about their role right now :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't get your comment, can you clarify?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To be honest, not sure I still can right. This now seems perfectly clear.. #insomnia

@fabpot fabpot force-pushed the assignment-operator branch from c68c1ce to 7e62c75 Compare January 18, 2026 20:44
@fabpot fabpot force-pushed the assignment-operator branch from 7e62c75 to bfbbef0 Compare January 19, 2026 15:40
@fabpot fabpot merged commit be1797d into twigphp:3.x Jan 19, 2026
39 of 41 checks passed
@fabpot fabpot deleted the assignment-operator branch January 19, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants