-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathCustomMethod.php
More file actions
78 lines (64 loc) · 1.45 KB
/
CustomMethod.php
File metadata and controls
78 lines (64 loc) · 1.45 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
<?php declare(strict_types = 1);
namespace Weebly\PHPStan\Laravel;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
use PHPStan\Type\UnionType;
class CustomMethod implements MethodReflection
{
protected $class;
protected $name;
protected $returnType;
public function __construct(
ClassReflection $class,
string $name,
$returnType
) {
$this->class = $class;
$this->name = $name;
$this->returnType = $returnType;
}
public function getDeclaringClass(): ClassReflection
{
return $this->class;
}
public function getPrototype(): MethodReflection
{
return $this;
}
public function isStatic(): bool
{
return true;
}
public function isPrivate(): bool
{
return false;
}
public function isPublic(): bool
{
return true;
}
public function getName(): string
{
return $this->name;
}
/**
* @return \PHPStan\Reflection\ParameterReflection[]
*/
public function getParameters(): array
{
return [];
}
public function isVariadic(): bool
{
return true;
}
public function getReturnType(): Type
{
if (is_array($this->returnType)) {
return new UnionType($this->returnType);
}
return new ObjectType($this->returnType);
}
}