Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityFieldMethodsViaMagicReflectionExtension.php

function EntityFieldMethodsViaMagicReflectionExtension::getMethod

File

vendor/mglaman/phpstan-drupal/src/Reflection/EntityFieldMethodsViaMagicReflectionExtension.php, line 36

Class

EntityFieldMethodsViaMagicReflectionExtension
Allows some common methods on fields.

Namespace

mglaman\PHPStanDrupal\Reflection

Code

public function getMethod(ClassReflection $classReflection, string $methodName) : MethodReflection {
    if ($methodName === 'referencedEntities') {
        $entityReferenceFieldItemListInterfaceType = new ObjectType('Drupal\\Core\\Field\\EntityReferenceFieldItemListInterface');
        $classReflection = $entityReferenceFieldItemListInterfaceType->getClassReflection();
        assert($classReflection !== null);
    }
    return new FieldItemListMethodReflection($classReflection, $methodName);
}
RSS feed
Powered by Drupal