-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switching to PSR-2 #2747
Comments
i am against spaces, in netbeans their usage is painful, also i dont think that switching PSR styles here and there is good, we should be strict in usage one of them and not jumping from one to another. |
Should we vote, I'm for it. I'm not bringing any arguments up, referred issues are enough. |
I personally was hoping that Yii2 would conform to all the PSR standards, was disappointed to see that it doesn't. There's nothing wrong with conforming with a standard that's agreed upon. Thus, I vote for PSR-2. |
definitly for psrX...working with different coding styles in one project is a pain in the ass...iteroperability ftw, thats why mostly every php library switched to it, it simply makes code formatting a no-brainer in the php world... personal preferences should stand back on this one, every ide can handle it properly. |
@digitalkaoz can you show me how faster you will be by browsing code with vim and PSR-2 spaces, or in netbeans IDE? So you are proposing that each programmer should be some piano master to remember all switch-combinations and use them? I also dont like arguments splitting in method signature, it only makes code unreadable. |
so you rating "browsing code without shortcuts" higher than "common readability across different libraries"? vim: alt+shift+arrays, phpstorm alt+arrows ;) its just not a matter of personal preferences, its a matter of a common sense, correct formatting is done by some tools or your ide itself |
yes, i rate usability higher than some ability with 3rd party libs, also you can see that there a lot of such decisions and PR in Yii2 where usability is higher then some other PSR. And you proposing to use 3-4 buttons for simple browsing? I dont like it, also remember that you can simply push some other button and consequences can be awful. How long you were using Yii? It looks like you just came and want to do |
Vote for PSR-2 |
yes i came by from a psrX world, where this discussion ended a few years ago in favor of a common sense ;) |
so, @digitalkaoz you was not using Yii and just forcing idea of spaces here, right? Do you understand that there are a lot of Yii1 and Yii2 (already) projects that use tabs, and a lot of Yii developers that already use and prefere to use tabs, and now you are just suggesting them to forget everything and support a lot of projects with new formatting? |
Noone is forcing anyone to do anything. Many members of great PHP projects have already accepted a standard as a way to have interoperability. It is nice to have a community that agrees on some standards that would make developer's lives easier. The argument about Yii1 is completely irrelevant. Whoever has started a project in Yii2 should've known about the risks of starting a project with a framework that is in Alpha still. Also, suggesting that just because someone hasn't used Yii since day one, doesn't have a say in this, gives a very bad image about the Yii community in general. |
yes i am dont prejudiced against yii, but not using a common sense in the php world just sounds insane to me. its like being stuck in old paradigms |
@digitalkaoz so you telling me that all developers switched to spaces and none use tabs? really? what common sence are you talking about? Afaik there always will be 2 points: tabs vs spaces. And since you are not using Yii and dont know its workflow you are trying to force here PSR-2. That is not good. Well as i said, i am against it, but not for me to decide ofcourse, but all this last Yii2 changes just guide fw to some madness. |
+1 for switching to PSR-2 ... @Ragazzo What's the big deal about switching to spaces for a project once? Just run a formatter. There was a 50/50 chance for tabs vs. spaces in the standard, which is very widely accepted in the PHP world now. I didn't analyze ist, but I'd estimate 90% of extensions on packagist are using spaces. |
PSR-2 is a common sense, just to make php code almost the same style in every project, so our brains just dont have to fiddle around in which library we are editing right now...and yes i havent seen tabs for long time... what does a coding style has todo with a workflow of things? i have to use yii in a future project, and wondered when i started to dig into the code... |
@schmunk42 running formatter is such a pain) also extensions should follow main fw codestyle as you know. @digitalkaoz yeah, i read that guide, as i said i dont like attributes splitting and other things. Anyway not for me to decide. Also what about switching Yii1 to PSR-2 then? Dont see good reasons against it, why not?)) |
That's not entirely true. Tabs vs spaces discussion on PSR mailing list never ended. People just got tired and voted to accept something since it was clear there will be no 100% agreement. Many people from php-fig including me think PSR-2 is not perfect. |
It's already stable. That would be very bad timing while for 2.0 it is still possible. |
Try https://github.com/fabpot/PHP-CS-Fixer and yes, that's why the FW should change here ;) @samdark Correct. If the decision for the PHP world would have been tabs, I'd be using tabs now. |
you never get every person to fully agree with some opinions of others. but at least we had a decision. i am against changing it for 1.x but for 2.x it really makes sense i think |
+1 For keeping tabs What people keep saying that using spaces is common sense? What if "standards" changes and tell you that you should use 3 spaces instead? Good luck with that! |
fixing code formatting against a ruleset, is a matter of minutes nowadays... spaces makes it readable the same on every device with every software out of the box, so its just a matter readability not a matter of personal preferences |
+1 for spaces. Spaces are de-facto standard in PHP back since (I think?) 1998 when PEAR was born. And the advantages are self-evident: Spaces are unambiguous. A space is a space is a space. A tab can be everything. Given that we mix more and more foreign libraries into our projects it's a real pain to switch back and forth between standards. And the real danger is, when you start mixing tabs with spaces (often without notice). |
It is not about pro-contra features, it's just about having the same standard across the PHP world.
The purpose of a standard is, that these things don't change all the time! |
@schmunk42 you are telling this in Yii2 repo? where in last week a lot of big BC breaks occured :D |
@Ragazzo let's keep this discussion clean from offtopic please. BC breaks aren't relevant before stable release. |
I agree with @schmunk42. I think it should be a no-brainer to follow PSR-2. |
and please lets focus on psr2, psr4 is another good thing, but thats already introduced :) |
+1 for psr 2 |
removed tabs rule, see yiisoft/yii2#2747
Should it be removed |
@iJackUA It's already merged: https://github.com/yiisoft/yii2-coding-standards/pull/9/files ;) |
@schmunk42 no, that's another line , it is still exist in |
The most reasonable indentation style is SmartTabs: indentation with tabs, alignment with spaces. I’m against changing Yii style to spaces only :-( And many modern IDEs and editors do it right. |
@maximal that's not about usability, it is about overall consistency in PHP world. |
@maximal can't agree more but the majority of people seem to love standards and stick to them without questioning whether it is useful or not... |
interoperability is useful, much more then personal coding style preferences ;) |
Agree with you. Framework in any given language, probably, should use current standard for this language (PSR-2 for PHP, for instance). But, from the other hand, why did unreasonable standard remains real then? |
@maximal it's a long term holywar that resulted in spaces decision withing php-fig. I prefer any decision to no decision regarding it. |
you dont have to configure spaces in any editor in any os in any environment, they just look the same for everyone... |
@digitalkaoz, anyway, I don’t know any situation when smart-tabbed text brokes its alignment. |
Enough I can't think of a less interesting topic to argue about. This is turning into another sign that it's time to move on from github. |
yes am also tired about discussing tabs vs spaces, it just doesnt matter, following a standard matters |
i'm for tabs, coz IDE can be configured. I'm using tabs from c/c++ times at the deep past. Spaces is pain for "fast-fixing" outside of IDE and mostly always breaks such 'nice' formatting :( But i'm for standard here. Anyways, i'm not going to patch framework alot, so for projects i will still use tabs :) |
Sorry, but one more try. Tabs advantages:
Spaces advantages:
Spaces became standard, yes. But that was strictly because people were unable to use tabs properly. That was 30-, 20-, 10-years-ago problem. But why are they unable to use tabs now, when IDEs are mighty? The less we use tabs, the less chances they have to became standard. People now are just afraid to use them. It means that standard needs to be reviewed. Sorry again. |
That's the question for PSR, not for Yii. If there will be another standard with tabs we'll switch to it immediately. |
@samdark, thank you, Alexander. |
@lucianobaraglia yeah, it's still popping up from time to time but not that often and it's not as hot as it was. |
@lucianobaraglia, thanks. I opened php-fig/fig-standards#264, but @pmjones closed the discussion. If you guys have any ideas, I’m open to requests — https://github.com/maximal/tab/. |
@maximal spaces dinosaurs still rule the Earth... 😐 |
Hey, people! Why are you still using blank lines for readability? Maybe it's time to invent vertical tab? And why do we use spaces between words instead of \s+ ? One could config own IDE to show that symbols as exotically, as he'd like! Seriously, i think tabs are not so widely used, because they are alone. One configurable parameter is not enough for introducing the concept of such a configurability. Maybe some day there will be more... |
Why do you guys pay so much attention to this? |
What a great fail this is. Way to ruin a great framework. And yes, it is obviously a very important discussion, otherwise there wouldn't be an endless stream of opinions on the topic. If it wasn't important, the discussion would die out. There will never be a common agreement on this. Either "side" of the discussion will be unhappy, while the other is happy. |
+1 for keeping tabs, even if it's too late :P |
@kotslon 1) Because blank lines apparently are fine as "vertical whitespace" for most people, otherwise there would have been more discussion about it. 2) Vertical tab already exists, check your facts before typing.. 3) Same as (1). Seems you just wanted to try making this more complicated than it is, which is rather pointless. The things you mention are clearly not an issue for people, so there's no use in bringing them up. @alpharder Because people care a lot, and because someone brought it up again in #2743. If there are, as you say, more important things to discuss, then the spaces zealots shouldn't bring this up over and over again. There's been so much bullshit in this thread that there's no way one can comment on all of it. And obviously it doesn't matter anyway since the decision has been made. Kudos to the pro-tab people for standing up for their beliefs. With this, I'm done. |
I can say I prefer Yii 1 coding style and didn't like this change, That was right decision that removes another one barrier on the way of Framework growth and popularity. |
See #2743, #9
The text was updated successfully, but these errors were encountered: