Skip to content

[WIP] do not override printing files with previous stmts in MultipleClassFileToPsr4ClassesRector#1463

Closed
TomasVotruba wants to merge 3 commits intomasterfrom
psr-4-bug-fix
Closed

[WIP] do not override printing files with previous stmts in MultipleClassFileToPsr4ClassesRector#1463
TomasVotruba wants to merge 3 commits intomasterfrom
psr-4-bug-fix

Conversation

@TomasVotruba
Copy link
Copy Markdown
Member

@TomasVotruba TomasVotruba commented May 23, 2019

Closes #1408 The issues is a bit deeper than just printing file.

For printing new class, the style of old nodes is used. It not designed to do that though, so it brings various of conclits.

This fix prints new class in a raw native php-parser (= "ugly") format, regardless the format of the original file.

My idea is to detect somehow style from the parsed file and apply it to every new printed file, e.g. declare(strict_types=1); is always on first line in the file, so every printed Declare_ node should be on first line. It won't be easy, but more reliable.

What do you think @JanMikes ?

@TomasVotruba TomasVotruba changed the title do not override printing files with previous stmts in MultipleClassFileToPsr4ClassesRector [WIP] do not override printing files with previous stmts in MultipleClassFileToPsr4ClassesRector May 23, 2019
@TomasVotruba
Copy link
Copy Markdown
Member Author

In the end it would take extreme time to make is at least "not-bad".

Still better to stick with own/prepared coding standards that will fix it better

@TomasVotruba TomasVotruba deleted the psr-4-bug-fix branch May 23, 2019 16:48
@TomasVotruba
Copy link
Copy Markdown
Member Author

Replaced by #1464

TomasVotruba added a commit that referenced this pull request Dec 11, 2021
rectorphp/rector-src@4bb7ad6 [CodeQuality] Handle inner function return exactly DateTime on DateTimeToDateTimeInterfaceRector (#1463)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants