Skip to content

Commit

Permalink
[5.6] Add @Dump blade helper (#23364)
Browse files Browse the repository at this point in the history
* Add @Dump blade helper

* Update CompilesHelpers.php
  • Loading branch information
gilbitron authored and taylorotwell committed Mar 2, 2018
1 parent 0556a4a commit 57944a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Illuminate/View/Compilers/Concerns/CompilesHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ protected function compileDd($arguments)
return "<?php dd{$arguments}; ?>";
}

/**
* Compile the "dump" statements into valid PHP.
*
* @param string $arguments
* @return string
*/
protected function compileDump($arguments)
{
return "<?php dump{$arguments}; ?>";
}

/**
* Compile the method statements into valid PHP.
*
Expand Down
1 change: 1 addition & 0 deletions tests/View/Blade/BladeHelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ public function testEchosAreCompiled()
$this->assertEquals('<?php echo method_field(\'patch\'); ?>', $this->compiler->compileString("@method('patch')"));
$this->assertEquals('<?php dd($var1); ?>', $this->compiler->compileString('@dd($var1)'));
$this->assertEquals('<?php dd($var1, $var2); ?>', $this->compiler->compileString('@dd($var1, $var2)'));
$this->assertEquals('<?php dump($var1, $var2); ?>', $this->compiler->compileString('@dump($var1, $var2)'));
}
}

0 comments on commit 57944a1

Please sign in to comment.