@@ -112,8 +112,12 @@ discard block |
||
112 | 112 | try { |
113 | 113 | $values[] = $this->getValueFromArray($variable); |
114 | 114 | } catch(RuntimeException $e) { |
115 | - if ($this->throwException) throw new GherkinParamException(); |
|
116 | - if ($this->nullable) $values[] = null; |
|
115 | + if ($this->throwException) { |
|
116 | + throw new GherkinParamException(); |
|
117 | + } |
|
118 | + if ($this->nullable) { |
|
119 | + $values[] = null; |
|
120 | + } |
|
117 | 121 | } |
118 | 122 | } |
119 | 123 | // normal case |
@@ -121,13 +125,19 @@ discard block |
||
121 | 125 | try { |
122 | 126 | $values[] = Fixtures::get($variable); |
123 | 127 | } catch(RuntimeException $e) { |
124 | - if ($this->throwException) throw new GherkinParamException(); |
|
125 | - if ($this->nullable) $values[] = null; |
|
128 | + if ($this->throwException) { |
|
129 | + throw new GherkinParamException(); |
|
130 | + } |
|
131 | + if ($this->nullable) { |
|
132 | + $values[] = null; |
|
133 | + } |
|
126 | 134 | } |
127 | 135 | } |
128 | 136 | // if machting value return is not found (null) |
129 | 137 | if (is_null(end($values))) { |
130 | - if ($this->throwException) throw new GherkinParamException(); |
|
138 | + if ($this->throwException) { |
|
139 | + throw new GherkinParamException(); |
|
140 | + } |
|
131 | 141 | } |
132 | 142 | } |
133 | 143 | |
@@ -167,15 +177,23 @@ discard block |
||
167 | 177 | $replacement = $values[$i]; |
168 | 178 | if (\is_array($replacement)) { |
169 | 179 | // case of replacement is an array (case of config param), ie param does not exists |
170 | - if ($this->throwException) throw new GherkinParamException(); |
|
171 | - if ($this->nullable) $param = null; |
|
180 | + if ($this->throwException) { |
|
181 | + throw new GherkinParamException(); |
|
182 | + } |
|
183 | + if ($this->nullable) { |
|
184 | + $param = null; |
|
185 | + } |
|
172 | 186 | break; |
173 | 187 | } |
174 | 188 | //TODO: replace str_replace by strtr (performance) |
175 | 189 | $param = \str_replace($search, $replacement, $param); |
176 | 190 | } else { |
177 | - if ($this->throwException) throw new GherkinParamException(); |
|
178 | - if ($this->nullable) $param = null; |
|
191 | + if ($this->throwException) { |
|
192 | + throw new GherkinParamException(); |
|
193 | + } |
|
194 | + if ($this->nullable) { |
|
195 | + $param = null; |
|
196 | + } |
|
179 | 197 | } |
180 | 198 | } |
181 | 199 | return $param; |