#6810 (Please, use tabs instead of spaces)

You must first sign up to be able to contribute.

Ticket #6810 (closed enhancement: wontfix)

Opened 5 years ago

Last modified 5 years ago

Please, use tabs instead of spaces

Reported by: jeenajeena Assigned to: fabien
Priority: minor Milestone:
Component: other Version: 1.2.7
Keywords: Cc:
Qualification: Unreviewed


Manual says:

"indentation is always done by two blank spaces; tabs are not used. This is because tabs have a different space value according to the text editor you use"

Not only is this convention useless (wanna have 2 spaces for a tab? Just set "tabs=2 spaces" in your favourite editor. Wanna have 4? You're free, it won't disturb other developers) but it's even dangerous: spaces are impossible to maintain with a plain editor, while tabs are flexible.

Tabs are democratic: one can change his own display style without interacting with others. Spaces are dictatorial: everyone MUST accept Fabien's style.

The rule "use 2 spaces" has the same meaning of forcing people to use Arial 14pt for their editor just because Fabien does it. Why?


Using tabs would allow Fabien to display his code with 2 spaces tabs, other developers to display with 4 and so on: without drawbacks.

The problem "code with mixed tab and blank indentation is impossible to read." is very simple: don't use spaces. Spaces are fixed, they are the origin of this problem. Use tabs, like every developer is used to do.

You should use tabs exactly because the manual says "tabs have a different space value according to the text editor you use": that is, no matter how you set your tabs (2 spaces, 8 spaces, what you like) the code will always be indented. And Fabien will always be able to display it with 2 spaces.

Tabs setting (2 spaces, 8 spaces, whatever you want) only changes the way you display the code in your own editor (that is yours) and never alters the code other developers will display. Spaces alter everyone's display. No choose.

Let developers choose how display their code always respecting a strict indenting rule. Pleace, think about it: there's only one way to gain this flexibility: using tabs.

Change History

07/10/09 10:10:13 changed by FabianLange

  • status changed from new to closed.
  • resolution set to wontfix.

you are free to use whatever you like. this affects symfony own code only. There is no reason to argue. However you should note that the YAML Specification mandates spaces.

07/10/09 10:14:22 changed by jeenajeena

Thanks for your reply.

No problem with YAML.

The problem is with autogenerated code: it uses spaces. My suggestion was to use tabs instead.

07/10/09 10:24:33 changed by jeenajeena

  • status changed from closed to reopened.
  • resolution deleted.

07/10/09 10:50:56 changed by mark_jaques

i agree. generated code with spaces are unconfortable.

Other people complain with it

tabs are simple, adopt them for generated code, it would be nice for everyone

(follow-up: ↓ 6 ) 07/10/09 11:31:47 changed by fabien

  • status changed from reopened to closed.
  • resolution set to wontfix.

(in reply to: ↑ 5 ) 07/10/09 11:45:55 changed by jeenajeena

Replying to fabien:

It's a pity you don't even want to discuss about it. The truth is "2 spaces for indentation" is a non-sense. You're the boss, hence we will accept (or we will manually change all the code generated by symfony)

"won't fix" is dictatorial like your "Fabien uses 2 spaces for a tab, do the same, obey".

Nice to know you are not open to discussions.

07/10/09 12:07:13 changed by fabien

I'm quite open to the discussion. But this is really a discussion about the color of the bikeshed. We have always used 2 spaces for symfony. Some developeres prefer to use tabs, and I can understand that. But we need to make a choice.

Even if I change the symfony coding standards and convert all symfony files to use tabs, some other developers will start writing me emails and open tickets about the change, and will argue that 2 spaces were actually a better coding standard.

So, there is no way we can make everybody happy. That's why I don't see the need to discuss this non-issue further.

07/10/09 12:17:58 changed by jeenajeena

A discussion about the color of the bikeshed? There are guides out there to explain developers how to deal with indentation and symfony. How to configure vim for symfony, how to configure eclipse and so on.

No one asks to change the core code of symfony: the request is to have the opportunity to have generated code with tabs or with spaces. It's so simple...

Admit that symfony is so weird about this behavior that you had to write it in the manual. No one will die for this behavior, we all can accept it. But it's funny to see how much you try to defend it.

07/10/09 12:36:04 changed by fabien

The thing is that symfony uses spaces everywhere, not tabs, period. I'm not aware of a single guide about "configuring" any editor for symfony. You will definitely find guides about how to configure your editor for YAML files, which is a totally different story. I'm not trying to defend anything, you wanted some explanations, I gave you some.

That said, if you can come up with a simple patch that can make it configurable for the generated files, please do so. But there is no need to argue for ages on this topic.

And by the way, I'm not the only one who use spaces instead of tabs as you suggest in your last comment. The Zend framework uses spaces, not tabs, and the same goes for ezComponents, Drupal, PEAR, and many other PHP projects.