Difference between revisions of "PHP"
From Officience
Welcomeadmin (talk | contribs) |
|||
Line 1: | Line 1: | ||
+ | [[Category: IT Knowledge]] | ||
+ | |||
= Php Checklist = | = Php Checklist = | ||
* No syntax/runtime errors and warnings | * No syntax/runtime errors and warnings |
Latest revision as of 10:31, 13 July 2017
Php Checklist
- No syntax/runtime errors and warnings
- No deprecated functions
- No dead code
- Check comments for file/class/function, the comments should be clear
- Each function is doing only a single thing
- A method should not be larger than 40 lines of code
- Initialize the variable before using it in a function
- No public class attributes
- Use constants in the left hand side of the comparison
- No mix the php code and template (view). A view should not contain any business logic code
- Use single quote ( ‘ ) for php string without double quote (")
- Always customize a general exception with a custom message
- All the exceptions correctly shows correct / understandable error messages to the user
- Never ever put up the error information of system crash that expose the internal behavior of the system.
- Uniform a coding standard through a project (ex PHP Code Sniffer)
- No magic numbers, should be define as a constant with clear comments
- Should have unit test with 100% coverage
- Always commit /Rollback database transaction at the earliest