Closed ENG3PLabs closed 3 months ago
PHP_EOL in this package alone won't solve it, some of the \n
comes from the other package https://github.com/barryvdh/ReflectionDocBlock too (sibling package, but still).
I wonder if an external tool like https://cs.symfony.com/doc/rules/whitespace/line_ending.html could solve this in a better way.
Many tools modifying the source suffer this or similar problems. To give a prominent example: rector is a fantastic tool to automatically format/rewrite your code. But even they recommend to use it together in a pipeline with a dedicated code formatting tools (they recommend easy-coding-standard AFAIK).
I see ide-helper similar: you are supposed to have a tool chain in place which takes care of this formatting issues.
For example, in a project I use ide-helper, I wouldn't be able to properly use it if I hadn't rector and php-cs-fixer with it in the pipeline, as it would also generate code blocks not matching the required formatting for the project (e.g. class imports).
I also wonder why, after so many years, this is (I believe) the first time this comes up. Do you think you can look into external tooling?
Hey, thanks for your answer!
What a shame, that there is such a rat-tail, but I agree: fixing it on your end if something down the line is causing the problem is not what we should be doing.
By "looking into external tooling" you mean, if I would be ok to just work around it on my end with the tools that you mentioned? Definitely!
Update: In the end, it was nothing to be worried about in the first place. When I finally tried to commit the files with the seemingly unwanted changes, git auto-crlf took care of them and only the actual changes were commited.
Case closed.
Summary
When checking out my project in Windows, git transforms line endings to CRLF since I have
core.autocrlf
set totrue
inside my git config.When I rerun the command to update a model mixin, all my models get touched since the tool changes the line endings from CRLF to LF where the php docs are. This makes the files show up as changed on git status. Since the actual content did not change, I would rather not have them show up there.
I propose to either
ModelsCommand.php:1012
However, the same issue goes for the model file itself when using the mixin option as well as (probably) also the other commands.