-
-
Notifications
You must be signed in to change notification settings - Fork 138
Expand file tree
/
Copy pathclass.php
More file actions
372 lines (264 loc) · 10.9 KB
/
class.php
File metadata and controls
372 lines (264 loc) · 10.9 KB
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
<?php
class Foo extends Bar implements Baz, Buzz {
public $test;
function test() {
return "test";
}
public function &passByReferenceTest() {
$a = 1;
return $a;
}
}
$test = new Foo();
abstract class ReallyReallyReallyLongClassName extends AbstractModelFactoryResourceController implements TooMuchObjectOrientation, ThisIsMadness {
// variable doc
public $test;
public $other = 1;
public static $staticTest = ['hi'];
public readonly int $readonlytype;
static $cache;
protected static $_instance;
protected $fillable = ['title', 'requester_id', 'type', 'summary', 'proof'];
protected $fillable2 = ['title', 'description', 'requester_id', 'type', 'summary', 'proof'];
protected $test = [
//test
];
/**
* test constructor
*
* @param \Test\Foo\Bar $test hi
* @param int $test_int test
* @param string $test_string test
*
* @return \Some\Test
*/
public function __construct($test, $test_int = null, $test_string = 'hi', readonly int $test_readonly, public readonly string $test_promoted_readonly) {
parent::__construct($test_int ?: 1);
$this->other = $test_string;
$this->current_version = $current_version ?: new Content_Version_Model();
self::$staticTest = $test_int;
}
public static function test_static_constructor($test, $test_int, $test_string) {
$model = new self($test, $test_int, $test_string);
$model = new self($really_really_really_really_really_really_really_really_long_array, $test_int, $test_string);
return $model;
}
public function test_pass_by_reference(&$test)
{
$test + 1;
}
/**
* This is a function
*/
private function hi($input) {
$test = 1;
//testing line spacing
$other_test = 2;
$one_more_test = 3;
return $input . $this->test;
}
public function reallyReallyReallyReallyReallyReallyReallyLongMethodName($input, $otherInput = 1) {
return true;
}
// doc test
public static function testStaticFunction($input) {
return self::$staticTest[0];
}
public function returnTypeTest() : string
{
return 'hi';
}
final public static function bar()
{
// Nothing
}
abstract protected function zim();
public function method(iterable $iterable): array {
// Parameter broadened and return type narrowed.
}
public function method1() { return 'hi'; }
public function method2() {
return 'hi'; }
public function method3()
{ return 'hi'; }
public function testReturn(?string $name): ?string
{
return $name;
}
public function swap(&$left, &$right): void
{
if ($left === $right) {
return;
}
$tmp = $left;
$left = $right;
$right = $tmp;
}
public function test(object $obj): object
{
return new SplQueue();
}
public function longLongAnotherFunction(
string $foo,
string $bar,
int $baz
): string {
return 'foo';
}
public function longLongAnotherFunctionOther(
string $foo,
string $bar,
int $baz
) {
return 'foo';
}
public function testReturnTypeDeclaration() : object
{
return new SplQueue();
}
public function testReturnTypeDeclarationOther()
:
object
{
return new SplQueue();
}
}
$this->something->method($argument, $this->more->stuff($this->even->more->things->complicatedMethod()));
class A {}
$someVar = new ReaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalyLongClassName();
class ClassName
extends ParentClass
implements \ArrayAccess, \Countable
{
// constants, properties, methods
}
class FooBar { public $property; public $property2; public function method() {} public function method2() {} }
class FooBarFoo
{
public function fooBarBaz ( $x,$y ,$z, $foo , $bar ) { /* Comment */ }
}
class ClassName extends ParentClass implements InterfaceClass {}
class ClassName extends ParentClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {}
class ClassName extends ParentClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {}
class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements InterfaceClass {}
class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements InterfaceClass {}
class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {}
class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {}
class ClassName extends ParentClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1,VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 {}
class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1,VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 {}
class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1,VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 {}
class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 extends ParentClass implements InterfaceClass {}
class Custom_Plugin_NotificationPlaceholderSource extends Notification_Manager_DefaultPlaceholderSource {}
class field extends \models\base
{
protected function pre_save( $input, $fields ) {
$input['configs'] = json_encode( array_merge( $configs, $field_type->process_field_config_from_user( $input['definition'] ) ) );
unset( $input['definition'] );
}
}
class test {
public function test_method() {
$customer = (object) [ 'name' => 'Bob' ];
$job = (object) [ 'customer' => $customer ];
return "The customer for that job, {$job->customer->name} has an error that shows up after the line gets waaaaay toooo long.";
}
}
class EmptyClass {}
class EmptyClassWithComments { /* Comment */ }
class MyClass implements MyOtherClass {}
class MyClass implements MyOtherClass, MyOtherClass1, MyOtherClass2 {}
class MyClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}
class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyOtherClass {}
class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyOtherClass {}
class MyClass implements MyOtherClass, MyOtherClass, MyOtherOtherOtherClass, MyOtherOtherOtherOtherClass {}
class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyOtherClass, MyOtherClass, MyOtherOtherOtherClass, MyOtherOtherOtherOtherClass {}
class EmptyClass extends MyOtherClass {}
class EmptyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}
class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass extends EmptyClass {}
class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}
class MyClass extends MyOtherClass implements MyI {}
class MyClass extends MyOtherClass implements MyI, MyII, MyIII {}
class MyClass extends MyOtherClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}
class MyClass extends MyOtherClass implements MyInterface, MyOtherInterface, MyOtherOtherInterface {}
class MyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI {}
class MyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI, MyII, MyIII {}
class MyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}
class MyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI, MyII, MyIII {}
final class BaseClass {}
abstract class BaseClass {}
final readonly class BaseClass {}
readonly final class BaseClass {}
final class BaseClass extends MyOtherClass {}
abstract class BaseClass extends MyOtherClass {}
final readonly class BaseClass extends MyOtherClass {}
readonly final class BaseClass extends MyOtherClass {}
final class BaseClass extends MyOtherVeryVeryVeryVeVeryVeryVeryVeryVeryLongClass {}
abstract class BaseClass extends MyOtherVeryVeryVeryVeVeryVeryVeryVVeryLongClass {}
final class BaseClass extends MyOtherVeryVeryVeryVeVeryVeryVeryVeryVeryLongClass1 {}
abstract class BaseClass extends MyOtherVeryVeryVeryVeVeryVeryVeryVVeryLongClass1 {}
final class BaseClass extends MyOtherClass implements MyInterface, MyOtherInterface, MyOtherOtherInterface {}
abstract class BaseClass extends MyOtherClass implements MyInterface, MyOtherInterface, MyOtherOtherInterface {}
class User {
public int $id;
public string $name;
public ?string $b = 'foo';
private Foo $prop;
protected static string $static = 'default';
public function __construct(int $id, string $name) {
$this->id = $id;
$this->name = $name;
}
}
class Promoted {
public function __construct( public int $a, private float $b, protected string $d ){
}
}
readonly class ReadOnlyCls {
public string $myValue;
}
class FinalCost { final public const FOO = 'foo'; }
// PHP 8.3 typed class constants
enum E {
const string TEST = "Test1"; // E::TEST is a string
}
trait T {
const string TEST = E::TEST; // T::TEST is a string too
}
interface I {
const string TEST = E::TEST; // I::TEST is a string as well
}
class Foo implements I {
use T;
const string TEST = E::TEST; // Foo::TEST must also be a string
}
class Bar extends Foo {
const string TEST = "Test2"; // Bar::TEST must also be a string, but the value can change
public const int|null I = null;
public const ?int J = null;
}
class B
{
public string $bar {
get {
return $this->bar;
}
}
public string $bar2 {
get => $this->bar2;
}
public string $foo {
set => $this->foo = $value;
}
public string $foo2 {
set(string $value2) {
{
$this->bar = $value2;
$this->foo2 = 'something';
}
}
}
}
interface ABC {
public string $foo { get; }
public string $bar { set; }
}