Support null coalescing operator (??) in templates

Support null coalescing operator (??) in templates
0
7
It would be really nice if the ?? operator (aka null coalescing operator) was supported in XF templates.

For example;
PHP:

$entity.property ?? 'default'
Which has the logic;
If $entity is null, or if property does not exist in $entity, or $entity->property is null, then the value of 'default' is returned.

This would essentially simplify this style of logic significantly;
PHP:

($entity && $reaction.isValidKey('property') && $reaction.property !== null) ...

Read more

Читать далее...
 
Активность
Пока что здесь никого нет
Назад
Верх Низ
Яндекс.Метрика