Skip to content

Commit 695aba8

Browse files
committed
phpstan fixes
1 parent 88063c5 commit 695aba8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Reflection/EntityFieldsViaMagicReflectionExtension.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PHPStan\Reflection\ClassReflection;
66
use PHPStan\Reflection\PropertiesClassReflectionExtension;
77
use PHPStan\Reflection\PropertyReflection;
8+
use PHPStan\TrinaryLogic;
89
use PHPStan\Type\ObjectType;
910

1011
/**
@@ -33,7 +34,7 @@ public function hasProperty(ClassReflection $classReflection, string $propertyNa
3334
// Content entities have magical __get... so it is kind of true.
3435
return true;
3536
}
36-
if (self::classObjectIsSuperOfFieldItemList($reflection)) {
37+
if (self::classObjectIsSuperOfFieldItemList($reflection)->yes()) {
3738
return FieldItemListPropertyReflection::canHandleProperty($classReflection, $propertyName);
3839
}
3940

@@ -46,21 +47,21 @@ public function getProperty(ClassReflection $classReflection, string $propertyNa
4647
if ($reflection->implementsInterface('Drupal\Core\Entity\EntityInterface')) {
4748
return new EntityFieldReflection($classReflection, $propertyName);
4849
}
49-
if (self::classObjectIsSuperOfFieldItemList($reflection)) {
50+
if (self::classObjectIsSuperOfFieldItemList($reflection)->yes()) {
5051
return new FieldItemListPropertyReflection($classReflection, $propertyName);
5152
}
5253

5354
throw new \LogicException($classReflection->getName() . "::$propertyName should be handled earlier.");
5455
}
5556

56-
protected static function classObjectIsSuperOfFieldItemList(\ReflectionClass $reflection)
57+
protected static function classObjectIsSuperOfFieldItemList(\ReflectionClass $reflection) : TrinaryLogic
5758
{
5859
$classObject = new ObjectType($reflection->getName());
5960
$interfaceObject = self::getFieldItemListInterfaceObject();
6061
return $classObject->isSuperTypeOf($interfaceObject);
6162
}
6263

63-
protected static function getFieldItemListInterfaceObject()
64+
protected static function getFieldItemListInterfaceObject() : ObjectType
6465
{
6566
return new ObjectType('Drupal\Core\Field\FieldItemListInterface');
6667
}

0 commit comments

Comments
 (0)