1. General
- Try to unify the IDE such as the Phpstream configuration file (Settings→code Style→php→set from ... →predefined STYLE→PSR1/PSR2) See standard operation
- Indent must use 4 spaces instead of the TAB key
- File name StudlyCaps
- Class name StudlyCaps
- Constant uppercase words _ delimited words
- Method Variable Property CamelCase
- Private Property __ Start
- The code column is best not to exceed 120
- No more than 100 rows for a single function
2. Documents
- File name StudlyCaps
- Document best Unified Utf-8 without BOM
- Pure PHP files do not add?> end
3. About line breaks and spaces
- namespace and use direct class declaration between
- Empty two lines between property methods
- Class Method {} Independent account row
- If while logic code {peer
4. String
- String contains variables with "" "Pure string with"
- Long string stitching requires a newline
- Because PHP "" can carry a variable, so sprintf can not
5. Condition Control
- Reduce nesting Click to see the case
- Switch instead of multiple ElseIf "some scenarios can use arrays instead of Swith"
6. About annotations
- Commenting on the business
7. Additional Rules
- Use empty () to avoid notice hints when judging uncertainties
Development environment
SVN of the development environment must modify the synchronization to version control main performance two aspects of the problem
- Common development of the same function
- Release version Overlay issues
PHP authoritative Code style specification