@@ -89,136 +89,17 @@ keywords will not always meet the criteria for minor release. For example, speci
8989of spaces for indentation creates a new implicit requirement that projects must use one style consistently; this new
9090burden on projects to reformat incoming contributions to their chosen style defines the change as major.
9191
92- ## 5. Approaches
93-
94- The overarching approach is to attempt to apply existing PSR-12 styling and rationale to
95- new functionality as opposed to establishing new conventions.
96-
97- ### 5.1. Strict Types Declarations
98-
99- There was a discussion about whether strict types should be enforced in the standard
100- https://github.com/cs-extended/fig-standards/issues/7 . All were in agreement we should only
101- use a MUST or MUST NOT statement and avoid the use of a SHOULD statement and nobody wanted
102- to say that strict types could not be declared. The discussion was whether it should be
103- considered a coding style item which should be covered or whether it was out of scope, and it
104- was decided to be out of scope of a coding style guide.
105-
106- ### 5.2. Finally and Return Types Declaration Spacing
107-
108- Numerous options were suggested, and they can be seen
109- [ here for return type declarations] ( https://gist.github.com/michaelcullum/c025f3870c9ea1dd2668#file-returntypesspacing-php ) or
110- [ here for finally blocks] ( https://gist.github.com/michaelcullum/c025f3870c9ea1dd2668#file-finallyblocks-php )
111- and the current implementation was chosen due to consistency with other parts of the standard.
112-
113- ### 5.3. Enforcing short form for all type keywords
114-
115- PHP 7.0 introduced [ scalar types declaration] ( http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration )
116- which does not support long type aliases. Therefore, it makes sense to enforce primary short type forms to be used to
117- have uniform syntax and prevent possible confusion.
118-
119- ### 5.4. Public Survey
120-
121- In order to settle things using data, survey was conducted and responses from 142 people
122- including 17 project representatives were gathered:
123-
124- #### 5.4.1. PHP-FIG Representative Results
125-
126- | Representative | Project | Compound namespaces with a depth of two or more MUST not be used | Header statement grouping and ordering | Declare statements must each be on their own line | Declare statements in PHP files containing markup | Declare statements have no spaces: ` declare(strict_types=1); ` | Block declare statement formatting | ` new ` keyword usage, parenthesis required | Return type declaration formatting | Use statement leading slashes disallowed | Block namespace declaration formatting | General operator spacing | Try, Catch, Finally formatting | Anonymous class declaration formatting | Keyword casing, only lower case | Type keywords, short form only |
127- | -------------- | ------- | ---------------------------------------------------- | ---------------------------------- | ----------------------------------------- | ------------------------------------------- | -------------------------------------------------------- | ------------------------------- | ------------------------------------- | ------------------------------- | ------------------------------------ | ----------------------------------- | ---------------------- | --------------------------- | ----------------------------------- | --------------------------- | -------------------------- |
128- | Alexander Makarov | Yii framework | ✓ | ✓ | ✓ | ❌ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
129- | Korvin Szanto | concrete5 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
130- | Leo Feyer | Contao | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
131- | Larry Garfield | Drupal | ✓ | ✓ | ✓ | ✓ | ✓ | ❌ | ✓ | ✓ | ✓ | ❌ | ✓ | ✓ | ❌ | ✓ | ✓ |
132- | André R. | eZ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
133- | Jan Schneider | Horde | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
134- | Karsten Dambekalns | Neos and Flow | ✓ | ✓ | ✓ | ✓ | ❌ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
135- | Andres Gutierrez | Phalcon | ❌ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
136- | Ryan Thompson | PyroCMS | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ❌ | ❌ | ✓ | ✓ | ✓ | ✓ | ✓ |
137- | Matteo Beccati | Revive Adserver | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ❌ | ✓ | ✓ | ✓ | ✓ |
138- | Damian Mooyman | SilverStripe | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
139- | Brian Retterer | Stormpath PHP SDK | ✓ | ✓ | ✓ | ❌ | ❌ | ✓ | ❌ | ✓ | ❌ | ✓ | ✓ | ✓ | ✓ | ❌ | ❌ |
140- | Matthew Weier O'Phinney | Zend Framework | ❌ | ✓ | ✓ | ❌ | ✓ | ✓ | ✓ | ❌ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
141- | Jordi Boggiano | Composer | ❌ | ❌ | ❌ | ✓ | ✓ | ✓ | ❌ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
142- | Ben Marks | Magento | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
143- | Chuck Burgess | PEAR | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
144- | | ** Totals** : | 13/3| 15/1| 15/1| 13/3| 14/2| 15/1| 14/2| 15/1| 14/2| 14/2| 15/1| 16/0| 15/1| 15/1| 15/1|
145-
146- #### 5.4.2. General non-representative voters
147-
148- | Question | For | Against | Percentage For |
149- | -------- | --- | ------- | -------------- |
150- | Compound namespaces required depth | 114 | 12 | 89.47% |
151- | Header statement grouping and ordering | 113 | 13 | 88.5% |
152- | Declare statements must each be on their own line | 120 | 6 | 95% |
153- | Declare statements in PHP files containing markup | 119 | 7 | 94.12% |
154- | Declare statements have no spaces | 116 | 10 | 91.38% |
155- | Block declare statement formatting | 118 | 8 | 93.22% |
156- | ` new ` keyword usage, parenthesis required | 116 | 10 | 91.38% |
157- | Return type declaration formatting | 115 | 11 | 90.43% |
158- | Use statement leading slashes disallowed | 118 | 8 | 93.22% |
159- | Block namespace declaration formatting | 120 | 6 | 95% |
160- | General operator spacing | 123 | 3 | 97.56% |
161- | Try, Catch, Finally formatting | 124 | 2 | 98.39% |
162- | Anonymous class declaration formatting | 117 | 9 | 92.31% |
163- | Keyword casing, only lower case | 124 | 2 | 98.39% |
164- | Type keywords, short form only | 121 | 5 | 95.87% |
165-
166- ### 5.5. Multiline Function Arguments Mixed With Multiline Return
167-
168- A potential readability issue [ was raised on the mailing list] ( https://groups.google.com/d/msg/php-fig/ULSL4gqK8GY/cgDELuPOCQAJ ) .
169- We reviewed options for changes to the specification that could provide better readability and
170- the floated option was to require a blank line after the opening bracket of a function if the
171- arguments and the return are both multiline. Instead, it was pointed out that this specification
172- _ already_ allows you to decide where you'd like to add blank lines, and so we will leave it to
173- the implementors to decide.
174-
175- ## 6. Changelog
176-
177- Please note this changelog is not a verbose list of changes from PSR-12 and further but highlights the most
178- notable changes. It should be considered a new specification, and therefore you should read the
179- specification for a full understanding of its contents.
180-
181- ### 6.1. New Statements
182-
183- * Lowercase for all keywords - Section 2.5
184- * Short form for all type keywords - Section 2.5
185- * Use statement grouping - Section 3
186- * Use statement blocks - Section 3
187- * Declare statement/Strict types declaration usage - Section 3
188- * Parentheses are always required for class instantiation - Section 4
189- * Typed properties - Section 4.3
190- * Return type declarations - Section 4.5
191- * Variadic and reference argument operators - Section 4.5
192- * Type hints - Section 4.5
193- * Add finally block - Section 5.6
194- * Operators - Section 6
195- * Unary operators - Section 6.1
196- * Binary operators - Section 6.2
197- * Ternary operators - Section 6.3
198- * Anonymous classes - Section 8
199-
200- ### 6.2. Clarifications and Errata
201-
202- * Adjust 'methods' to 'methods and functions' in a number of instances - Throughout
203- * Adjust references to classes and interfaces to also include traits - Throughout
204- * StudlyCaps meaning clarified as PascalCase - Section 2.1
205- * The last line should not be blank but contain an EOL character - Section 2.2
206- * Blank lines may be added for readability except where explicitly forbidden within the PSR - Section 2.3
207- * PSR-2 errata statement about multi-line arguments - Section 4
208- * PSR-2 errata statement about extending multiple interfaces - Section 4
209- * Forbid blank lines before/after closing/opening braces for classes - Section 4
210-
211- ## 7. People
212-
213- ### 7.1. Editor:
92+ ## 5. People
93+
94+ ### 5.1. Editor:
21495
21596* Larry Garfield
21697
217- ### 7 .2. Sponsor:
98+ ### 5 .2. Sponsor:
21899
219100* Chris Tankersley
220101
221- ### 7 .3. Working Group Members:
102+ ### 5 .3. Working Group Members:
222103
223104* Alexander Makarov
224105* Ken Guest
@@ -237,6 +118,7 @@ specification for a full understanding of its contents.
237118
238119_ ** Note:** Order descending chronologically._
239120
121+ * ** [ Migration Document: PER-CS v2.0 to v3.0] ( migration-3.0.md ) **
240122* ** [ Migration Document: PER-CS v1.0 to v2.0] ( migration-2.0.md ) **
241123* ** PSR-12:** https://www.php-fig.org/psr/psr-12/
242124* ** PSR-2:** https://www.php-fig.org/psr/psr-2/
0 commit comments