-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathexample.php
70 lines (59 loc) · 1.12 KB
/
example.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
<?php
namespace Vendor\Package;
use FooInterface;
use BarClass as Bar;
use OtherVendor\OtherPackage\BazClass;
class Foo extends Bar implements FooInterface, BarInterface, FooBarInterface, \Countable, \ArrayAccess
{
public function sampleFunction($a, $b = null)
{
if ($a === $b) {
bar();
} elseif ($a > $b) {
$foo->bar($arg1);
} else {
BazClass::bar($arg2, $arg3);
}
}
final public static function bar()
{
// method body
}
public function aVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName(
ClassTypeHint $arg1, &$arg2, array $arg3 = []
)
{
// method body
for ($i = 0; $i < 10; $i++) {
}
do {
// structure body;
} while ($expr);
switch ($expr) {
case 0:
echo 'First case, with a break';
break;
case 1:
echo 'Second case, which falls through';
// no break
case 2:
case 3:
case 4:
echo 'Third case, return instead of break';
return;
default:
echo 'Default case';
break;
}
}
}
class A
{
public function bee(
SomeClassHint $object, $parameter1, $parameter2, $anotherParameter, $default = 'do_not_know'
)
{
$x = 0;
return $x;
}
}