From 243210e89607db860c5bc204e8c7eb2b5caeb868 Mon Sep 17 00:00:00 2001 From: Andrea Sprega Date: Thu, 15 Jan 2015 02:31:18 +0000 Subject: [PATCH] DDC-3493 - fixed EntityGenerator parsing for php 5.5 "::class" syntax --- lib/Doctrine/ORM/Tools/EntityGenerator.php | 2 +- tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index c34336ebb3e..c4bdf3aa7f8 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -827,7 +827,7 @@ protected function parseTokensInEntityFile($src) if ($token[0] == T_NAMESPACE) { $lastSeenNamespace = ""; $inNamespace = true; - } elseif ($token[0] == T_CLASS) { + } elseif ($token[0] == T_CLASS && $tokens[$i-1][0] != T_DOUBLE_COLON) { $inClass = true; } elseif ($token[0] == T_FUNCTION) { if ($tokens[$i+2][0] == T_STRING) { diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php index 79e583d4d45..1bfd516150d 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php @@ -1035,6 +1035,16 @@ class ', array('Foo\Bar\Baz'), ), + array( + ' +