PHPPSR-2 Supplemental documentation PSR-2 Supplemental Documentation
Summary
This specification aims to develop a series of standardized PHP code rules to reduce the inconvenience caused by different code styles when browsing code of different authors.
When multiple programmers cooperate in multiple projects, a common coding specification is required,
The style norms in this article are derived from the common characteristics of different project code styles,
Therefore, the value of this specification lies in that we all follow this encoding style, not in itself.
Vote
Errata
3.1-multiline parameters)
Using one or more cross-row parameters (such as arrays and anonymous functions) does not need to trigger the single-row rule about the parameter list in Section 4.6,
Therefore, arrays and anonymous functions in the parameter table can be separately divided into multiple rows.
The following example is in line with PSR-2 specifications:
Get ('/hello/{name}', function ($ name) use ($ app) {return 'hello'. $ app-> escape ($ name );});3.2-multiline parameters)
When you need to expand multiple interfaces, The extends specifications are consistent with the implements specifications in Section 4.1.