Skip to content

Rector removes leading spaces before <?php endif; ?> #7841

@bigahuna

Description

@bigahuna

Question

I use Rector 0.15.21, php 8.1.16 and the sets SetList::CODE_QUALITY and SetList::PHP_81

If I run rector on a file that contains the following structure or something similar:

<div>
    <h4>
        List of users
    </h4>
    <ul>
        <?php foreach ($users as $user): ?>
        <li>
            <?= $user['name'] ?>
        </li>
        <?php endforeach; ?>
    </ul>
</div>

Rector always want's to remove the leading space before <?php endforeach; ?> and shows a message similar to this

-            <?php endforeach; ?>
+<?php endforeach; ?> 

endforeach

How can I disable this behaviour? Indentation is done by spaces, no tabs.

It is the same behaviour for <?php endif; ?>. It always tells me to remove leading spaces before the endif or endforeach statement and therefore breaks existing indentation on the related files.

Regards
Mike

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions