Documented precedence for binary operators does not match actual behavior
The documentation states the following:
The operator precedence is as follows, with the lowest-precedence operators listed first: ?: (ternary operator), b-and, b-xor, b-or, or, and, ==, !=, <=>, <, >, >=, <=, in, matches, starts with, ends with, .., +, -, ~, *, /, //, %, is (tests), **, ??, | (filters), [], and .
When compiling following template:
{{ 6 b-and 2 or 6 b-and 16 }}
This PHP code gets generated:
echo twig_escape_filter($this->env, ((6 & 2) || (6 & 16)), "html", null, true);
If b-and had indeed had lower precedence than or, the result would have been ((6 & (2 || 6)) & 16).
The documentation should be adjusted to reflect current behavior.
@nox-4O4 I proposed a PR to answer it, put it in the right order and added some additional information
Thanks for clarifying the current behavior in the documentation! I added some review comments to your PR.