You are here

public static function StaticReflectionParser::getParentParser in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php \Drupal\migrate\Plugin\Discovery\StaticReflectionParser::getParentParser()

If the current class extends another, get the parser for the latter.

Parameters

\Doctrine\Common\Reflection\StaticReflectionParser $parser: The current static parser.

$finder: The class finder. Must implement \Doctrine\Common\Reflection\ClassFinderInterface, but can do so implicitly (i.e., implements the interface's methods but not the actual interface).

Return value

static|null The static parser for the parent if there's a parent class or NULL.

1 call to StaticReflectionParser::getParentParser()
AnnotatedClassDiscoveryAutomatedProviders::prepareAnnotationDefinition in core/modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php
Prepares the annotation definition.

File

core/modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php, line 31

Class

StaticReflectionParser
Allows getting the reflection parser for the parent class.

Namespace

Drupal\migrate\Plugin\Discovery

Code

public static function getParentParser(BaseStaticReflectionParser $parser, $finder) {

  // Ensure the class has been parsed before accessing the parentClassName
  // property.
  $parser
    ->parse();
  if ($parser->parentClassName) {
    return new static($parser->parentClassName, $finder, $parser->classAnnotationOptimize);
  }
}