From 3b7b457d35657911d551ef69639e4a9db111501c Mon Sep 17 00:00:00 2001 From: Adam Prager Date: Thu, 4 Apr 2013 20:07:21 +0200 Subject: [PATCH] minor fixes --- lib/Doctrine/ORM/Tools/EntityGenerator.php | 6 +++--- tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index 948a4e689..1c55eb1bc 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -759,12 +759,12 @@ public function __construct() */ protected function getTraits(ClassMetadataInfo $metadata) { - if ($metadata->reflClass != null || class_exists($metadata->name)) { - $reflClass = $metadata->reflClass == null + if ($metadata->reflClass !== null || class_exists($metadata->name)) { + $reflClass = $metadata->reflClass === null ? new \ReflectionClass($metadata->name) : $metadata->reflClass; - if (method_exists($reflClass, 'getTraits')) { + if (PHP_VERSION_ID >= 50400) { return $reflClass->getTraits(); } } diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php index 694918d13..cd6430a2a 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php @@ -458,7 +458,7 @@ class EntityGeneratorTest extends \Doctrine\Tests\OrmTestCase */ public function testTraitPropertiesAndMethodsAreNotDuplicated() { - if (function_exists('trait_exists')) { + if (PHP_VERSION_ID >= 50400) { $cmf = new ClassMetadataFactory(); $em = $this->_getTestEntityManager(); $cmf->setEntityManager($em);