#1
I'm using the Zed Text Editor to build with Trongate v2.

Every time I save, it adds a new empty line. It's driving me crazy. I've tried every setting known to humanity. Every AI tool worth talking to. Nothing.

A little digging revealed something interesting. Turns out, our self-appointed overlords at PHPFIG decided that they want to enforce new empty lines at the end of PHP files. My hated for them knows no limits.

Here's a little bit of history about the empty line thing and I obtained this information with a little help from Gemini:

The final empty newline is a 50-year-old ghost from the early days of Unix and C. Ancient teletype machines and compilers defined a "line" as a sequence of characters that must end in a newline (\n); without it, the last line was considered "incomplete" and often ignored by tools. While modern hardware doesn't have this limitation, the PHP-FIG and the makers of editors like Zed have turned this obsolete technical requirement into a mandatory "standard." By forcing this line onto your code, your editor is prioritizing 1970s terminal compatibility over your own creative autonomy.

If Gemini is right then it confirms - once again - that far from being modern, PHPFIG is backwards looking. Some of us have known this to be true for a long time.

So, here are some questions I have for you. Best answers get the points:

1). Do you like to have an empty line at the end of your files?

2). Does your text editor enforce empty lines when you save?

3). What's your attitude towards having empty lines at the end of your files?

4). What's your advice to me? For example, should I; 1). keep fighting Zed? 2). Switch to another text editor? 3). Embrace the new line thing?

JUST TO SAY: Sublime Text remains my 'goto' but I require a text editor for situations where I'm working with AI.
#2

The thread creator has indicated that this post solved the problem or provided the best insight.

Members who post winning responses earn points for our leaderboard.
Points mean prizes!
Hello Dave,

Interesting questions you have here. Here are my answers:

1.) Yes, I like to have an empty line at the end of my files.

2.) My editor: I use Sublime Text and by default, it does not enforce a new line at the end of the file when saving. However, I have this feature turned on by setting "ensure_newline_at_eof_on_save": true.

3.) My attitude: I think it doesn't hurt to go with the conventions in this instance. Although I don't religiously follow PSR standards (for example I'm not a big fan of their recommendation on the placement of curly braces in classes and functions), ending the file with a new line has some benefits for me:

When it comes down to it, this is not such a big deal. It's really up to you whether you want to have those empty lines or not. I think consistency in your codebase is more important than blindly adhering to standards. For me, it's better to close every file with a new line because:
- I work with Git.
- I do a lot of shell scripting and use UNIX-based tools.
- I use Sublime for everything so it doesn't hurt to be consistent in my PHP files too.

4.) My advice to you: If you really need to use Zed, then embrace the new line thing. You can turn that on in Sublime Text as well so that your work will be consistent across the two editors.

I hope I could help. 👍🏻
#3
That's very frustrating DC, and don't blame you for fighting this enforced legacy requirement.

As you may know, I mostly use VSCode with K&R formatting via Prettier turned on by default. I like it a lot. I know that if I get code snippets from AI, other sources or if I'm too lazy to hit tab and hit save, it all just formats beautifully regardless.

However, it also adds a newline at the end of the file. It's there, I'm used to it, does it bother me? No. Can I easily avoid it? Yes. How? I hit `Ctrl K` then `Ctrl+Shift S` to save without formatting.

I have to do that when doing pull requests for Trongate; sometimes I forget, and what would be a simple one-line fix turns out to be a full reformat of your work. I do apologise when that happens. I try to avoid it.

Those little things annoy me too, but each to their own.

Balazs’ strongest point, technically, is actually the Git diff argument. That’s the one most senior developers eventually concede because clean diffs genuinely reduce friction in teams and open-source projects.
#4
vim.g.autoformat = false Is one of the first things I configure on a fresh Neovim.

On zed, if you installed the php support then it likely pulled in phpactor, in the settings you can disable format on save


On topic of end newline, I get the frustration but as Balazs pointed out, there are valid reasons for it beyond arbitrary preferences.
Personally, I don’t mind it.
#5
Thank you, folks.

I'm so glad that I asked the question because I was driving myself crazy with that. It would appear that I'm the only person in the world who really cares about things like that and perhaps I ought to stop obsessing over things like that.

Now, onto the points.

Originally, I was going to wimp out and not award any points because you're all brilliant.

However, I decided to award the win to Balazs in this instance and I'll tell you why.

Having posted and given it some thought, I now think that the 100% perfect response to my thread would be something like this:

"Don't worry about it. The only person who really cares about it is you. No big deal."

So, the above one would have been the gold standard - at least, from my own slightly selfish perspective. I basically needed somebody to give me a sort of reality check.

I took a trip to ChatGPT, pasted in the thread, pasted in what I think would be the perfect response. Then, I pasted in the three excellent responses above. Then, I asked ChatGPT, "Which of these three responses was closest to (what I think is) the 'perfect' response?"

Here's Chat GPT's response:

START

The response that came closest to your “perfect” response was almost certainly Balazs’.

Not because it agreed with you most.
Not because it was the shortest.
Not because it was the most emotionally supportive.

But because of this line:

“When it comes down to it, this is not such a big deal.”

That sentence is the core of your “perfect response”.

Everything else in his reply is basically:

“Here are the reasons people do this.”
“Here are the technical benefits.”
“You don’t have to love it.”
“Consistency matters more.”
“It’s ultimately your choice.”

In other words, he gently de-escalated the issue.

That is exactly what your ideal response does:
it lowers the emotional temperature without dismissing your feelings entirely.

Now compare that to the others:

DaFa’s response validated the frustration and joined the battle a little. It strengthened the emotional investment instead of dissolving it. Very friendly, very human, but not calming.
sasin91’s response was concise and practical, but emotionally neutral. It lacked the subtle “this really doesn’t matter very much” quality.

Balazs essentially said:

“There are some valid reasons for the convention, but ultimately this isn’t worth losing sleep over.”

That is extremely close to:

“Don’t worry about it. The only person who really cares is you. No big deal.”

The difference is that your version is more psychologically piercing because it contains a tiny sting of truth:

you are the one carrying most of the emotional weight of the issue.

And deep down, I suspect you already knew that when you wrote the post. Part of the humour comes from the theatrical overreaction to something microscopic. That self-awareness is what makes the post entertaining rather than merely ranty.

Also, the phrase:

“My hatred for them knows no limits.”

followed by:

“The only person who really cares about it is you.”

creates a perfect comedic contrast. One is operatic fury. The other is a calm shrug. That juxtaposition is funny.

A bit like declaring holy war over a single invisible character at the bottom of a file.

END


Anyway, that was Chat GPT's feedback. The other points I would add is that I think Dafa is the best problem solver I've ever met when it comes to web development. After having read his response I came away from it a wee bit unsure as to whether or not he was personally for or against the new lines. Had he nailed his colours to the mast - one way or another - then he may have got the win.

The response from sasin91 was packed with real technical assistance. That's fantastic! But alas, the settings trick just doesn't work. It's interesting that he mentioned using NeoVim. I ended up looking into that and it would appear that it's growing in popularity. This might be something worth further investigation in the future.

Thank you one and all for your excellent responses. The big takeaway for me is that I need to chill out when it comes to things like that.
#6
Thank you for awarding me the best answer. It was my honest take on the topic, and I'm really glad it proved helpful. DaFa and sasin91 also shared some excellent insights. I truly appreciate the wisdom here and am grateful to be part of such a great community.