Skip to content

Invalid auto-semicolon inside string interpolation #166

@Creeps44

Description

@Creeps44

Description
The formatter automatically inserts a semicolon inside a string interpolation block. For example, a line like:
Error moving file '{$file_name}' to folder: {$e->getMessage()}
is transformed into:
Error moving file '{$file_name}' to folder: {$e->getMessage();}

Interestingly, this seems to manifest inconsistently depending on whether there are multiple such lines in the same file. If at least one line in the file already contains a semicolon when saving, the formatter seems to leave the others untouched. However, if all lines of this pattern (string interpolation with curly braces) lack the semicolon upon saving, the formatter then incorrectly adds the semicolon to all of them.

Expected Behavior
No semicolon should be added inside the braces, preserving the original (and valid) syntax:
echo "Error moving file '{$file_name}' to folder: {$e->getMessage()}";

Thank you for looking into this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions