1
0
Fork 0
mirror of synced 2025-04-03 13:23:37 +03:00

Refactoring test method: no need to test for PHP version

This commit is contained in:
Marco Pivetta 2015-01-14 20:13:46 +01:00
parent 8e28cb9119
commit 541e7bdf72

View file

@ -907,23 +907,23 @@ public function __construct(<params>)
*/ */
protected function getTraits(ClassMetadataInfo $metadata) protected function getTraits(ClassMetadataInfo $metadata)
{ {
if (PHP_VERSION_ID >= 50400 && ($metadata->reflClass !== null || class_exists($metadata->name))) { if (! ($metadata->reflClass !== null || class_exists($metadata->name))) {
$reflClass = $metadata->reflClass === null return [];
? new \ReflectionClass($metadata->name)
: $metadata->reflClass;
$traits = array();
while ($reflClass !== false) {
$traits = array_merge($traits, $reflClass->getTraits());
$reflClass = $reflClass->getParentClass();
}
return $traits;
} }
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;
} }
/** /**