Coding Standards/conventions Question:
Download Job Interview Questions and Answers PDF
List the naming conventions in Coding Standards?
Answer:
☆ Use camelCase, not underscores, for variable, function and method names, arguments;
☆ Use underscores for option names and parameter names;
☆ Use namespaces for all classes;
☆ Prefix abstract classes with Abstract. Please note some early Symfony classes do not follow this convention and have not been renamed for backward compatibility reasons. However all new abstract classes must follow this naming convention;
☆ Suffix interfaces with Interface;
☆ Suffix traits with Trait;
☆ Suffix exceptions with Exception;
☆ Use alphanumeric characters and underscores for file names;
☆ For type-hinting in PHPDocs and casting, use bool (instead of boolean or Boolean), int (instead of integer), float (instead of double or real);
☆ Don't forget to look at the more verbose Conventions document for more subjective naming considerations.
☆ Use underscores for option names and parameter names;
☆ Use namespaces for all classes;
☆ Prefix abstract classes with Abstract. Please note some early Symfony classes do not follow this convention and have not been renamed for backward compatibility reasons. However all new abstract classes must follow this naming convention;
☆ Suffix interfaces with Interface;
☆ Suffix traits with Trait;
☆ Suffix exceptions with Exception;
☆ Use alphanumeric characters and underscores for file names;
☆ For type-hinting in PHPDocs and casting, use bool (instead of boolean or Boolean), int (instead of integer), float (instead of double or real);
☆ Don't forget to look at the more verbose Conventions document for more subjective naming considerations.
Download Coding Standards Interview Questions And Answers
PDF
Previous Question | Next Question |
What is the structure of Coding Standard? | From where the name CamelCase derived? |