1 | <?php |
||
8 | class Complex implements ValueObjectInterface, NumberInterface |
||
9 | { |
||
10 | /** @var Real */ |
||
11 | protected $real; |
||
12 | |||
13 | /** @var Real */ |
||
14 | protected $im; |
||
15 | |||
16 | /** |
||
17 | * Returns a new Complex object from native PHP arguments |
||
18 | * |
||
19 | * @param float $real Real part of the complex number |
||
|
|||
20 | * @param float $im Imaginary part of the complex number |
||
21 | * @return Complex|ValueObjectInterface |
||
22 | * @throws \BadMethodCallException |
||
23 | */ |
||
24 | 2 | public static function fromNative() |
|
38 | |||
39 | /** |
||
40 | * Returns a Complex given polar coordinates |
||
41 | * |
||
42 | * @param Real $modulus |
||
43 | * @param Real $argument |
||
44 | * @return Complex |
||
45 | */ |
||
46 | 1 | public static function fromPolar(Real $modulus, Real $argument) |
|
56 | |||
57 | /** |
||
58 | * Returns a Complex object give its real and imaginary parts as parameters |
||
59 | * |
||
60 | * @param Real $real |
||
61 | * @param Real $im |
||
62 | */ |
||
63 | 10 | public function __construct(Real $real, Real $im) |
|
68 | |||
69 | 2 | public function sameValueAs(ValueObjectInterface $complex) |
|
78 | |||
79 | /** |
||
80 | * Returns the native value of the real and imaginary parts as an array |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | 1 | public function toNative() |
|
91 | |||
92 | /** |
||
93 | * Returns the real part of the complex number |
||
94 | * |
||
95 | * @return Real |
||
96 | */ |
||
97 | 7 | public function getReal() |
|
101 | |||
102 | /** |
||
103 | * Returns the imaginary part of the complex number |
||
104 | * |
||
105 | * @return Real |
||
106 | */ |
||
107 | 7 | public function getIm() |
|
111 | |||
112 | /** |
||
113 | * Returns the modulus (or absolute value or magnitude) of the Complex number |
||
114 | * |
||
115 | * @return Real |
||
116 | */ |
||
117 | 2 | public function getModulus() |
|
125 | |||
126 | /** |
||
127 | * Returns the argument (or phase) of the Complex number |
||
128 | * |
||
129 | * @return Real |
||
130 | */ |
||
131 | 2 | public function getArgument() |
|
139 | |||
140 | /** |
||
141 | * Returns a native string version of the Complex object in format "${real} +|- ${complex}i" |
||
142 | * |
||
143 | * @return string |
||
144 | */ |
||
145 | 1 | public function __toString() |
|
154 | } |
||
155 |
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.