function StaticReflectionParser::getParentParser

Same name in other branches
  1. 9 core/modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php \Drupal\migrate\Plugin\Discovery\StaticReflectionParser::getParentParser()
  2. 10 core/modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php \Drupal\migrate\Plugin\Discovery\StaticReflectionParser::getParentParser()
  3. 11.x 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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.