Skip to content

Commit

Permalink
naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed Jan 30, 2020
1 parent 618e5ac commit 84a6fd4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/View/Antlers/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
4 changes: 2 additions & 2 deletions tests/View/Antlers/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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 }}';

Expand Down

0 comments on commit 84a6fd4

Please sign in to comment.