check if ReflectionClass::getTraits() method exists
This commit is contained in:
parent
8898c91dfc
commit
9797177193
1 changed files with 10 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue