forked from PHP-CS-Fixer/PHP-CS-Fixer
/
@PSR12.test-out.php
155 lines (128 loc) · 2.99 KB
/
@PSR12.test-out.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
declare(strict_types=1);
namespace Vendor\Package;
use Vendor\Package\SomeNamespace\ClassD as D;
use Vendor\Package\{ClassA as A, ClassB, ClassC as C};
use function Vendor\Package\{functionA, functionB, functionC};
use const Vendor\Package\{ConstantA, ConstantB, ConstantC};
class Foo extends Bar implements FooInterface
{
public function sampleFunction(int $a, int $b = null): array
{
if ($someLine === 'Longer Than 120 characters' && $respected->getVersion() === 'PSR12' && $respected->lineLengthRecommendeations() === false) {
bar();
}
$moreThan = 1;
$statement = 'per line';
if ($a === $b) {
bar();
} elseif ($a > $b) {
$foo->bar($arg1);
} else {
BazClass::bar($arg2, $arg3);
}
}
final public static function bar()
{
// method body
}
public const LOWER_CONSTANTS = 1;
abstract public static function lowercaseReservedKeywords(callable $a)
{
global $test;
return print clone array() and new stdClass() or $g instanceof stdClass xor 4;
list($test) = eval('');
unset($test);
true and false;
(string) 1;
(bool) 1;
(int) 1;
echo function () use ($array) {
};
for ($i = 1; $i++; $i > 100) {
while (0) {
switch ($test) {
case 1:
break;
}
}
}
}
}
class Foo extends SomeRediculouslySuperfluouslyLongClassNameThatShouldNeverExistInTheRealWorldMeantToTestOverflow implements SomeInterface, SomeOtherInterface, YetAnotherInterface
{
use SomeTrait, SomeOtherTrait;
use A, B, C {
B::smallTalk insteadof A;
A::bigTalk insteadof C;
C::mediumTalk as FooBar;
}
public function someBody()
{
}
public const SomeConst = 1;
protected $doo = 4;
private $derp;
protected $doo;
public $derpity;
public $noVisibility;
public static $staticNoVisibility;
}
class Foo
{
use SomeTrait;
}
class Foo extends ExtendedClass implements
SomeInterface,
SomeOtherInterface,
YetAnotherInterface
{
public function someMethod()
{
}
public function fooBarBaz($arg1, &$arg2, $arg3 = [])
{
// method body
}
public function lottaArguments(
$arg1,
$arg2,
$arg3
) {
}
final public function finalMethod()
{
}
public static function staticMethod()
{
}
final public static function staticMethod()
{
}
abstract public function abstractMethod();
}
declare(ticks=1) {
echo 1;
}
function fooBarBaz($arg1, &$arg2, $arg3 = [])
{
// function body
}
function lottaArguments(
$arg1,
&$arg2,
$arg3 = []
): ?string {
// function body
}
factoryFunction($arg1, $arg2)->method($arg1, $arg2);
factoryFunction(
$arg1,
$arg2,
$arg3
);
factoryFunction($arg1, $arg2, [
1,
2,
3
], $arg4);