humbug / php-scoper

🔨 Prefixes all PHP namespaces in a file/directory to isolate the code bundled in PHARs.
MIT License
709 stars 76 forks source link

Preserve line breaks in scoped code #1083

Open hirasso opened 2 days ago

hirasso commented 2 days ago

Feature Request

Currently, quite some line breaks are being stripped from scoped code. This makes that code hard to read (I'm also scoping my own package's main code).

If it's technically possible, it would be amazing to preserve all line breaks / leave them untouched.

theofidry commented 20 hours ago

I agree it would be best to preserve formatting if possible. I tried it at some point but had to give up as it requires more work, as PHP-Scoper modifies/inserts some statements.

There was an attempt done at https://github.com/humbug/php-scoper/pull/1051. I think https://github.com/nikic/PHP-Parser/issues/1007#issuecomment-2169722319 opened as part of that PR https://github.com/nikic/PHP-Parser/issues/1007#issuecomment-2169722319

hirasso commented 13 hours ago

If you ever solve this it would be amazing! I'm sure though you have enough on your plate 🥤