@@ -28,16 +28,15 @@ public function hasProperty(ClassReflection $classReflection, string $propertyNa
28
28
return false ;
29
29
}
30
30
31
- $ reflection = $ classReflection ->getNativeReflection ();
32
31
// We need to find a way to parse the entity annotation so that at the minimum the `entity_keys` are
33
32
// supported. The real fix is Drupal developers _really_ need to start writing @property definitions in the
34
33
// 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 ' )) {
36
35
// @todo revisit if it's a good idea to be true.
37
36
// Content entities have magical __get... so it is kind of true.
38
37
return true ;
39
38
}
40
- if (self ::classObjectIsSuperOfInterface ($ reflection , self ::getFieldItemListInterfaceObject ())->yes ()) {
39
+ if (self ::classObjectIsSuperOfInterface ($ classReflection -> getName () , self ::getFieldItemListInterfaceObject ())->yes ()) {
41
40
return FieldItemListPropertyReflection::canHandleProperty ($ classReflection , $ propertyName );
42
41
}
43
42
@@ -46,21 +45,19 @@ public function hasProperty(ClassReflection $classReflection, string $propertyNa
46
45
47
46
public function getProperty (ClassReflection $ classReflection , string $ propertyName ): PropertyReflection
48
47
{
49
- $ reflection = $ classReflection ->getNativeReflection ();
50
- if ($ reflection ->implementsInterface ('Drupal\Core\Entity\EntityInterface ' )) {
48
+ if ($ classReflection ->implementsInterface ('Drupal\Core\Entity\EntityInterface ' )) {
51
49
return new EntityFieldReflection ($ classReflection , $ propertyName );
52
50
}
53
- if (self ::classObjectIsSuperOfInterface ($ reflection , self ::getFieldItemListInterfaceObject ())->yes ()) {
51
+ if (self ::classObjectIsSuperOfInterface ($ classReflection -> getName () , self ::getFieldItemListInterfaceObject ())->yes ()) {
54
52
return new FieldItemListPropertyReflection ($ classReflection , $ propertyName );
55
53
}
56
54
57
55
throw new \LogicException ($ classReflection ->getName () . ":: $ propertyName should be handled earlier. " );
58
56
}
59
57
60
- public static function classObjectIsSuperOfInterface (\ ReflectionClass $ reflection , ObjectType $ interfaceObject ) : TrinaryLogic
58
+ public static function classObjectIsSuperOfInterface (string $ name , ObjectType $ interfaceObject ) : TrinaryLogic
61
59
{
62
- $ classObject = new ObjectType ($ reflection ->getName ());
63
- return $ interfaceObject ->isSuperTypeOf ($ classObject );
60
+ return $ interfaceObject ->isSuperTypeOf (new ObjectType ($ name ));
64
61
}
65
62
66
63
protected static function getFieldItemListInterfaceObject () : ObjectType
0 commit comments