Coding Standards/conventions Question:

List the naming conventions in Coding Standards?

Tweet Share WhatsApp

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.

Download Coding Standards PDF Read All 26 Coding Standards Questions
Previous QuestionNext Question
What is the structure of Coding Standard?From where the name CamelCase derived?