Skip to content

[ExpressionLanguage] Document precedence #19803

Closed
@homersimpsons

Description

@homersimpsons

Current status

The page https://symfony.com/doc/current/reference/formats/expression_language.html#supported-operators does not document operators precedence.

Objective

Add documentation about operators precedence.

Why?

Today I wanted to check the precedence of some operator in order to update a code, I had an expression that could translate to the following ambiguity:

var_dump(! null === false); // => ((!null) === false) => false
var_dump(! (null === false)); // => true

We can find the precedence in https://github.com/symfony/expression-language/blob/b8ec919a6d3d47fc4e7845c256d164413207bf73/Parser.php#L24

I think that this information should be accessible in the doc directly, but I understand that it won't benefit a lot of users so I'm wondering how it should be presented. Maybe just a collapsible array at the end, or when the precedence is mentioned in:

You must use parentheses because the unary operator not has precedence over the binary operator matches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExpressionLanguagehasPRA Pull Request has already been submitted for this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions