From f262a1265f67abd82dbb34d4c7dbd52ce07de3de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Votruba?= Date: Mon, 9 Jun 2014 19:41:21 +0200 Subject: [PATCH] ClassAnalyzer::hasTrait returns false if not \ReflectionClass This throws class type error otherwise. I have my own BaseEntity class and ->getParentClass() returns null, so this collapses. --- src/Knp/DoctrineBehaviors/Reflection/ClassAnalyzer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Knp/DoctrineBehaviors/Reflection/ClassAnalyzer.php b/src/Knp/DoctrineBehaviors/Reflection/ClassAnalyzer.php index 2fb11e3f..9b0fa9fe 100644 --- a/src/Knp/DoctrineBehaviors/Reflection/ClassAnalyzer.php +++ b/src/Knp/DoctrineBehaviors/Reflection/ClassAnalyzer.php @@ -29,10 +29,10 @@ public function hasTrait(\ReflectionClass $class, $traitName, $isRecursive = fal $parentClass = $class->getParentClass(); - if ((false === $isRecursive) || (false === $parentClass)) { + if ((false === $isRecursive) || (false === $parentClass) || (null === $parentClass)) { return false; } - + return $this->hasTrait($parentClass, $traitName, $isRecursive); } @@ -65,4 +65,4 @@ public function hasProperty(\ReflectionClass $class, $propertyName) return $this->hasProperty($parentClass, $propertyName); } -} \ No newline at end of file +}