From 601da456bae530817fb5bebf9eeaa8432108033d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 19 Mar 2013 09:32:24 +0100 Subject: [PATCH] [ClassLoader] fixed heredocs handling The end of an hereodc must have a newline to avoid PHP syntax errors. --- .../Component/ClassLoader/ClassCollectionLoader.php | 1 + .../ClassLoader/Tests/ClassCollectionLoaderTest.php | 8 +++++--- .../Tests/Fixtures/Namespaced/WithComments.php | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php index a0664c64bc55..6a0ea6b8f851 100644 --- a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -178,6 +178,7 @@ public static function fixNamespaceDeclarations($source) $token = next($tokens); $output .= is_string($token) ? $token : $token[1]; } while ($token[0] !== T_END_HEREDOC); + $output .= "\n"; $rawChunk = ''; } elseif (T_CONSTANT_ENCAPSED_STRING === $token[0]) { $output .= self::compressCode($rawChunk).$token[1]; diff --git a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php index 28f7dcb6c6ac..dfa51e37fed1 100644 --- a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php +++ b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php @@ -228,20 +228,22 @@ class WithComments public static \$loaded = true; } \$string ='string shoult not be modified {\$string}'; -\$heredoc =<<