File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
components/expression_language Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -343,6 +343,18 @@ Ternary Operators
343343* ``foo ?: 'no' `` (equal to ``foo ? foo : 'no' ``)
344344* ``foo ? 'yes' `` (equal to ``foo ? 'yes' : '' ``)
345345
346+ Null-coalescing Operator
347+ ~~~~~~~~~~~~~~~~~~~~~~~~
348+
349+ This is the same as the PHP's null-coalescing operator ``?? `` which is a syntactic sugar for the use of a ternary
350+ in conjunction with isset(). It returns the left hand-side if it exist and not ``null `` otherwise it returns the right hand-side.
351+ Note that coalescing can be chained.
352+
353+ * ``foo ?? 'no' ``
354+ * ``foo.baz ?? 'no' ``
355+ * ``foo[3] ?? 'no' ``
356+ * ``foo.baz ?? foo['baz'] ?? 'no' ``
357+
346358Built-in Objects and Variables
347359------------------------------
348360
You can’t perform that action at this time.
0 commit comments