1 | <?php |
||
25 | class ObjectType extends AbstractType |
||
26 | { |
||
27 | /** |
||
28 | * The name of the class this must be an instance of |
||
29 | * |
||
30 | * @readable |
||
31 | * @var ClassName |
||
32 | */ |
||
33 | protected $classname; |
||
34 | |||
35 | /** |
||
36 | * Generic types for this object |
||
37 | * |
||
38 | * @readable |
||
39 | * @var ArrayList |
||
40 | */ |
||
41 | protected $generics; |
||
42 | |||
43 | /** |
||
44 | * Creates this ObjectType with the given classname |
||
45 | * |
||
46 | * @param mixed $class The name of the class this must be an |
||
|
|||
47 | * instance of |
||
48 | */ |
||
49 | 37 | public function __construct($classname) |
|
56 | |||
57 | /** |
||
58 | * {@inheritDoc} |
||
59 | */ |
||
60 | 2 | public function equals($type) : bool |
|
61 | { |
||
62 | if |
||
63 | ( |
||
64 | 2 | $type instanceof ObjectType && |
|
65 | 2 | $type->classname->equals($this->classname) && |
|
66 | 2 | $type->generics->size() === $this->generics->size() |
|
67 | ) |
||
68 | { |
||
69 | 2 | foreach ($type->generics as $i => $generic) |
|
70 | { |
||
71 | 2 | if (!$this->generics[$i]->equals($generic)) |
|
72 | { |
||
73 | return false; |
||
74 | } |
||
75 | } |
||
76 | |||
77 | 2 | return true; |
|
78 | } |
||
79 | |||
80 | 1 | return false; |
|
81 | } |
||
82 | |||
83 | 1 | public function __toString() : string |
|
87 | } |
||
88 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.