Skip to content

Commit 16874a9

Browse files
committed
refactor: improve readability of comma detection
1 parent 40183ed commit 16874a9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Install/Mcp/FileWriter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ protected function needsCommaAfterBrace(string $content, int $bracePosition): bo
179179
$afterBrace = substr($content, $bracePosition + 1);
180180
$trimmed = preg_replace('/^\s*(?:\/\/.*$)?/m', '', $afterBrace);
181181

182-
// If next char is } (empty object) or nothing, no comma needed
183-
return ! empty($trimmed) && $trimmed[0] !== '}';
182+
return filled($trimmed) && ! Str::startsWith($trimmed, '}');
184183
}
185184

186185
protected function findMatchingClosingBrace(string $content, int $openBracePos): int|false

0 commit comments

Comments
 (0)