1 | <?php |
||
7 | class VectorUtils |
||
8 | { |
||
9 | /** |
||
10 | * Adds the two given vectors to each other. |
||
11 | * |
||
12 | * @param Vector $lft The left vector. |
||
13 | * @param Vector $rgt The right vector. |
||
14 | * @return Vector |
||
15 | * @throws InvalidArgumentException Thrown when the given vector is of a different length. |
||
16 | */ |
||
17 | 2 | public static function add(Vector $lft, Vector $rgt) |
|
31 | |||
32 | /** |
||
33 | * Calculates the angle between the two given vectors. |
||
34 | * |
||
35 | * @param Vector $lft The left vector. |
||
36 | * @param Vector $rgt The right vector. |
||
37 | * @return float Returns the angle in radians. |
||
38 | */ |
||
39 | 1 | public static function angleBetween(Vector $lft, Vector $rgt) |
|
43 | |||
44 | /** |
||
45 | * Subtracts the two given vectors from each other. |
||
46 | * |
||
47 | * @param Vector $lft The left vector. |
||
48 | * @param Vector $rgt The right vector. |
||
49 | * @return Vector |
||
50 | * @throws InvalidArgumentException Thrown when the given vector is of a different length. |
||
51 | */ |
||
52 | 2 | public static function subtract(Vector $lft, Vector $rgt) |
|
66 | } |
||
67 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: