1 | <?php |
||
32 | class FeatureContext implements Context |
||
33 | { |
||
34 | protected $engine; |
||
35 | |||
36 | /** @var Customer */ |
||
37 | protected $customer; |
||
38 | /** |
||
39 | * @var \hiqdev\php\billing\price\PriceInterface|\hiqdev\php\billing\charge\FormulaChargeModifierTrait |
||
40 | * |
||
41 | * TODO: FormulaChargeModifierTrait::setFormula() must be moved to interface |
||
42 | */ |
||
43 | protected $price; |
||
44 | /** |
||
45 | * @var \hiqdev\php\billing\action\ActionInterface|\hiqdev\php\billing\action\AbstractAction |
||
46 | */ |
||
47 | protected $action; |
||
48 | /** |
||
49 | * @var ChargeInterface[] |
||
50 | */ |
||
51 | protected $charges; |
||
52 | |||
53 | /** @var \Money\MoneyParser */ |
||
54 | protected $moneyParser; |
||
55 | |||
56 | // Variable is not used. TODO: Remove? |
||
57 | // protected $date; |
||
58 | |||
59 | /** |
||
60 | * Initializes context. |
||
61 | */ |
||
62 | public function __construct() |
||
67 | |||
68 | /** |
||
69 | * @Given /(\S+) (\S+) price is ([0-9.]+) (\w+) per (\w+)/ |
||
70 | */ |
||
71 | public function priceIs($target, $type, $sum, $currency, $unit) |
||
79 | |||
80 | /** |
||
81 | * @Given /action is (\S+) (\w+) ([0-9.]+) (\S+)/ |
||
82 | */ |
||
83 | public function actionIs($target, $type, $amount, $unit) |
||
91 | |||
92 | /** |
||
93 | * @Given /formula is (.+)/ |
||
94 | */ |
||
95 | public function formulaIs($formula) |
||
99 | |||
100 | protected function getFormulaEngine() |
||
108 | |||
109 | /** |
||
110 | * @When /action date is ([0-9.-]+)/ |
||
111 | */ |
||
112 | public function actionDateIs($date) |
||
116 | |||
117 | /** |
||
118 | * @Then /^(\w+) charge is $/ |
||
119 | */ |
||
120 | public function emptyCharge($numeral) |
||
124 | |||
125 | /** |
||
126 | * @Then /^(\w+) charge is (\S+) ([0-9.]+) ([A-Z]{3})$/ |
||
127 | */ |
||
128 | public function chargeWithSum($numeral, $type = null, $sum = null, $currency = null) |
||
132 | |||
133 | /** |
||
134 | * @Then /^(\w+) charge is (\S+) ([0-9.]+) ([A-Z]{3}) reason (.+)/ |
||
135 | */ |
||
136 | public function chargeWithReason($numeral, $type = null, $sum = null, $currency = null, $reason = null) |
||
140 | |||
141 | public function chargeIs($numeral, $type = null, $sum = null, $currency = null, $reason = null) |
||
149 | |||
150 | /** |
||
151 | * @param ChargeInterface|null $charge |
||
152 | * @param string|null $type |
||
153 | * @param string|null $sum |
||
154 | * @param string|null $currency |
||
155 | * @param string|null $reason |
||
156 | */ |
||
157 | public function assertCharge($charge, $type, $sum, $currency, $reason) |
||
171 | |||
172 | private function ensureNo(string $numeral): int |
||
182 | } |
||
183 |
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: