You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: standard.md
+71-71Lines changed: 71 additions & 71 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,8 @@
1
1
# SlimAPI Coding Standard
2
2
3
+
## Multiple Empty Lines
4
+
Multiple consecutive newlines in a file are not allowed.
5
+
3
6
## Strict Types Declaration
4
7
When declaring strict types you should not put whitespace around the opening bracket or before the closing bracket.
5
8
<table>
@@ -21,9 +24,6 @@ When declaring strict types you should not put whitespace around the opening bra
21
24
</tr>
22
25
</table>
23
26
24
-
## Multiple Empty Lines
25
-
Multiple consecutive newlines in a file are not allowed.
26
-
27
27
## Class Declarations
28
28
The opening brace of a class must be on the line after the definition by itself.
29
29
<table>
@@ -262,31 +262,6 @@ Method names should not be prefixed with an underscore to indicate visibility.
262
262
</tr>
263
263
</table>
264
264
265
-
## Class Declarations
266
-
There should be exactly 1 space between the abstract or final keyword and the class keyword and between the class keyword and the class name. The extends and implements keywords, if present, must be on the same line as the class name. When interfaces implemented are spread over multiple lines, there should be exactly 1 interface mentioned per line indented by 1 level. The closing brace of the class must go on the first line after the body of the class and must be on a line by itself.
267
-
<table>
268
-
<tr>
269
-
<th>Valid: Correct spacing around class keyword.</th>
270
-
<th>Invalid: 2 spaces used around class keyword.</th>
271
-
</tr>
272
-
<tr>
273
-
<td>
274
-
275
-
abstract class Foo
276
-
{
277
-
}
278
-
279
-
</td>
280
-
<td>
281
-
282
-
abstract class Foo
283
-
{
284
-
}
285
-
286
-
</td>
287
-
</tr>
288
-
</table>
289
-
290
265
## Property Declarations
291
266
Property names should not be prefixed with an underscore to indicate visibility. Visibility should be used to declare properties rather than the var keyword. Only one property should be declared within a statement. The static declaration must come after the visibility declaration.
292
267
<table>
@@ -388,6 +363,31 @@ Property names should not be prefixed with an underscore to indicate visibility.
388
363
</tr>
389
364
</table>
390
365
366
+
## Class Declarations
367
+
There should be exactly 1 space between the abstract or final keyword and the class keyword and between the class keyword and the class name. The extends and implements keywords, if present, must be on the same line as the class name. When interfaces implemented are spread over multiple lines, there should be exactly 1 interface mentioned per line indented by 1 level. The closing brace of the class must go on the first line after the body of the class and must be on a line by itself.
368
+
<table>
369
+
<tr>
370
+
<th>Valid: Correct spacing around class keyword.</th>
371
+
<th>Invalid: 2 spaces used around class keyword.</th>
372
+
</tr>
373
+
<tr>
374
+
<td>
375
+
376
+
abstract class Foo
377
+
{
378
+
}
379
+
380
+
</td>
381
+
<td>
382
+
383
+
abstract class Foo
384
+
{
385
+
}
386
+
387
+
</td>
388
+
</tr>
389
+
</table>
390
+
391
391
## Namespace Declarations
392
392
Each use declaration must contain only one namespace and must come after the first namespace declaration. There should be one blank line after the final use statement.
393
393
<table>
@@ -483,29 +483,28 @@ There must be one blank line after the namespace declaration.
483
483
</tr>
484
484
</table>
485
485
486
-
## Elseif Declarations
487
-
PHP's elseif keyword should be used instead of else if.
486
+
## End File Newline
487
+
PHP Files should end with exactly one newline.
488
+
489
+
## Control Structure Spacing
490
+
Control Structures should have 0 spaces after opening parentheses and 0 spaces before closing parentheses.
488
491
<table>
489
492
<tr>
490
-
<th>Valid: Single word elseif keyword used.</th>
491
-
<th>Invalid: Separate else and if keywords used.</th>
493
+
<th>Valid: Correct spacing.</th>
494
+
<th>Invalid: Whitespace used inside the parentheses.</th>
492
495
</tr>
493
496
<tr>
494
497
<td>
495
498
496
499
if ($foo) {
497
500
$var = 1;
498
-
} elseif ($bar) {
499
-
$var = 2;
500
501
}
501
502
502
503
</td>
503
504
<td>
504
505
505
-
if ($foo) {
506
+
if ($foo) {
506
507
$var = 1;
507
-
} else if ($bar) {
508
-
$var = 2;
509
508
}
510
509
511
510
</td>
@@ -642,34 +641,35 @@ Case statements should be indented 4 spaces from the switch keyword. It should
642
641
</tr>
643
642
</table>
644
643
645
-
## Control Structure Spacing
646
-
Control Structures should have 0 spaces after opening parentheses and 0 spaces before closing parentheses.
644
+
## Elseif Declarations
645
+
PHP's elseif keyword should be used instead of else if.
647
646
<table>
648
647
<tr>
649
-
<th>Valid: Correct spacing.</th>
650
-
<th>Invalid: Whitespace used inside the parentheses.</th>
648
+
<th>Valid: Single word elseif keyword used.</th>
649
+
<th>Invalid: Separate else and if keywords used.</th>
651
650
</tr>
652
651
<tr>
653
652
<td>
654
653
655
654
if ($foo) {
656
655
$var = 1;
656
+
} elseif ($bar) {
657
+
$var = 2;
657
658
}
658
659
659
660
</td>
660
661
<td>
661
662
662
-
if ($foo) {
663
+
if ($foo) {
663
664
$var = 1;
665
+
} else if ($bar) {
666
+
$var = 2;
664
667
}
665
668
666
669
</td>
667
670
</tr>
668
671
</table>
669
672
670
-
## End File Newline
671
-
PHP Files should end with exactly one newline.
672
-
673
673
## Method Name
674
674
Method names MUST be declared in camelCase.
675
675
<table>
@@ -2101,6 +2101,31 @@ All array values must be followed by a comma, including the final value.
2101
2101
</tr>
2102
2102
</table>
2103
2103
2104
+
## Lowercase Class Keywords
2105
+
The php keywords class, interface, trait, extends, implements, abstract, final, var, and const should be lowercase.
2106
+
<table>
2107
+
<tr>
2108
+
<th>Valid: Lowercase class keywords.</th>
2109
+
<th>Invalid: Initial capitalization of class keywords.</th>
2110
+
</tr>
2111
+
<tr>
2112
+
<td>
2113
+
2114
+
final class Foo extends Bar
2115
+
{
2116
+
}
2117
+
2118
+
</td>
2119
+
<td>
2120
+
2121
+
Final Class Foo Extends Bar
2122
+
{
2123
+
}
2124
+
2125
+
</td>
2126
+
</tr>
2127
+
</table>
2128
+
2104
2129
## Self Member Reference
2105
2130
The self keyword should be used instead of the current class name, should be lowercase, and should not have spaces before or after it.
2106
2131
<table>
@@ -2178,31 +2203,6 @@ The self keyword should be used instead of the current class name, should be low
2178
2203
</tr>
2179
2204
</table>
2180
2205
2181
-
## Lowercase Class Keywords
2182
-
The php keywords class, interface, trait, extends, implements, abstract, final, var, and const should be lowercase.
2183
-
<table>
2184
-
<tr>
2185
-
<th>Valid: Lowercase class keywords.</th>
2186
-
<th>Invalid: Initial capitalization of class keywords.</th>
2187
-
</tr>
2188
-
<tr>
2189
-
<td>
2190
-
2191
-
final class Foo extends Bar
2192
-
{
2193
-
}
2194
-
2195
-
</td>
2196
-
<td>
2197
-
2198
-
Final Class Foo Extends Bar
2199
-
{
2200
-
}
2201
-
2202
-
</td>
2203
-
</tr>
2204
-
</table>
2205
-
2206
2206
## Doc Comment Alignment
2207
2207
The asterisks in a doc comment should align, and there should be one space between the asterisk and tags.
2208
2208
<table>
@@ -2391,4 +2391,4 @@ Semicolons should not have spaces before them.
2391
2391
</td>
2392
2392
</tr>
2393
2393
</table>
2394
-
Documentation generated on Sat May 16 17:15:02 2020 +0200 by [PHP_CodeSniffer 3.5.5](https://github.com/squizlabs/PHP_CodeSniffer)
2394
+
Documentation generated on Fri, 17 Jul 2020 21:19:25 +0000 by [PHP_CodeSniffer 3.5.6](https://github.com/squizlabs/PHP_CodeSniffer)
0 commit comments