Open dvaknheo opened 5 years ago
So your looking to have the initial PHP tag not move itself out to the current indentation on the first HTML tag?
You can demo how the library works here as well - https://beautifier.io/
Personally I would write it like this
<ul>
<?php foreach($data as $v){ ?>
<li><?=$v?></li>
<?php } ?>
</ul>
Hi, I would add another example of this problem. This is a php file:
<ul>
<?php
print " <li>This is a list</li>\n";
print " <li>with two items</li>\n";
?>
</ul>
This code generates the following html
<ul>
<li>This is a list</li>
<li>with two items</li>
</ul>
But if I format the php file using Format HTML in PHP, the program is now:
<ul>
<?php
print " <li>This is a list</li>\n";
print " <li>with two items</li>\n";
?>
</ul>
Notice that the <?php has been indented two spaces This code generates the following html
<ul>
<li>This is a list</li>
<li>with two items</li>
</ul>
Notice that the first <li> has 4 spaces instead of 2. A configuration option like php-cs-fixer.indentPhpTag: true/false could solve this issue. Thanking you in advance,
at first thank you to this good extension.
my code e.g.:
do keep it. don't want to be this as default :
because my style of php indent follow by <?php . not with the html. each time "<?php" is in first ,no has space before. so you can watch the php code clearly. and that cause no the space-fill line change the output.
<?= is as a word mixed in html .