Skip to content

Commit f4a7c7c

Browse files
committed
Merge pull request #113 from josealbea/2.0
Fix return_type_from_code.php (error with __DIR__)
2 parents 116fc3b + 01c91e9 commit f4a7c7c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/direct/return_type_from_code.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@
6161
exit;
6262
}
6363

64+
// If the code sample contains __DIR__, we want it to be located in mouf/ directory, not vendor/mouf/mouf/src/direct
65+
// directory. Hence, we change __DIR__ with the path we want.
66+
// FIXME: this will break if __DIR__ is in a string.
67+
68+
$fullCode = str_replace('__DIR__', var_export(dirname(dirname(dirname(dirname(dirname(__DIR__))))).'/mouf', true), $fullCode);
69+
6470
class CodeTester {
6571
public function getClosure() {
6672
global $fullCode;

0 commit comments

Comments
 (0)