Skip to content

Commit e13e5eb

Browse files
committed
Merge pull request #63 from marcellovetro/master
Bug FIX for functions that have a brace as default on parameters ...
2 parents 2b80b50 + 166050d commit e13e5eb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/AspectMock/Intercept/BeforeMockTransformer.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ public function transform(StreamMetaData $metadata)
9494
$pos = strpos($dataArray[$i], '{');
9595
if ($pos === false) {
9696
continue;
97+
} else {
98+
// Bug FIX for functions that have the curly bracket as default on their own parameters:
99+
// Launch a "continue" command if the bracket found have a quote (') or a double quote (")
100+
// exactly just before or after
101+
if (in_array(substr($dataArray[$i], $pos - 1, 1), ['"', "'"]) ||
102+
in_array(substr($dataArray[$i], $pos + 1, 1), ['"', "'"])
103+
) {
104+
continue;
105+
}
97106
}
98107
$dataArray[$i] = substr($dataArray[$i], 0, $pos + 1) . $beforeDefinition . substr($dataArray[$i], $pos + 1);
99108
break;

0 commit comments

Comments
 (0)