1
0
Fork 0

fixed class map generator when using a heredoc with spaces

pull/2945/head
Fabien Potencier 2014-04-28 15:19:38 +02:00
parent 0f9bda3e37
commit 12421dd6b7
2 changed files with 21 additions and 3 deletions

View File

@ -119,7 +119,7 @@ class ClassMapGenerator
} }
// strip heredocs/nowdocs // 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 // strip strings
$contents = preg_replace('{"[^"\\\\]*(\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(\\\\.[^\'\\\\]*)*\'}s', 'null', $contents); $contents = preg_replace('{"[^"\\\\]*(\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(\\\\.[^\'\\\\]*)*\'}s', 'null', $contents);
// strip leading non-php code if needed // strip leading non-php code if needed

View File

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