/
2.3.Lines.php
104 lines (61 loc) · 1.92 KB
/
2.3.Lines.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
declare(strict_types=1);
namespace LaminasCodingStandardTest\fixed;
class Lines
{
public function testLineLength(): void
{
// There MUST NOT be a hard limit on line length.
//
// The soft limit on line length MUST be 120 characters.
//
// Lines SHOULD NOT be longer than 80 characters; lines longer than
// that SHOULD be split into multiple subsequent lines of no more than
// 80 characters each.
}
public function testTrailingWhitespace(): void
{
// There MUST NOT be trailing whitespace at the end of lines.
//
// Blank lines MAY be added to improve readability and to indicate
// related blocks of code except where explicitly forbidden.
$foo = 'bar';
}
public function testDisallowMultipleStatements(): void
{
// There MUST NOT be more than one statement per line.
$foo = 'bar';
$bar = 'foo';
}
public function testThereMayBeMaximumOneBlankLine(): void
{
// There MAY be maximum one blank line to improve readability and to
// indicate related blocks of code except where explicitly forbidden.
$x = 1;
$y = 1;
}
public function testThereMayNotBeAnyBlankLineFfterOpeningBracesAndBeforeClosingBrace(): void
{
// There MAY NOT be any blank line after opening braces and before
// closing braces.
$noBlankLine = function () use ($noBlankLine): void {
$noBlankLine = 1;
};
$closure = function (): void {
$noBlankLine = 1;
};
if ($x) {
while (true) {
foreach ($arr as $elem) {
do {
$stop = 1;
} while (true);
}
}
}
switch (true) {
case 1:
break;
}
}
}