Open DMouse10462 opened 2 months ago
As a workaround you can wrap this block in <!-- @formatter:off -->
and <!-- @formatter:on -->
to disable. If the code is so fragile that a single whitespace casues a parse error then there is probably a better way to write it.
Describe the bug Switch/case, when used as a control structure within (HTML) output, must not contain whitespace between the switch statement and the first case. See warning at https://www.php.net/manual/en/control-structures.alternative-syntax.php
The formatter provided indents the syntax as with other control structures, violating this rule.
To Reproduce Format the following code:
Observe the output, which adds indentation to the first case statement in violation of the syntax requirements:
An error appears at the opening
<?php
token with the following message:Expected behavior No indentation should be added before
<?php case (1): ?>
. Ideally, formatting should also not break the case statement onto a new line from<?php
.Platform and version Windows 11 Version 22H2 (OS Build 19405.4651) VS Code Version: 1.89.1 (system setup) PHP Intelephense Version 1.10.4