1 | <?php |
||
10 | class Calculator |
||
11 | { |
||
12 | /** |
||
13 | * @var Model[]|CalculableModelInterface[] |
||
14 | */ |
||
15 | protected $models; |
||
16 | |||
17 | /** |
||
18 | * @var Calculation[] |
||
19 | */ |
||
20 | protected $calculations; |
||
21 | |||
22 | /** |
||
23 | * TariffCalculator constructor. |
||
24 | * @param Model[] $models |
||
25 | */ |
||
26 | public function __construct($models) |
||
30 | |||
31 | /** |
||
32 | * Gets [[Calculation]] for the $id |
||
33 | * |
||
34 | * @param integer $id |
||
35 | * @return Calculation |
||
36 | */ |
||
37 | public function getCalculation($id) |
||
45 | |||
46 | /** |
||
47 | * @return Calculation[] |
||
48 | */ |
||
49 | public function getCalculations() |
||
57 | |||
58 | /** |
||
59 | * @return \hipanel\modules\finance\models\Calculation[] |
||
60 | * @throws UnprocessableEntityHttpException |
||
61 | */ |
||
62 | public function execute() |
||
80 | |||
81 | /** |
||
82 | * @return array |
||
83 | */ |
||
84 | protected function collectData() |
||
94 | |||
95 | /** |
||
96 | * @param $rows |
||
97 | * @return \hipanel\modules\finance\models\Calculation[] |
||
98 | */ |
||
99 | private function createCalculations($rows) |
||
106 | } |
||
107 |
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: