1
0
Fork 0

Merge pull request #2945 from fabpot/classmap-hotfix

fixed class map generator when using a heredoc with spaces
pull/2948/head
Jordi Boggiano 2014-04-28 17:57:52 +02:00
commit 29c39cc266
2 changed files with 21 additions and 3 deletions

View File

@ -119,7 +119,7 @@ class ClassMapGenerator
}
// strip heredocs/nowdocs
$contents = preg_replace('{<<<\'?(\w+)\'?(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\1(?=\r\n|\n|\r|;)}s', 'null', $contents);
$contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents);
// strip strings
$contents = preg_replace('{"[^"\\\\]*(\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(\\\\.[^\'\\\\]*)*\'}s', 'null', $contents);
// strip leading non-php code if needed

View File

@ -15,12 +15,30 @@ class Fail2
}
A
. <<<'TEST'
. <<< AB
class Fail3
{
}
TEST;
AB
. <<<'TEST'
class Fail4
{
}
TEST
. <<< 'ANOTHER'
class Fail5
{
}
ANOTHER
. <<< 'ONEMORE'
class Fail6
{
}
ONEMORE;
}
public function test2()