mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Update coding conventions to match SilverStripe practices
This commit is contained in:
parent
30c0f82221
commit
a772eb1528
@ -17,10 +17,11 @@ Always use hard tabs rather then spaces for indentation, with one tab per nestin
|
|||||||
|
|
||||||
### Maximum Line Length
|
### Maximum Line Length
|
||||||
|
|
||||||
The target line length is 100 characters, meaning developers should strive keep each line of their code
|
The target line length is 100 columns with tabs being treated as four columns,
|
||||||
under 80 characters where possible and practical.
|
meaning developers should strive keep each line of their code
|
||||||
|
under 80 columns where possible and practical.
|
||||||
However, longer lines are acceptable in some circumstances.
|
However, longer lines are acceptable in some circumstances.
|
||||||
The maximum length of any line of PHP code is 120 characters.
|
The maximum length of any line of PHP code is 120 columns.
|
||||||
|
|
||||||
### Line Termination
|
### Line Termination
|
||||||
|
|
||||||
@ -40,8 +41,9 @@ Class and filenames are in `UpperCamelCase` format:
|
|||||||
:::php
|
:::php
|
||||||
class MyClass {}
|
class MyClass {}
|
||||||
|
|
||||||
If a class name is comprised of more than one word, the first letter of each new word must be capitalized.
|
If a class name is comprised of more than one word, the first letter of each
|
||||||
Successive capitalized letters are not allowed, e.g. a class `XMLImporter` is not allowed while `XmlImporter` is acceptable.
|
new word must be capitalized. Successive capitalized letters are used in
|
||||||
|
acronyms, e.g. a class `XMLImporter` is used while `XmlImporter` is not.
|
||||||
|
|
||||||
### Methods
|
### Methods
|
||||||
|
|
||||||
@ -128,6 +130,9 @@ PHP code must always be delimited by the full-form, standard PHP tags:
|
|||||||
Short tags are never allowed. For files containing only PHP code, the closing tag must always be omitted.
|
Short tags are never allowed. For files containing only PHP code, the closing tag must always be omitted.
|
||||||
It is not required by PHP, and omitting it prevents the accidental injection of trailing white space into the response.
|
It is not required by PHP, and omitting it prevents the accidental injection of trailing white space into the response.
|
||||||
|
|
||||||
|
Files must end with an empty new line. This prevents problems arising from the end-of-file marker appearing where other
|
||||||
|
white space is expected.
|
||||||
|
|
||||||
### Strings
|
### Strings
|
||||||
|
|
||||||
#### String Literals
|
#### String Literals
|
||||||
|
Loading…
x
Reference in New Issue
Block a user