Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CombineIfRector creates fatal error when PHP closing tag at end of if #8465

Closed
kkmuffme opened this issue Feb 5, 2024 · 3 comments
Closed
Labels

Comments

@kkmuffme
Copy link

kkmuffme commented Feb 5, 2024

Bug Report

Subject Details
Rector version last dev-main
Installed as composer dependency

Minimal PHP Code Causing Issue

See https://getrector.com/demo/6b4b9466-d3fe-449a-a265-5da3f7db4544

<?php

final class DemoFile
{
    public function run(int $param, int $param_two)
    {
        if ($param > 0) {
            if ($param_two > 0) { ?>
                hello
            <?php }
        }
    }
}

Responsible rules

  • CombineIfRector

Expected Behavior

rectorphp/rector-src#5565

@kkmuffme kkmuffme added the bug label Feb 5, 2024
@samsonasik
Copy link
Member

That's the drawback of mix php+html. You can skip the rules for mixed php+html.

Thank you for understanding.

@kkmuffme
Copy link
Author

kkmuffme commented Feb 5, 2024

Kind of defeats the purpose of rector, since this is a common pattern in legacy code - which is the purpose of rector, isn't it? On a modern code base I don't need any of those rules in the first place, since these issues don't exist there.

@samsonasik
Copy link
Member

Rector is rely on nikic/php-parser, the support should be included there.

@rectorphp rectorphp locked as too heated and limited conversation to collaborators Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants