2

I'm currently using php intelephense (free) extension to vscode in order to format php sources.

I run in the following 'strange' behaviour, could someone explain why and how to correct it?

The last <?php tag gets unevenly indented - furthermore, if an a other piece of code is added it seems it's always the last piece which is oddly indented. like in the following examples

example 1:

function test()
{
    $x = 0; ?>
    <?php
    $y = 0;
    if (0 == $x) {
        $y = 1; ?>
        <?php
        $y = 2;
        $z = 3;
        ?>
    <?php
    }
    ?>
<?php <--- this tag is not well indented
    return $x;
}

example 2:

function test()
{
    $x = 0; ?>
    <?php
    $y = 0;
    if (0 == $x) {
        $y = 1; ?>
        <?php
        $y = 2;
        $z = 3;
        ?>
    <?php
    }
    ?>
    <?php <--- this tag is well indented
    return $x;
}

function test1()
{
    $x = 0;
    if ($x) {
    ?>
<?php <--- this tag seems to be not correctly indented  
        return 0;
    }
}

Christian
  • 685
  • 1
  • 5
  • 13

0 Answers0