@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | elseif (preg_match(self::$regEx['array'], $variable)) { |
113 | 113 | try { |
114 | 114 | $values[] = $this->getValueFromArray($variable); |
115 | - } catch(RuntimeException $e) { |
|
115 | + } catch (RuntimeException $e) { |
|
116 | 116 | if ($this->throwException) throw new GherkinParamException(); |
117 | 117 | if ($this->nullable) $values[] = null; |
118 | 118 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | else { |
122 | 122 | try { |
123 | 123 | $values[] = Fixtures::get($variable); |
124 | - } catch(RuntimeException $e) { |
|
124 | + } catch (RuntimeException $e) { |
|
125 | 125 | if ($this->throwException) throw new GherkinParamException(); |
126 | 126 | if ($this->nullable) $values[] = null; |
127 | 127 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | // due to the default behavior when `search` and `replace` arrays size mismatch |
137 | 137 | $param = $this->mapParametersToValues($matches, $values, $param); |
138 | 138 | |
139 | - } catch(GherkinParamException $e) { |
|
139 | + } catch (GherkinParamException $e) { |
|
140 | 140 | // only active if throwException setting is true |
141 | 141 | throw new ExtensionException( |
142 | 142 | $this, |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | final private function mapParametersToValues(array $matches, array $values, string $param) |
163 | 163 | { |
164 | 164 | $len = count($matches); |
165 | - for ($i=0; $i<$len; $i++) { |
|
165 | + for ($i = 0; $i < $len; $i++) { |
|
166 | 166 | $search = $matches[$i]; |
167 | 167 | if (isset($values[$i])) { |
168 | 168 | $replacement = $values[$i]; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $prop = new ReflectionProperty(get_class($arg), 'table'); |
271 | 271 | $prop->setAccessible(true); |
272 | 272 | $table = $prop->getValue($arg); |
273 | - foreach($table as $i => $row) { |
|
273 | + foreach ($table as $i => $row) { |
|
274 | 274 | foreach ($row as $j => $cell) { |
275 | 275 | $val = $this->getValueFromParam($cell); |
276 | 276 | $table[$i][$j] = $val ? $val : null; // issue TableNode does not support `null` values in table |
@@ -113,8 +113,12 @@ discard block |
||
113 | 113 | try { |
114 | 114 | $values[] = $this->getValueFromArray($variable); |
115 | 115 | } catch(RuntimeException $e) { |
116 | - if ($this->throwException) throw new GherkinParamException(); |
|
117 | - if ($this->nullable) $values[] = null; |
|
116 | + if ($this->throwException) { |
|
117 | + throw new GherkinParamException(); |
|
118 | + } |
|
119 | + if ($this->nullable) { |
|
120 | + $values[] = null; |
|
121 | + } |
|
118 | 122 | } |
119 | 123 | } |
120 | 124 | // normal case |
@@ -122,13 +126,19 @@ discard block |
||
122 | 126 | try { |
123 | 127 | $values[] = Fixtures::get($variable); |
124 | 128 | } catch(RuntimeException $e) { |
125 | - if ($this->throwException) throw new GherkinParamException(); |
|
126 | - if ($this->nullable) $values[] = null; |
|
129 | + if ($this->throwException) { |
|
130 | + throw new GherkinParamException(); |
|
131 | + } |
|
132 | + if ($this->nullable) { |
|
133 | + $values[] = null; |
|
134 | + } |
|
127 | 135 | } |
128 | 136 | } |
129 | 137 | // if machting value return is not found (null) |
130 | 138 | if (is_null(end($values))) { |
131 | - if ($this->throwException) throw new GherkinParamException(); |
|
139 | + if ($this->throwException) { |
|
140 | + throw new GherkinParamException(); |
|
141 | + } |
|
132 | 142 | } |
133 | 143 | } |
134 | 144 | |
@@ -168,15 +178,23 @@ discard block |
||
168 | 178 | $replacement = $values[$i]; |
169 | 179 | if (is_array($replacement)) { |
170 | 180 | // case of replacement is an array (case of config param), ie param does not exists |
171 | - if ($this->throwException) throw new GherkinParamException(); |
|
172 | - if ($this->nullable) $param = null; |
|
181 | + if ($this->throwException) { |
|
182 | + throw new GherkinParamException(); |
|
183 | + } |
|
184 | + if ($this->nullable) { |
|
185 | + $param = null; |
|
186 | + } |
|
173 | 187 | break; |
174 | 188 | } |
175 | 189 | //TODO: replace str_replace by strtr (performance) |
176 | 190 | $param = str_replace($search, $replacement, $param); |
177 | 191 | } else { |
178 | - if ($this->throwException) throw new GherkinParamException(); |
|
179 | - if ($this->nullable) $param = null; |
|
192 | + if ($this->throwException) { |
|
193 | + throw new GherkinParamException(); |
|
194 | + } |
|
195 | + if ($this->nullable) { |
|
196 | + $param = null; |
|
197 | + } |
|
180 | 198 | } |
181 | 199 | } |
182 | 200 | return $param; |