1
0
mirror of synced 2025-01-31 04:21:44 +03:00

only check for traits when class exists

This commit is contained in:
Adam Prager 2013-03-26 21:28:09 +01:00
parent 8e3e2e770a
commit 8898c91dfc

View File

@ -710,11 +710,13 @@ public function __construct()
}
// check traits for existing property
$reflClass = new \ReflectionClass($metadata->name);
if (class_exists($metadata->name)) {
$reflClass = new \ReflectionClass($metadata->name);
foreach ($reflClass->getTraits() as $trait) {
if ($trait->hasProperty($property)) {
return true;
foreach ($reflClass->getTraits() as $trait) {
if ($trait->hasProperty($property)) {
return true;
}
}
}
@ -742,11 +744,13 @@ public function __construct()
}
// check traits for existing method
$reflClass = new \ReflectionClass($metadata->name);
if (class_exists($metadata->name)) {
$reflClass = new \ReflectionClass($metadata->name);
foreach ($reflClass->getTraits() as $trait) {
if ($trait->hasMethod($method)) {
return true;
foreach ($reflClass->getTraits() as $trait) {
if ($trait->hasMethod($method)) {
return true;
}
}
}