function EntityFieldsViaMagicReflectionExtension::getProperty
File
-
vendor/
mglaman/ phpstan-drupal/ src/ Reflection/ EntityFieldsViaMagicReflectionExtension.php, line 54
Class
- EntityFieldsViaMagicReflectionExtension
- Allows field access via magic methods
Namespace
mglaman\PHPStanDrupal\ReflectionCode
public function getProperty(ClassReflection $classReflection, string $propertyName) : PropertyReflection {
if ($classReflection->implementsInterface('Drupal\\Core\\Entity\\EntityInterface')) {
return new EntityFieldReflection($classReflection, $propertyName);
}
if (self::classObjectIsSuperOfInterface($classReflection->getName(), self::getFieldItemListInterfaceObject())
->yes()) {
return new FieldItemListPropertyReflection($classReflection, $propertyName);
}
throw new LogicException($classReflection->getName() . "::{$propertyName} should be handled earlier.");
}