From 4a4580645092d7807393c56471a90c84142ab53f Mon Sep 17 00:00:00 2001 From: Shuhei Hayashibara Date: Mon, 9 Oct 2023 21:45:32 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20unnecessary=20indent=20in?= =?UTF-8?q?=20raw=20php=20directive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __tests__/fixtures/formatted.raw_php_block.blade.php | 2 +- src/formatter.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/__tests__/fixtures/formatted.raw_php_block.blade.php b/__tests__/fixtures/formatted.raw_php_block.blade.php index 0bce3dc4..265025cd 100644 --- a/__tests__/fixtures/formatted.raw_php_block.blade.php +++ b/__tests__/fixtures/formatted.raw_php_block.blade.php @@ -4,7 +4,7 @@ @foreach ($users as $user) @php $users = $_GET; - + foreach ($users as $key1 => $value) { if (is_array($value)) { foreach ($value as $key2 => $value2) { diff --git a/src/formatter.ts b/src/formatter.ts index d2974ddd..d1d81828 100644 --- a/src/formatter.ts +++ b/src/formatter.ts @@ -1357,6 +1357,10 @@ export default class Formatter { return prefixForEnd + line; } + if (line.length === 0) { + return line; + } + return prefix + line; }) .join('\n')