You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Rector uses [nikic/php-parser](https://github.com/nikic/PHP-Parser/), built on technology called an *abstract syntax tree* (AST). An AST doesn't know about spaces and when written to a file it produces poorly formatted code in both PHP and docblock annotations.
according to this issue, most issues with spacing were long since resolved?
in my preliminary testing with Rector, I have not seen it mangle any spaces - and that's in a codebase with no code standard 🙂
I understand there may still be some issues with spacing, but I almost skipped Rector (and would have done all of my rename operations by hand in PHP Storm instead) because of this warning - and clearly, it goes have some level of awareness of spacing, or this project would most likely have been totally mangled. 😅
(glad I chose Rector, as this will save me a lot of time! thank you for this incredible tool!)
Hi, thanks for the question. You're right 🙂 , it can be serious warning or not relevant at all, it depends on your codebase.
We've had many opposite reactions, where people wanted all the spaced to remain the same, but technically it was not possible, so we added this warning to expect the edge-case issues (depending on your code base) and be prepated.
Activity
TomasVotruba commentedon Mar 11, 2024
Hi, thanks for the question. You're right 🙂 , it can be serious warning or not relevant at all, it depends on your codebase.
We've had many opposite reactions, where people wanted all the spaced to remain the same, but technically it was not possible, so we added this warning to expect the edge-case issues (depending on your code base) and be prepated.
samsonasik commentedon Mar 11, 2024
@mindplay-dk when no change on the target file, there is tweak on rector when comparing output from php-parser printer vs original file content:
rector/src/Application/FileProcessor.php
Lines 161 to 181 in 3e8c192
with php-parser v5, the printed content no longer
ltrim-ed, which we will revisit later once phpstan go to v2 which will require php-parser v5