diff --git a/src/Illuminate/View/Compilers/BladeCompiler.php b/src/Illuminate/View/Compilers/BladeCompiler.php index aec1b00425c8..62005da34610 100644 --- a/src/Illuminate/View/Compilers/BladeCompiler.php +++ b/src/Illuminate/View/Compilers/BladeCompiler.php @@ -401,7 +401,7 @@ protected function storeVerbatimBlocks($value) */ protected function storePhpBlocks($value) { - return preg_replace_callback('/(?storeRawBlock(""); }, $value); } diff --git a/tests/View/Blade/BladePhpStatementsTest.php b/tests/View/Blade/BladePhpStatementsTest.php index b90cc74a12a2..21a7d9deab8e 100644 --- a/tests/View/Blade/BladePhpStatementsTest.php +++ b/tests/View/Blade/BladePhpStatementsTest.php @@ -11,131 +11,6 @@ public function testPhpStatementsWithExpressionAreCompiled() $this->assertEquals($expected, $this->compiler->compileString($string)); } - public function testMixedPhpStatementsAreCompiled() - { - $string = <<<'BLADE' - @php($set = true) - @php($set = true) @php ($set = false;) @endphp - @php ($set = true) @php($set = false;)@endphp -
{{ $set }}
- @php - $set = false; - @endphp - @php ( - $set = false; - )@endphp - @php( - $set = false; - )@endphp - @php ( - $set = false - ) - @php( - $set = false - ) - @php - $set = '@@php'; - @endphp - BLADE; - $expected = <<<'PHP' - - - -
- - - - - - - PHP; - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - public function testCompilationOfMixedPhpStatements() - { - $string = '@php($set = true) @php ($hello = \'hi\') @php echo "Hello world" @endphp'; - $expected = ' '; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - public function testCompilationOfMixedUsageStatements() - { - $string = '@php ( - $classes = [ - \'admin-font-mono\', // Font weight - ]) - @endphp'; - $expected = ''; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - public function testMultilinePhpStatementsWithParenthesesCanBeCompiled() - { - $string = <<<'BLADE' - @php ( - $classes = [ - 'admin-font-mono' - ]) - @endphp - - Laravel - BLADE; - - $expected = <<<'PHP' - - - Laravel - PHP; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - public function testMixedOfPhpStatementsCanBeCompiled() - { - $string = <<<'BLADE' - @php($total = 0) - {{-- ... --}} -
{{ $total }}
- @php - // ... - @endphp - BLADE; - - $expected = <<<'PHP' - - -
- - PHP; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - public function testStringWithParenthesisWithEndPHP() { $string = "@php(\$data = ['related_to' => 'issue#45388'];) {{ \$data }} @endphp";