Mainly for my personal view of the PSR-2 specification.

Source: Internet
Author: User

1. The code must be indented using 4 space characters instead of the TAB key.

2. After each namespace namespace declaration statement and the use declaration statement block, you must insert a blank line.

3. The opening curly brace ({) of a class must be written in a line after the function declaration, and the closing curly brace (}) must also be written in a row after the function body.

4. The opening curly brace ({) of the method must be written in a line after the function declaration, and the closing curly brace (}) must also be written in a row after the function body.

5. The properties and methods of the class must add access modifiers (private, protected, and public), abstract and final must be declared before the access modifier, and static must Declared after the access modifier.

6. All PHP files must end with a blank line. Pure PHP code files must omit the last?> end tag

7.PHP All keywords must be all lowercase. Constants True, FALSE, and null must also all lowercase

8. Each attribute must have an access modifier added. You must not declare a property using the keyword var. Each statement must not have more than one attribute defined.

Mainly for my personal view of the PSR-2 specification.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.