1 | <?php |
||
11 | class TariffCalculator |
||
12 | { |
||
13 | /** |
||
14 | * @var Model[]|CalculableModelInterface[] |
||
15 | */ |
||
16 | private $tariffs; |
||
17 | |||
18 | /** |
||
19 | * @var Calculation[] |
||
20 | */ |
||
21 | private $calculations; |
||
22 | |||
23 | /** |
||
24 | * TariffCalculator constructor. |
||
25 | * @param Model[]|Model $tariffs |
||
26 | */ |
||
27 | public function __construct($tariffs) |
||
35 | |||
36 | /** |
||
37 | * Gets [[Calculation]] for the $tariffId |
||
38 | * |
||
39 | * @param integer $tariffId |
||
40 | * @return Calculation |
||
41 | */ |
||
42 | public function getCalculation($tariffId) |
||
50 | |||
51 | /** |
||
52 | * @return Calculation[] |
||
53 | */ |
||
54 | public function getCalculations() |
||
62 | |||
63 | /** |
||
64 | * @return \hipanel\modules\finance\models\Calculation[] |
||
65 | * @throws UnprocessableEntityHttpException |
||
66 | */ |
||
67 | public function execute() |
||
79 | |||
80 | /** |
||
81 | * @return array |
||
82 | */ |
||
83 | private function collectData() |
||
92 | |||
93 | /** |
||
94 | * @param $rows |
||
95 | * @return \hipanel\modules\finance\models\Calculation[] |
||
96 | */ |
||
97 | private function createCalculations($rows) |
||
102 | } |
||
103 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: