File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
user_guide_src/source/outgoing Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -109,15 +109,20 @@ public function testDefault(): void
109109 $ parser = new Parser ($ this ->config , $ this ->viewsDir , $ this ->loader );
110110
111111 $ data = [
112- 'value1 ' => null ,
113- 'value2 ' => 0 ,
114- 'value3 ' => 'test ' ,
112+ 'value1 ' => '' ,
113+ 'value2 ' => null ,
114+ 'value3 ' => 0 ,
115+ 'value4 ' => 'test ' ,
115116 ];
116117
117- $ template = '{ value1|default(foo) } { value2|default(bar) } { value3|default(baz) } ' ;
118+ $ template = '{ value1|default(foo) } { value2|default(bar) } { value3|default(baz) } '
119+ . ' { value4|default(boo) } { undef|default(far) } ' ;
118120
119121 $ parser ->setData ($ data );
120- $ this ->assertSame ('foo bar test ' , $ parser ->renderString ($ template ));
122+ $ this ->assertSame (
123+ 'foo bar baz test { undef|default(far) } ' ,
124+ $ parser ->renderString ($ template )
125+ );
121126 }
122127
123128 public function testEsc (): void
Original file line number Diff line number Diff line change @@ -371,8 +371,7 @@ date format (Y-m-d) A PHP **date**-compatible formatting string.
371371date_modify value to add A **strtotime ** compatible string to modify the date, { v|date_modify(+1 day) }
372372 / subtract like ``+5 day `` or ``-1 week ``.
373373
374- default default value Displays the default value if the variable is empty or { v|default(just in case) }
375- undefined.
374+ default default value Displays the default value if the variable is `empty() `_. { v|default(just in case) }
376375
377376esc html, attr, Specifies the context to escape the data. { v|esc(attr) }
378377 css, js
@@ -419,6 +418,8 @@ title Displays a "title case" version of the string
419418upper Displays the string in all uppercase. { v|upper }
420419================ ================= =========================================================== ======================================
421420
421+ .. _empty(): https://www.php.net/manual/en/function.empty.php
422+
422423See `PHP's NumberFormatter <https://www.php.net/manual/en/numberformatter.create.php >`_ for details relevant to the
423424"local_number" filter.
424425
You can’t perform that action at this time.
0 commit comments