1
0
Fork 0
mirror of synced 2025-04-01 12:26:11 +03:00

check if ReflectionClass::getTraits() method exists

This commit is contained in:
Adam Prager 2013-03-27 02:48:35 +01:00
parent 8898c91dfc
commit 9797177193

View file

@ -713,9 +713,11 @@ public function __construct()
if (class_exists($metadata->name)) {
$reflClass = new \ReflectionClass($metadata->name);
foreach ($reflClass->getTraits() as $trait) {
if ($trait->hasProperty($property)) {
return true;
if (method_exists($reflClass, 'getTraits')) {
foreach ($reflClass->getTraits() as $trait) {
if ($trait->hasProperty($property)) {
return true;
}
}
}
}
@ -747,9 +749,11 @@ public function __construct()
if (class_exists($metadata->name)) {
$reflClass = new \ReflectionClass($metadata->name);
foreach ($reflClass->getTraits() as $trait) {
if ($trait->hasMethod($method)) {
return true;
if (method_exists($reflClass, 'getTraits')) {
foreach ($reflClass->getTraits() as $trait) {
if ($trait->hasMethod($method)) {
return true;
}
}
}
}