summaryrefslogtreecommitdiff
path: root/CODING_STANDARDS
diff options
context:
space:
mode:
authorRichard Fussenegger <fleshgrinder@users.noreply.github.com>2017-06-03 13:32:48 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2018-08-06 13:31:02 +0200
commit35cb353dd507590f0ff0b23528eb3d1e5575ecbb (patch)
tree238d89739d8b2f894c8c2a0fbe6acb03d5e3f8b8 /CODING_STANDARDS
parent1c1567c9bcf30df9082fa437b9affd1a62fd61a9 (diff)
downloadphp-git-35cb353dd507590f0ff0b23528eb3d1e5575ecbb.tar.gz
[ci skip] Extended class naming rule
Diffstat (limited to 'CODING_STANDARDS')
-rw-r--r--CODING_STANDARDS34
1 files changed, 27 insertions, 7 deletions
diff --git a/CODING_STANDARDS b/CODING_STANDARDS
index 8931f8c98e..1e72328e9a 100644
--- a/CODING_STANDARDS
+++ b/CODING_STANDARDS
@@ -150,19 +150,39 @@ User Functions/Methods Naming Conventions
'buildsomewidget'
'getI()'
-7. Classes should be given descriptive names. Avoid using abbreviations where
+7. Class names should be descriptive nouns in PascalCase and as short as
possible. Each word in the class name should start with a capital letter,
- without underscore delimiters (CamelCaps starting with a capital letter).
- The class name should be prefixed with the name of the 'parent set' (e.g.
- the name of the extension)::
+ without underscore delimiters. The class name should be prefixed with the
+ name of the "parent set" (e.g. the name of the extension) if no namespaces
+ are used. Abbreviations and acronyms as well as initialisms should be
+ avoided wherever possible, unless they are much more widely used than the
+ long form (e.g. HTTP or URL). Abbreviations start with a capital letter
+ followed by lowercase letters, whereas acronyms and initialisms are written
+ according to their standard notation. Usage of acronyms and initialisms is
+ not allowed if they are not widely adopted and recognized as such.
Good:
'Curl'
- 'FooBar'
+ 'CurlResponse'
+ 'HTTPStatusCode'
+ 'URL'
+ 'BTreeMap' (B-tree Map)
+ 'Id' (Identifier)
+ 'ID' (Identity Document)
+ 'Char' (Character)
+ 'Intl' (Internationalization)
+ 'Radar' (Radio Detecting and Ranging)
Bad:
- 'foobar'
- 'foo_bar'
+ 'curl'
+ 'curl_response'
+ 'HttpStatusCode'
+ 'Url'
+ 'BtreeMap'
+ 'ID' (Identifier)
+ 'CHAR'
+ 'INTL'
+ 'RADAR' (Radio Detecting and Ranging)
Internal Function Naming Conventions
----------------------