-
-
Notifications
You must be signed in to change notification settings - Fork 44
Pascal Case for constants #67
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
Comments
It is marked as |
The reason is that PascalCase constants look better in the code. I've fixed the documentation. |
Your mamma looks better in the code, it doesn’t mean that she belongs
there. This explanation suits your leadership and is another reason to
avoid nette.
Thanks for confirmation on that.
st 18. 5. 2022 v 17:21 odesílatel David Grudl ***@***.***>
napsal:
… Closed #67 <#67>.
—
Reply to this email directly, view it on GitHub
<#67 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJAUTMJZGNJU5TOBU32U7MTVKUDJNANCNFSM5WIQTZNQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
zase nesmyslné novinky! Nechceš zavádět místo dlouhých názvů zkratky? :D Stále nechápu modu!Programování není o modních výstřelcích ale o standardech. |
@Kocicak I won't miss a prick like you around here. Bye-bye. @petrparolek Please use English |
Ok, so to make the code more pretty, you now have all constants defined twice. Once with upper snake case, once with pascal case. Not to mention when using those constants, IDE will offer you every constant twice, in each case. I wonder which case will everyone following PSR-1 choose :) Can't help it, but the code doesn't seem prettier or improved in any way. PS: I wasn't saying I'm leaving, just it's a reason to. These kind of changes and your reasoning about them is not what one expects in mature, stable project. There was no discussion, no explanation, just change in new patch version. |
BC?
Improvable by
Probably blindly the upper case? With a small prayer everytime?
Try to use it month or two. Personally, I would never came back. Good code is readable like story. Much better with pascal case constants. One can focus on logic, not syntax.
without BC break |
IDE will still offer you two variants, one will be struck-through. If I want to comply with PSR-1 in my project, I will use deprecated ones and IDE will mark those usages as errors / warnings. Not a great idea.
Well, code is not a story. Logic tells you that constants are upper case, so when you see it, you don't need to focus on syntax. I think this is highly subjective, but when I read code with pascal case constants, It seems like I'm looking at static method call. So now I have to focus on syntax to know that this is not static method call, but poorly named constant. The resulting effect is opposite, readability is actually worse.
But there was a BC break before it got fixed, wasn't? |
BTW Capitalised class constants are leaving PHP itself with the advent of enums https://www.php.net/manual/en/language.enumerations.basics.php |
PSR-1 states that "Class constants MUST be declared in all upper case with underscore separators." It is about declaration, not about usage.
Then you will probably have the same problem with enum cases. Enums RFC uses PascalCase. e.g. Symfony and Monolog already do the same. Also all methods should be camelCase anyway, according to PSR-1, don't they?
Anything marked |
Oh, one more thing. Seems like the PSR-12 follow up may be okay with PascalCase too. They state that: "This example encompasses some rules below as a quick overview" and then use They are now even discussing recommendation of PascalCase. (even though CamelCase is confusingly used in PR) |
8bf7455
Hi, in version 3.1.3, constant NAMESPACE_SEPARATOR disappeared and is no longer available. And also backward compatible name has not been added. Can you please add upper snake case constant?
Also, why Pascal Case for class constants? This is opposed to PSR-12, which you claim, that Nette follows: https://doc.nette.org/en/contributing/coding-standard. PSR-12 states that PSR-1 must be adhered. And PSR-1 states that "Class constants MUST be declared in all upper case with underscore separators". So why is Nette not following PSR-12 coding standard?
EDIT: also, why is backward-incompatible change released as patch version and not major version?
Thanks.
The text was updated successfully, but these errors were encountered: