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

[AutoImport] Skip first stmt is InlineHTML #3288

Merged
merged 4 commits into from
Jan 15, 2023

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Jan 15, 2023

When first stmt is shebang as InlineHTML cause invalid code:

#!/usr/local/bin/php -q

Ref https://getrector.org/demo/a11313d3-7ec9-47a2-815e-93bf60b71f3f ,

make <?php ?> before it make the shebang printed as HTML, so not a solution.

also, skip when first stmt is normal HTML:

<div>
    some text
</div>

Ref https://getrector.org/demo/7ee487d4-020b-48d8-b1f5-b74597eef1fb

Fixes rectorphp/rector#7714

@samsonasik
Copy link
Member Author

@r-simlinger this PR fix rectorphp/rector#7714 by skip auto import when first stmt is InlineHTML

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review

@TomasVotruba
Copy link
Member

Feel free to merge 👍

@samsonasik samsonasik merged commit 8f4642c into main Jan 15, 2023
@samsonasik samsonasik deleted the autoimport-skip-first-stmt-inner-html branch January 15, 2023 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RectorConfig::importNames produces invalid code
2 participants