@@ -28,16 +28,15 @@ public function hasProperty(ClassReflection $classReflection, string $propertyNa
2828 return false ;
2929 }
3030
31- $ reflection = $ classReflection ->getNativeReflection ();
3231 // We need to find a way to parse the entity annotation so that at the minimum the `entity_keys` are
3332 // supported. The real fix is Drupal developers _really_ need to start writing @property definitions in the
3433 // class doc if they don't get `get` methods.
35- if ($ reflection ->implementsInterface ('Drupal\Core\Entity\ContentEntityInterface ' )) {
34+ if ($ classReflection ->implementsInterface ('Drupal\Core\Entity\ContentEntityInterface ' )) {
3635 // @todo revisit if it's a good idea to be true.
3736 // Content entities have magical __get... so it is kind of true.
3837 return true ;
3938 }
40- if (self ::classObjectIsSuperOfInterface ($ reflection , self ::getFieldItemListInterfaceObject ())->yes ()) {
39+ if (self ::classObjectIsSuperOfInterface ($ classReflection -> getName () , self ::getFieldItemListInterfaceObject ())->yes ()) {
4140 return FieldItemListPropertyReflection::canHandleProperty ($ classReflection , $ propertyName );
4241 }
4342
@@ -46,21 +45,19 @@ public function hasProperty(ClassReflection $classReflection, string $propertyNa
4645
4746 public function getProperty (ClassReflection $ classReflection , string $ propertyName ): PropertyReflection
4847 {
49- $ reflection = $ classReflection ->getNativeReflection ();
50- if ($ reflection ->implementsInterface ('Drupal\Core\Entity\EntityInterface ' )) {
48+ if ($ classReflection ->implementsInterface ('Drupal\Core\Entity\EntityInterface ' )) {
5149 return new EntityFieldReflection ($ classReflection , $ propertyName );
5250 }
53- if (self ::classObjectIsSuperOfInterface ($ reflection , self ::getFieldItemListInterfaceObject ())->yes ()) {
51+ if (self ::classObjectIsSuperOfInterface ($ classReflection -> getName () , self ::getFieldItemListInterfaceObject ())->yes ()) {
5452 return new FieldItemListPropertyReflection ($ classReflection , $ propertyName );
5553 }
5654
5755 throw new \LogicException ($ classReflection ->getName () . ":: $ propertyName should be handled earlier. " );
5856 }
5957
60- public static function classObjectIsSuperOfInterface (\ ReflectionClass $ reflection , ObjectType $ interfaceObject ) : TrinaryLogic
58+ public static function classObjectIsSuperOfInterface (string $ name , ObjectType $ interfaceObject ) : TrinaryLogic
6159 {
62- $ classObject = new ObjectType ($ reflection ->getName ());
63- return $ interfaceObject ->isSuperTypeOf ($ classObject );
60+ return $ interfaceObject ->isSuperTypeOf (new ObjectType ($ name ));
6461 }
6562
6663 protected static function getFieldItemListInterfaceObject () : ObjectType
0 commit comments