Skip to content

Precedence of ?? operator #3387

Description

@mmarton

Hi!

This might be a bug:
The precedence of ?? is not the same in twig as it is in php.

php:
$x = 'a';
var_dump(null ?? $x.'_1'); // a_1
var_dump('notnull' ?? $x.'_1'); // notnull

twig:
{{ null ?? x ~ '_1' }} // a_1
{{ 'notnull' ?? x ~ '_1' }} // notnull_1 expected: nutnull
{{ 'notnull' ?? (x ~ '_1') }} // notnull

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions