From 541e7bdf72ef76ecf6c930fb8d7d6280ebbadf25 Mon Sep 17 00:00:00 2001 From: Marco Pivetta <ocramius@gmail.com> Date: Wed, 14 Jan 2015 20:13:46 +0100 Subject: [PATCH] Refactoring test method: no need to test for PHP version --- lib/Doctrine/ORM/Tools/EntityGenerator.php | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index 03285b2b8..c34336ebb 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -907,23 +907,23 @@ public function __construct(<params>) */ protected function getTraits(ClassMetadataInfo $metadata) { - if (PHP_VERSION_ID >= 50400 && ($metadata->reflClass !== null || class_exists($metadata->name))) { - $reflClass = $metadata->reflClass === null - ? new \ReflectionClass($metadata->name) - : $metadata->reflClass; - - $traits = array(); - - while ($reflClass !== false) { - $traits = array_merge($traits, $reflClass->getTraits()); - - $reflClass = $reflClass->getParentClass(); - } - - return $traits; + if (! ($metadata->reflClass !== null || class_exists($metadata->name))) { + return []; } - return array(); + $reflClass = $metadata->reflClass === null + ? new \ReflectionClass($metadata->name) + : $metadata->reflClass; + + $traits = array(); + + while ($reflClass !== false) { + $traits = array_merge($traits, $reflClass->getTraits()); + + $reflClass = $reflClass->getParentClass(); + } + + return $traits; } /**