Commit d9f1879
committed
PSR2/PropertyDeclaration: update for properties with asymmetric visibility [2]
Per the FIG PSR-PER updates (next version), the "set-visibility MUST be _after_ the (read-)visibility".
This commit implements this, but as there may be two visibility modifiers, a minor refactor of the code involved in the wrong order checks for the `final` keyword and the `static` and `readonly` keywords is also needed as we can no longer presume that we can use the visibility keyword found with a search backwards to re-position other keywords.
Includes plenty of tests.
Includes a minor update to pre-existing test expectations (whitespace only), which is related to the refactor of the "fix"-code. As this sniff does not enforce any spacing requirements after the keywords, this difference is neglicable for the purpose of this sniff.
Note: in a future iteration, we may want to look at making the code for the "order" checks more efficient, but for now, at least it will work correctly again.
Refs:
* php-fig/per-coding-style 99
* php-fig/per-coding-style 1141 parent 051ef9f commit d9f1879
File tree
4 files changed
+97
-18
lines changed- src/Standards/PSR2
- Sniffs/Classes
- Tests/Classes
4 files changed
+97
-18
lines changedLines changed: 48 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
132 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
133 | 136 | | |
134 | 137 | | |
135 | 138 | | |
136 | 139 | | |
137 | 140 | | |
138 | 141 | | |
139 | | - | |
140 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
141 | 175 | | |
142 | 176 | | |
143 | 177 | | |
| |||
161 | 195 | | |
162 | 196 | | |
163 | 197 | | |
164 | | - | |
165 | | - | |
| 198 | + | |
| 199 | + | |
166 | 200 | | |
167 | 201 | | |
168 | 202 | | |
169 | 203 | | |
170 | 204 | | |
171 | 205 | | |
172 | 206 | | |
173 | | - | |
| 207 | + | |
174 | 208 | | |
175 | 209 | | |
176 | 210 | | |
177 | 211 | | |
178 | 212 | | |
179 | 213 | | |
180 | 214 | | |
181 | | - | |
182 | | - | |
| 215 | + | |
| 216 | + | |
183 | 217 | | |
184 | 218 | | |
185 | 219 | | |
186 | 220 | | |
187 | 221 | | |
188 | 222 | | |
189 | | - | |
190 | | - | |
| 223 | + | |
| 224 | + | |
191 | 225 | | |
192 | 226 | | |
193 | 227 | | |
194 | 228 | | |
195 | 229 | | |
196 | 230 | | |
197 | 231 | | |
198 | | - | |
| 232 | + | |
199 | 233 | | |
200 | 234 | | |
201 | 235 | | |
202 | 236 | | |
203 | 237 | | |
204 | 238 | | |
205 | 239 | | |
206 | | - | |
207 | | - | |
| 240 | + | |
| 241 | + | |
208 | 242 | | |
209 | 243 | | |
210 | 244 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
112 | 128 | | |
Lines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
109 | 125 | | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
66 | 79 | | |
67 | 80 | | |
68 | 81 | | |
| |||
0 commit comments