5
5
use PHPStan \Reflection \ClassReflection ;
6
6
use PHPStan \Reflection \PropertiesClassReflectionExtension ;
7
7
use PHPStan \Reflection \PropertyReflection ;
8
+ use PHPStan \TrinaryLogic ;
8
9
use PHPStan \Type \ObjectType ;
9
10
10
11
/**
@@ -33,7 +34,7 @@ public function hasProperty(ClassReflection $classReflection, string $propertyNa
33
34
// Content entities have magical __get... so it is kind of true.
34
35
return true ;
35
36
}
36
- if (self ::classObjectIsSuperOfFieldItemList ($ reflection )) {
37
+ if (self ::classObjectIsSuperOfFieldItemList ($ reflection )-> yes () ) {
37
38
return FieldItemListPropertyReflection::canHandleProperty ($ classReflection , $ propertyName );
38
39
}
39
40
@@ -46,21 +47,21 @@ public function getProperty(ClassReflection $classReflection, string $propertyNa
46
47
if ($ reflection ->implementsInterface ('Drupal\Core\Entity\EntityInterface ' )) {
47
48
return new EntityFieldReflection ($ classReflection , $ propertyName );
48
49
}
49
- if (self ::classObjectIsSuperOfFieldItemList ($ reflection )) {
50
+ if (self ::classObjectIsSuperOfFieldItemList ($ reflection )-> yes () ) {
50
51
return new FieldItemListPropertyReflection ($ classReflection , $ propertyName );
51
52
}
52
53
53
54
throw new \LogicException ($ classReflection ->getName () . ":: $ propertyName should be handled earlier. " );
54
55
}
55
56
56
- protected static function classObjectIsSuperOfFieldItemList (\ReflectionClass $ reflection )
57
+ protected static function classObjectIsSuperOfFieldItemList (\ReflectionClass $ reflection ) : TrinaryLogic
57
58
{
58
59
$ classObject = new ObjectType ($ reflection ->getName ());
59
60
$ interfaceObject = self ::getFieldItemListInterfaceObject ();
60
61
return $ classObject ->isSuperTypeOf ($ interfaceObject );
61
62
}
62
63
63
- protected static function getFieldItemListInterfaceObject ()
64
+ protected static function getFieldItemListInterfaceObject () : ObjectType
64
65
{
65
66
return new ObjectType ('Drupal\Core\Field\FieldItemListInterface ' );
66
67
}
0 commit comments