-
Notifications
You must be signed in to change notification settings - Fork 26
How should abbreviations and acronyms be written? #83
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
In Yii3 we use camel case:
|
At present there is no standard, I believe. I've seen people say Internals has one for PHP, but it's not followed consistently. (I forget off hand which way it goes, honestly.) Were we to adopt anything, it should follow what Internals does. That means knowing what Internals wants to do. 😄 |
About a class naming convention.My preference would be to recommend Readability : using underscore as a separator for all-caps-word-groups used in class names , Variety : using underscore as a separator for all-caps-word-groups in class names , To my knowledge , ExamplesSome (hypothetical) class name examples with all-caps-word-groups . XML HTTP RequestAn With lowercasing it could be made clear : With underscore as separator it could be made clear : With the combination it could be made clear : {SMS ,SM S}API InputA With underscore as abbreviation separator it could be made clear : With lowercasing it could be made clear : X{, }S{, }L{, }T ProcessorA With underscore as separator it could be made clear : |
Current PHP (inconsistencies)Regarding the "standard [..] for PHP [..] not followed consistently" these pages https://www.php.net/manual/en/reserved.interfaces.php , https://www.php.net/manual/en/reserved.classes.php , https://www.php.net/manual/en/refs.xml.php show some inconsistent naming of classes. |
Is it (PER-working group) policy to follow any standard used by PHP Internals ? |
We have no official stance, as a WG or as FIG, on following Internals conventions. Though Internals conventions are indeed one factor we should consider among many. |
Update: Internals adopted a standard for new classes in 2017, that uses PascalCase except for Acronyms. https://wiki.php.net/rfc/class-naming So It would be logical to follow suit for user-space. |
Combinations of Acronyms/Initialisms, such as Neither is such a thing mentioned in php/php-src#2552 (comment) its file changes. What that change does mention is the following.
|
For reference: https://news-web.php.net/php.internals/122975. |
Were this to be added to the PER, I would classify such conventions as 'highly recommended', so as SHOULD level requirements. I would not make it MUST level requirements, as there are a lot of edge cases or alignment with other systems (the XMLHttpRequest example for instance). For FIGs own artifacts, there is also the bylaws to consider: https://www.php-fig.org/bylaws/psr-naming-conventions/ |
Updated php-src policy merged in php/php-src#14169. |
Closing in favor of #95. |
We have a recommendation to use StudlyCaps (PascalCase) naming in the PER:
PER
Class names
Method names
But how should we write abbreviations and acronyms?
I suggest following camel case, e.g.,
loadHttpUrl
as recommended in the "Google TypeScript Style Guide".Google TypeScript Style Guide:
The text was updated successfully, but these errors were encountered: