@@ -26,7 +26,7 @@ To help alleviate this issue with PSR-12, we have taken a more prescriptive appr
2626defined the standards for new language features as they are released.
2727
2828However, it is for a lack of wanting to be dictatorial that we aimed to apply PSR-2
29- styling, rationale and stances (Described in Section 4 , Approaches) in PSR-12 instead of
29+ styling, rationale and stances (Described in Section 5 , Approaches) in PSR-12 instead of
3030establishing new conventions.
3131
3232The same approach is applied to the current PER.
@@ -57,12 +57,42 @@ PSR-12.
5757It is not the intention of this PER to add entirely new coding style guidelines. It will
5858also not change anything stipulated in PSR-1 and PSR-12.
5959
60- ## 4. Approaches
60+ ## 4. Versioning
61+
62+ New releases of this PER are assigned version numbers in keeping with [ semantic versioning] ( https://semver.org/ ) .
63+ Semantic versioning is well defined when applied to software releases but has no common definition in other contexts.
64+ This PER applies the following meanings:
65+
66+ * ** Patch** versions may contain:
67+ * Any changes that do not alter the underlying requirements of this PER, such as fixing typos, adding clarifications or
68+ other modifications with no compatibility impact.
69+ * ** Minor** versions may additionally:
70+ * Add new requirements for PHP syntax previously unspecified in this PER.
71+ * Add, remove or alter requirements in a way that is both more permissive and backwards compatible for implementers.
72+ * ** Major** versions may additionally:
73+ * Add, remove or alter any requirements.
74+
75+ Projects are expected to pin their own coding style guidelines to a major version of this PER, allowing for regular
76+ upgrades to minor and patch releases as they are published. When performing such upgrades, it is intended that no change
77+ to existing code is required to maintain compliance with all requirements and recommendations of this PER. This ensures
78+ new code contributions processed by an automatic formatter follow (or disregard) recommendations consistently with the
79+ existing code.
80+
81+ Please note this backwards compatibility promise does not extend to projects that use new PHP syntax yet to be specified
82+ in this PER. In this circumstance, a minor version may introduce new requirements that are effectively breaking changes.
83+
84+ It is ultimately determined whether a meaningful change may be included in a minor release on a case-by-case basis by
85+ consensus. The addition of ` MAY ` or ` OPTIONAL ` requirements or the removal of requirements with non-optional RFC 2119
86+ keywords will not always meet the criteria for minor release. For example, specifying that projects may use tabs instead
87+ of spaces for indentation creates a new implicit requirement that projects must use one style consistently; this new
88+ burden on projects to reformat incoming contributions to their chosen style defines the change as major.
89+
90+ ## 5. Approaches
6191
6292The overarching approach is to attempt to apply existing PSR-12 styling and rationale to
6393new functionality as opposed to establishing new conventions.
6494
65- ### 4 .1. Strict Types Declarations
95+ ### 5 .1. Strict Types Declarations
6696
6797There was a discussion about whether strict types should be enforced in the standard
6898https://github.com/cs-extended/fig-standards/issues/7 . All were in agreement we should only
@@ -71,25 +101,25 @@ to say that strict types could not be declared. The discussion was whether it sh
71101considered a coding style item which should be covered or whether it was out of scope, and it
72102was decided to be out of scope of a coding style guide.
73103
74- ### 4 .2. Finally and Return Types Declaration Spacing
104+ ### 5 .2. Finally and Return Types Declaration Spacing
75105
76106Numerous options were suggested, and they can be seen
77107[ here for return type declarations] ( https://gist.github.com/michaelcullum/c025f3870c9ea1dd2668#file-returntypesspacing-php ) or
78108[ here for finally blocks] ( https://gist.github.com/michaelcullum/c025f3870c9ea1dd2668#file-finallyblocks-php )
79109and the current implementation was chosen due to consistency with other parts of the standard.
80110
81- ### 4 .3. Enforcing short form for all type keywords
111+ ### 5 .3. Enforcing short form for all type keywords
82112
83113PHP 7.0 introduced [ scalar types declaration] ( http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration )
84114which does not support long type aliases. Therefore, it makes sense to enforce primary short type forms to be used to
85115have uniform syntax and prevent possible confusion.
86116
87- ### 4 .4. Public Survey
117+ ### 5 .4. Public Survey
88118
89119In order to settle things using data, survey was conducted and responses from 142 people
90120including 17 project representatives were gathered:
91121
92- #### 4 .4.1. PHP-FIG Representative Results
122+ #### 5 .4.1. PHP-FIG Representative Results
93123
94124| 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 |
95125| -------------- | ------- | ---------------------------------------------------- | ---------------------------------- | ----------------------------------------- | ------------------------------------------- | -------------------------------------------------------- | ------------------------------- | ------------------------------------- | ------------------------------- | ------------------------------------ | ----------------------------------- | ---------------------- | --------------------------- | ----------------------------------- | --------------------------- | -------------------------- |
@@ -111,7 +141,7 @@ including 17 project representatives were gathered:
111141| Chuck Burgess | PEAR | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
112142| | ** 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|
113143
114- #### 4 .4.2. General non-representative voters
144+ #### 5 .4.2. General non-representative voters
115145
116146| Question | For | Against | Percentage For |
117147| -------- | --- | ------- | -------------- |
@@ -131,7 +161,7 @@ including 17 project representatives were gathered:
131161| Keyword casing, only lower case | 124 | 2 | 98.39% |
132162| Type keywords, short form only | 121 | 5 | 95.87% |
133163
134- ### 4 .5. Multiline Function Arguments Mixed With Multiline Return
164+ ### 5 .5. Multiline Function Arguments Mixed With Multiline Return
135165
136166A potential readability issue [ was raised on the mailing list] ( https://groups.google.com/d/msg/php-fig/ULSL4gqK8GY/cgDELuPOCQAJ ) .
137167We reviewed options for changes to the specification that could provide better readability and
@@ -140,13 +170,13 @@ arguments and the return are both multiline. Instead, it was pointed out that th
140170_ already_ allows you to decide where you'd like to add blank lines, and so we will leave it to
141171the implementors to decide.
142172
143- ## 5 . Changelog
173+ ## 6 . Changelog
144174
145175Please note this changelog is not a verbose list of changes from PSR-12 and further but highlights the most
146176notable changes. It should be considered a new specification, and therefore you should read the
147177specification for a full understanding of its contents.
148178
149- ### 5 .1. New Statements
179+ ### 6 .1. New Statements
150180
151181* Lowercase for all keywords - Section 2.5
152182* Short form for all type keywords - Section 2.5
@@ -165,7 +195,7 @@ specification for a full understanding of its contents.
165195* Ternary operators - Section 6.3
166196* Anonymous classes - Section 8
167197
168- ### 5 .2. Clarifications and Errata
198+ ### 6 .2. Clarifications and Errata
169199
170200* Adjust 'methods' to 'methods and functions' in a number of instances - Throughout
171201* Adjust references to classes and interfaces to also include traits - Throughout
@@ -176,33 +206,33 @@ specification for a full understanding of its contents.
176206* PSR-2 errata statement about extending multiple interfaces - Section 4
177207* Forbid blank lines before/after closing/opening braces for classes - Section 4
178208
179- ## 6 . People
209+ ## 7 . People
180210
181- ### 6 .1. Editor:
211+ ### 7 .1. Editor:
182212
183213* Korvin Szanto
184214
185- ### 6 .2. Sponsor:
215+ ### 7 .2. Sponsor:
186216
187217* Chris Tankersley
188218
189- ### 6 .3. Working Group Members:
219+ ### 7 .3. Working Group Members:
190220
191221* Alexander Makarov
192222* Ken Guest
193223* Larry Garfield
194224* Luke Diggins
195225* Woody Gilk
196226
197- ### 6 .4. Special Thanks
227+ ### 7 .4. Special Thanks
198228
199229* Everyone involved in PSR-1, PSR-2, PSR-12.
200230
201- ## 7 . Votes
231+ ## 8 . Votes
202232
203233* ** Entrance Vote:** https://groups.google.com/g/php-fig/c/YqPDYGK0RhM/m/pJmThkNKBgAJ
204234
205- ## 8 . Relevant Links
235+ ## 9 . Relevant Links
206236
207237_ ** Note:** Order descending chronologically._
208238
0 commit comments