Skip to content

[AutoImport] Skip first stmt is InlineHTML#3288

Merged
samsonasik merged 4 commits intomainfrom
autoimport-skip-first-stmt-inner-html
Jan 15, 2023
Merged

[AutoImport] Skip first stmt is InlineHTML#3288
samsonasik merged 4 commits intomainfrom
autoimport-skip-first-stmt-inner-html

Conversation

@samsonasik
Copy link
Copy Markdown
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
Copy Markdown
Member Author

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

@samsonasik
Copy link
Copy Markdown
Member Author

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

@TomasVotruba
Copy link
Copy Markdown
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