3 namespace Drupal\migrate\Plugin\Discovery;
5 use Doctrine\Common\Reflection\StaticReflectionParser as BaseStaticReflectionParser;
8 * Allows getting the reflection parser for the parent class.
11 * This is a temporary solution to the fact that migration source plugins have
12 * more than one provider. This functionality will be moved to core in
13 * https://www.drupal.org/node/2786355.
15 class StaticReflectionParser extends BaseStaticReflectionParser {
18 * If the current class extends another, get the parser for the latter.
20 * @param \Doctrine\Common\Reflection\StaticReflectionParser $parser
21 * The current static parser.
23 * The class finder. Must implement
24 * \Doctrine\Common\Reflection\ClassFinderInterface, but can do so
25 * implicitly (i.e., implements the interface's methods but not the actual
29 * The static parser for the parent if there's a parent class or NULL.
31 public static function getParentParser(BaseStaticReflectionParser $parser, $finder) {
32 // Ensure the class has been parsed before accessing the parentClassName
35 if ($parser->parentClassName) {
36 return new static($parser->parentClassName, $finder, $parser->classAnnotationOptimize);