diff --git a/src/View/Antlers/Parser.php b/src/View/Antlers/Parser.php index 9aa70ff752..a392c578fd 100644 --- a/src/View/Antlers/Parser.php +++ b/src/View/Antlers/Parser.php @@ -703,7 +703,7 @@ public function parseTernaries($text, $data) { if (preg_match_all('/{{\s*([^}]+[^}]\s(\?[^}]*\s\:|\?=).*)\s*}}/msU', $text, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { - // Our made up mini ternary syntax. + // Our made up "truth coalescing" syntax. // eg. {{ true ?= "foo" }} is shorthand for {{ if true }}foo{{ /if }} if ($match[2] === '?=') { $bits = explode(' ?= ', $match[1]); diff --git a/tests/View/Antlers/ParserTest.php b/tests/View/Antlers/ParserTest.php index e51fa94e2d..2a6a9e5a18 100644 --- a/tests/View/Antlers/ParserTest.php +++ b/tests/View/Antlers/ParserTest.php @@ -345,7 +345,7 @@ public function testNullCoalescence() $this->assertEquals('Pass', Antlers::parse('{{ missing ?? "Pass" }}', $this->variables)); } - public function testMiniTernary() + public function testTruthCoalescing() { $this->assertEquals('Pass', Antlers::parse('{{ string ?= "Pass" }}', $this->variables)); $this->assertEquals('Pass', Antlers::parse('{{ associative:one ?= "Pass" }}', $this->variables)); @@ -365,7 +365,7 @@ public function testMiniTernary() $this->assertEquals('Pass', Antlers::parse('{{ ! missing:thing ?= "Pass" }}', $this->variables)); } - public function testMiniTernaryInsideLoop() + public function testTruthCoalescingInsideLoop() { $template = '{{ complex }}{{ first ?= "Pass" }}{{ /complex }}';